Login  Register

Re: Macro Checkboxes

Posted by Michael Schmid on Oct 10, 2012; 3:02pm
URL: http://imagej.273.s1.nabble.com/Macro-Checkboxes-tp5000361p5000366.html

Hi Nick,

in my macro, 'showOptions' is simply a String variable. Actually, after sending the email I noticed that it is not nice programming style, because the value for 'show' is only 'outline'; the other options are unrelated to 'show'. Sorry for the confusion.
So it should better be (for better readability; it does not change the function):

 moreOptions = "";
 if (Display_results) moreOptions += " display";
 if (Exclude_edges) moreOptions += " exclude";
 if (Add_to_manager) moreOptions += " add";
 run("Analyze Particles...", "size=350-Infinity  circularity=0.00-1.00 show=Outlines"+moreOptions);


Michael
________________________________________________________________


On Oct 10, 2012, at 16:56, Nikolaos Michelarakis wrote:

> Thank you very much, it works now. I am trying to find the showOptions in the functions list but it isn't there. Could you explain me exactly what it does and where did you find it?
>
> Nicholas
>
>
> ----- Message from [hidden email] ---------
>    Date: Wed, 10 Oct 2012 16:05:34 +0200
>    From: Michael Schmid <[hidden email]>
> Reply-To: [hidden email]
> Subject: Re: Macro Checkboxes
>      To: [hidden email]
>
>
>> Hi Nick,
>>
>> you can try something like:
>>  showOptions = "Outlines";
>>  if (Display_results) showOptions += " display";
>>  if (Exclude_edges) showOptions += " exclude";
>>  if (Add_to_manager) showOptions += " add";
>>  run("Analyze Particles...", "size=350-Infinity  circularity=0.00-1.00 show="+showOptions);
>>
>> Michael
>> ________________________________________________________________
>> On Oct 10, 2012, at 15:56, Nikolaos Michelarakis wrote:
>>
>>> Hello,
>>>
>>> I have those three checkboxes:
>>>
>>> Dialog.addCheckbox("Display Results", true);
>>> Dialog.addCheckbox("Exclude Edges", true);
>>> Dialog.addCheckbox("Add to Manager", true);
>>>
>>> Display_results = Dialog.getCheckbox();
>>> Exclude_edges = Dialog.getCheckbox();
>>> Add_to_manager = Dialog.getCheckbox();
>>>
>>> I want to run the following line:
>>>
>>> run("Analyze Particles...", "size=350-Infinity circularity=0.00-1.00
>>> show=Outlines display exclude add");
>>>
>>> and I want to do it in a way so when display_results is true for  example and exclude_edges is false to run it with those parameters.  Is there a way to do it in one line or do I have to write a  seperate line for each case, e.g when display_results=true,  exclude_edges=false, Add_to_manager=false, etc.
>>>
>>> Thanks,
>>>
>>> Nick
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
>
> ----- End message from [hidden email] -----
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html