Hello,
I have written this so far Width = 1024; Height = 1024; Dialog.create("Project Macro"); Dialog.addMessage("Find Maxima"); Dialog.addNumber("Noise Tolerance", 10); Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", "32-bit", "RGB")); Dialog.addMessage("Choose Threshold"); Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", "32-bit", "RGB")); Dialog.addMessage("Analyze Particles"); Dialog.addNumber("Size (Pixel^2)", 0); Dialog.addNumber("Circularity", 0); Dialog.addCheckbox("Display Results", true); Dialog.addCheckbox("Exclude Edges", true); Dialog.addCheckbox("Add to Manager", true); Noise_Tolerance = Dialog.getNumber(); Output_Type = Dialog.getChoice(); Threshold = Dialog.getChoice(); Size = Dialog.getNumber(); Circularity = Dialog.getNumber(); Display_results = Dialog.getCheckbox(); Exclude_edges = Dialog.getCheckbox(); Add_to_manager = Dialog.getCheckbox(); Dialog.show(); Is there any way to run commands such as "run("Find Maxima...", "noise=10 output=[Segmented Particles]");" but in the noise or in the output use the values of the varaiables, like Noise_Tolerance for example, that I typed in the dialog box? Thanks in advance, Nicholas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I pretty novice at writing macros, but I've been using similar lines of late.
I think the way the run("Find Maxima..." is written at the end may work for your purposes. I changed the "Output Type" Dialog.addChoice() to debug on my machine. I wasn't sure what you intended for that line. I think the Dialog.show() needed to be moved up. Otherwise, it'll just use the default variables. I sometimes find it helpful when debugging to print variables to the Log window just to make sure my inputs are actually input. Best, George Width = getWidth(); Height = getHeight(); Dialog.create("Project Macro"); Dialog.addMessage("Find Maxima"); Dialog.addNumber("Noise Tolerance", 10); Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima Within Tolerance", "Segmented Particles", "Point Selection", "List", "Count")); Dialog.addMessage("Choose Threshold"); Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", "32-bit", "RGB")); Dialog.addMessage("Analyze Particles"); Dialog.addNumber("Size (Pixel^2)", 0); Dialog.addNumber("Circularity", 0); Dialog.addCheckbox("Display Results", true); Dialog.addCheckbox("Exclude Edges", true); Dialog.addCheckbox("Add to Manager", true); Dialog.show(); Noise_Tolerance = Dialog.getNumber(); Output_Type = Dialog.getChoice(); Threshold = Dialog.getChoice(); Size = Dialog.getNumber(); Circularity = Dialog.getNumber(); Display_results = Dialog.getCheckbox(); Exclude_edges = Dialog.getCheckbox(); Add_to_manager = Dialog.getCheckbox(); print("\\Clear"); print(Noise_Tolerance); print(Output_Type); run("Find Maxima...", "noise="+Noise_Tolerance+" output=["+Output_Type+"]"); On Oct 5, 2012, at 10:44 AM, Nikolaos Michelarakis wrote: > Hello, > > I have written this so far > > Width = 1024; Height = 1024; > Dialog.create("Project Macro"); > Dialog.addMessage("Find Maxima"); > Dialog.addNumber("Noise Tolerance", 10); > Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", "32-bit", > "RGB")); > Dialog.addMessage("Choose Threshold"); > Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", "32-bit", "RGB")); > Dialog.addMessage("Analyze Particles"); > Dialog.addNumber("Size (Pixel^2)", 0); > Dialog.addNumber("Circularity", 0); > Dialog.addCheckbox("Display Results", true); > Dialog.addCheckbox("Exclude Edges", true); > Dialog.addCheckbox("Add to Manager", true); > Noise_Tolerance = Dialog.getNumber(); > Output_Type = Dialog.getChoice(); > Threshold = Dialog.getChoice(); > Size = Dialog.getNumber(); > Circularity = Dialog.getNumber(); > Display_results = Dialog.getCheckbox(); > Exclude_edges = Dialog.getCheckbox(); > Add_to_manager = Dialog.getCheckbox(); > Dialog.show(); > > Is there any way to run commands such as "run("Find Maxima...", > "noise=10 output=[Segmented Particles]");" but in the noise or in the > output use the values of the varaiables, like Noise_Tolerance for > example, that I typed in the dialog box? > > Thanks in advance, > > Nicholas > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html George H. Patterson Building 13 3E33 13 South Drive Biophotonics Section National Institute of Biomedical Imaging and Bioengineering National Institutes of Health Bethesda, MD 20892 Office: 301-443-0241 Fax: 301-496-6608 [hidden email] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thank you very much, it's my first time writing a macro, Ill keep
that, about the variables in mind. I am not sure what you mean about the Output_type. What I wanted to do with that line was to have a drop down list with the possible output types. Thanks for the Dialog.show() as well, I hadnt noticed it Nicholas ----- Message from [hidden email] --------- Date: Fri, 5 Oct 2012 11:26:06 -0400 From: George Patterson <[hidden email]> Reply-To: [hidden email] Subject: Re: Macro variables To: [hidden email] > I pretty novice at writing macros, but I've been using similar lines of late. > I think the way the run("Find Maxima..." is written at the end may > work for your purposes. > I changed the "Output Type" Dialog.addChoice() to debug on my > machine. I wasn't sure what you intended for that line. > I think the Dialog.show() needed to be moved up. Otherwise, it'll > just use the default variables. > I sometimes find it helpful when debugging to print variables to the > Log window just to make sure my inputs are actually input. > Best, > George > > > > Width = getWidth(); > Height = getHeight(); > Dialog.create("Project Macro"); > Dialog.addMessage("Find Maxima"); > Dialog.addNumber("Noise Tolerance", 10); > Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima > Within Tolerance", "Segmented Particles", "Point Selection", "List", > "Count")); > Dialog.addMessage("Choose Threshold"); > Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", "32-bit", "RGB")); > Dialog.addMessage("Analyze Particles"); > Dialog.addNumber("Size (Pixel^2)", 0); > Dialog.addNumber("Circularity", 0); > Dialog.addCheckbox("Display Results", true); > Dialog.addCheckbox("Exclude Edges", true); > Dialog.addCheckbox("Add to Manager", true); > Dialog.show(); > > Noise_Tolerance = Dialog.getNumber(); > Output_Type = Dialog.getChoice(); > Threshold = Dialog.getChoice(); > Size = Dialog.getNumber(); > Circularity = Dialog.getNumber(); > Display_results = Dialog.getCheckbox(); > Exclude_edges = Dialog.getCheckbox(); > Add_to_manager = Dialog.getCheckbox(); > > print("\\Clear"); > print(Noise_Tolerance); > print(Output_Type); > > run("Find Maxima...", "noise="+Noise_Tolerance+" output=["+Output_Type+"]"); > > > > > > On Oct 5, 2012, at 10:44 AM, Nikolaos Michelarakis wrote: > >> Hello, >> >> I have written this so far >> >> Width = 1024; Height = 1024; >> Dialog.create("Project Macro"); >> Dialog.addMessage("Find Maxima"); >> Dialog.addNumber("Noise Tolerance", 10); >> Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", "32-bit", >> "RGB")); >> Dialog.addMessage("Choose Threshold"); >> Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", >> "32-bit", "RGB")); >> Dialog.addMessage("Analyze Particles"); >> Dialog.addNumber("Size (Pixel^2)", 0); >> Dialog.addNumber("Circularity", 0); >> Dialog.addCheckbox("Display Results", true); >> Dialog.addCheckbox("Exclude Edges", true); >> Dialog.addCheckbox("Add to Manager", true); >> Noise_Tolerance = Dialog.getNumber(); >> Output_Type = Dialog.getChoice(); >> Threshold = Dialog.getChoice(); >> Size = Dialog.getNumber(); >> Circularity = Dialog.getNumber(); >> Display_results = Dialog.getCheckbox(); >> Exclude_edges = Dialog.getCheckbox(); >> Add_to_manager = Dialog.getCheckbox(); >> Dialog.show(); >> >> Is there any way to run commands such as "run("Find Maxima...", >> "noise=10 output=[Segmented Particles]");" but in the noise or in the >> output use the values of the varaiables, like Noise_Tolerance for >> example, that I typed in the dialog box? >> >> Thanks in advance, >> >> Nicholas >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > George H. Patterson > Building 13 3E33 > 13 South Drive > Biophotonics Section > National Institute of Biomedical Imaging and Bioengineering > National Institutes of Health > Bethesda, MD 20892 > Office: 301-443-0241 > Fax: 301-496-6608 > [hidden email] > > -- > 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 |
In your original line of code you had
Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", "32-bit", "RGB")); but I think the "output=" in the run("Find Maxima") command was looking for "Single Points", "Maxima Within Tolerance", "Segmented Particles", "Point Selection", "List", or "Count". Did you mean to have that particular Dialog.addChoice() determine which image type to use for the processed image? Do you intend to output the "Find Maxima" as "Segmented Particles" every time? The bit that I changed simply gives the choices associated with the dialog when run the "Find Maxima", so you'll need to remove that variable from the run("Find Maxima") line at the end of that script if you don't want those choices in your dialog. best, George On Oct 5, 2012, at 11:55 AM, Nikolaos Michelarakis wrote: > Thank you very much, it's my first time writing a macro, Ill keep > that, about the variables in mind. > I am not sure what you mean about the Output_type. What I wanted to do > with that line was to have a drop down list with the possible output > types. > Thanks for the Dialog.show() as well, I hadnt noticed it > > Nicholas > > ----- Message from [hidden email] --------- > Date: Fri, 5 Oct 2012 11:26:06 -0400 > From: George Patterson <[hidden email]> > Reply-To: [hidden email] > Subject: Re: Macro variables > To: [hidden email] > > >> I pretty novice at writing macros, but I've been using similar lines of late. >> I think the way the run("Find Maxima..." is written at the end may >> work for your purposes. >> I changed the "Output Type" Dialog.addChoice() to debug on my >> machine. I wasn't sure what you intended for that line. >> I think the Dialog.show() needed to be moved up. Otherwise, it'll >> just use the default variables. >> I sometimes find it helpful when debugging to print variables to the >> Log window just to make sure my inputs are actually input. >> Best, >> George >> >> >> >> Width = getWidth(); >> Height = getHeight(); >> Dialog.create("Project Macro"); >> Dialog.addMessage("Find Maxima"); >> Dialog.addNumber("Noise Tolerance", 10); >> Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima >> Within Tolerance", "Segmented Particles", "Point Selection", "List", >> "Count")); >> Dialog.addMessage("Choose Threshold"); >> Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", "32-bit", "RGB")); >> Dialog.addMessage("Analyze Particles"); >> Dialog.addNumber("Size (Pixel^2)", 0); >> Dialog.addNumber("Circularity", 0); >> Dialog.addCheckbox("Display Results", true); >> Dialog.addCheckbox("Exclude Edges", true); >> Dialog.addCheckbox("Add to Manager", true); >> Dialog.show(); >> >> Noise_Tolerance = Dialog.getNumber(); >> Output_Type = Dialog.getChoice(); >> Threshold = Dialog.getChoice(); >> Size = Dialog.getNumber(); >> Circularity = Dialog.getNumber(); >> Display_results = Dialog.getCheckbox(); >> Exclude_edges = Dialog.getCheckbox(); >> Add_to_manager = Dialog.getCheckbox(); >> >> print("\\Clear"); >> print(Noise_Tolerance); >> print(Output_Type); >> >> run("Find Maxima...", "noise="+Noise_Tolerance+" output=["+Output_Type+"]"); >> >> >> >> >> >> On Oct 5, 2012, at 10:44 AM, Nikolaos Michelarakis wrote: >> >>> Hello, >>> >>> I have written this so far >>> >>> Width = 1024; Height = 1024; >>> Dialog.create("Project Macro"); >>> Dialog.addMessage("Find Maxima"); >>> Dialog.addNumber("Noise Tolerance", 10); >>> Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", "32-bit", >>> "RGB")); >>> Dialog.addMessage("Choose Threshold"); >>> Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", >>> "32-bit", "RGB")); >>> Dialog.addMessage("Analyze Particles"); >>> Dialog.addNumber("Size (Pixel^2)", 0); >>> Dialog.addNumber("Circularity", 0); >>> Dialog.addCheckbox("Display Results", true); >>> Dialog.addCheckbox("Exclude Edges", true); >>> Dialog.addCheckbox("Add to Manager", true); >>> Noise_Tolerance = Dialog.getNumber(); >>> Output_Type = Dialog.getChoice(); >>> Threshold = Dialog.getChoice(); >>> Size = Dialog.getNumber(); >>> Circularity = Dialog.getNumber(); >>> Display_results = Dialog.getCheckbox(); >>> Exclude_edges = Dialog.getCheckbox(); >>> Add_to_manager = Dialog.getCheckbox(); >>> Dialog.show(); >>> >>> Is there any way to run commands such as "run("Find Maxima...", >>> "noise=10 output=[Segmented Particles]");" but in the noise or in the >>> output use the values of the varaiables, like Noise_Tolerance for >>> example, that I typed in the dialog box? >>> >>> Thanks in advance, >>> >>> Nicholas >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> >> George H. Patterson >> Building 13 3E33 >> 13 South Drive >> Biophotonics Section >> National Institute of Biomedical Imaging and Bioengineering >> National Institutes of Health >> Bethesda, MD 20892 >> Office: 301-443-0241 >> Fax: 301-496-6608 >> [hidden email] >> >> -- >> 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 George H. Patterson Building 13 3E33 13 South Drive Biophotonics Section National Institute of Biomedical Imaging and Bioengineering National Institutes of Health Bethesda, MD 20892 Office: 301-443-0241 Fax: 301-496-6608 [hidden email] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Oh, I just had written the line after it first and just copied and
pasted, I was planning to change it but just hadn't done it yet, this was like my "draft" macro, trying to find out how everything works, thanks anyway though :P Nicholas ----- Message from [hidden email] --------- Date: Fri, 5 Oct 2012 12:36:42 -0400 From: George Patterson <[hidden email]> Reply-To: [hidden email] Subject: Re: Macro variables To: [hidden email] > In your original line of code you had > Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", > "32-bit", "RGB")); > but I think the "output=" in the run("Find Maxima") command was > looking for "Single Points", "Maxima Within Tolerance", "Segmented > Particles", "Point Selection", "List", or "Count". > Did you mean to have that particular Dialog.addChoice() determine > which image type to use for the processed image? > Do you intend to output the "Find Maxima" as "Segmented Particles" > every time? > The bit that I changed simply gives the choices associated with the > dialog when run the "Find Maxima", so you'll need to remove that > variable from the run("Find Maxima") line at the end of that script > if you don't want those choices in your dialog. > best, > George > > > On Oct 5, 2012, at 11:55 AM, Nikolaos Michelarakis wrote: > >> Thank you very much, it's my first time writing a macro, Ill keep >> that, about the variables in mind. >> I am not sure what you mean about the Output_type. What I wanted to do >> with that line was to have a drop down list with the possible output >> types. >> Thanks for the Dialog.show() as well, I hadnt noticed it >> >> Nicholas >> >> ----- Message from [hidden email] --------- >> Date: Fri, 5 Oct 2012 11:26:06 -0400 >> From: George Patterson <[hidden email]> >> Reply-To: [hidden email] >> Subject: Re: Macro variables >> To: [hidden email] >> >> >>> I pretty novice at writing macros, but I've been using similar >>> lines of late. >>> I think the way the run("Find Maxima..." is written at the end may >>> work for your purposes. >>> I changed the "Output Type" Dialog.addChoice() to debug on my >>> machine. I wasn't sure what you intended for that line. >>> I think the Dialog.show() needed to be moved up. Otherwise, it'll >>> just use the default variables. >>> I sometimes find it helpful when debugging to print variables to the >>> Log window just to make sure my inputs are actually input. >>> Best, >>> George >>> >>> >>> >>> Width = getWidth(); >>> Height = getHeight(); >>> Dialog.create("Project Macro"); >>> Dialog.addMessage("Find Maxima"); >>> Dialog.addNumber("Noise Tolerance", 10); >>> Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima >>> Within Tolerance", "Segmented Particles", "Point Selection", "List", >>> "Count")); >>> Dialog.addMessage("Choose Threshold"); >>> Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", >>> "32-bit", "RGB")); >>> Dialog.addMessage("Analyze Particles"); >>> Dialog.addNumber("Size (Pixel^2)", 0); >>> Dialog.addNumber("Circularity", 0); >>> Dialog.addCheckbox("Display Results", true); >>> Dialog.addCheckbox("Exclude Edges", true); >>> Dialog.addCheckbox("Add to Manager", true); >>> Dialog.show(); >>> >>> Noise_Tolerance = Dialog.getNumber(); >>> Output_Type = Dialog.getChoice(); >>> Threshold = Dialog.getChoice(); >>> Size = Dialog.getNumber(); >>> Circularity = Dialog.getNumber(); >>> Display_results = Dialog.getCheckbox(); >>> Exclude_edges = Dialog.getCheckbox(); >>> Add_to_manager = Dialog.getCheckbox(); >>> >>> print("\\Clear"); >>> print(Noise_Tolerance); >>> print(Output_Type); >>> >>> run("Find Maxima...", "noise="+Noise_Tolerance+" >>> output=["+Output_Type+"]"); >>> >>> >>> >>> >>> >>> On Oct 5, 2012, at 10:44 AM, Nikolaos Michelarakis wrote: >>> >>>> Hello, >>>> >>>> I have written this so far >>>> >>>> Width = 1024; Height = 1024; >>>> Dialog.create("Project Macro"); >>>> Dialog.addMessage("Find Maxima"); >>>> Dialog.addNumber("Noise Tolerance", 10); >>>> Dialog.addChoice("Output Type:", newArray("8-bit", "16-bit", "32-bit", >>>> "RGB")); >>>> Dialog.addMessage("Choose Threshold"); >>>> Dialog.addChoice("Threshold:", newArray("8-bit", "16-bit", >>>> "32-bit", "RGB")); >>>> Dialog.addMessage("Analyze Particles"); >>>> Dialog.addNumber("Size (Pixel^2)", 0); >>>> Dialog.addNumber("Circularity", 0); >>>> Dialog.addCheckbox("Display Results", true); >>>> Dialog.addCheckbox("Exclude Edges", true); >>>> Dialog.addCheckbox("Add to Manager", true); >>>> Noise_Tolerance = Dialog.getNumber(); >>>> Output_Type = Dialog.getChoice(); >>>> Threshold = Dialog.getChoice(); >>>> Size = Dialog.getNumber(); >>>> Circularity = Dialog.getNumber(); >>>> Display_results = Dialog.getCheckbox(); >>>> Exclude_edges = Dialog.getCheckbox(); >>>> Add_to_manager = Dialog.getCheckbox(); >>>> Dialog.show(); >>>> >>>> Is there any way to run commands such as "run("Find Maxima...", >>>> "noise=10 output=[Segmented Particles]");" but in the noise or in the >>>> output use the values of the varaiables, like Noise_Tolerance for >>>> example, that I typed in the dialog box? >>>> >>>> Thanks in advance, >>>> >>>> Nicholas >>>> >>>> -- >>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >>> >>> George H. Patterson >>> Building 13 3E33 >>> 13 South Drive >>> Biophotonics Section >>> National Institute of Biomedical Imaging and Bioengineering >>> National Institutes of Health >>> Bethesda, MD 20892 >>> Office: 301-443-0241 >>> Fax: 301-496-6608 >>> [hidden email] >>> >>> -- >>> 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 > > George H. Patterson > Building 13 3E33 > 13 South Drive > Biophotonics Section > National Institute of Biomedical Imaging and Bioengineering > National Institutes of Health > Bethesda, MD 20892 > Office: 301-443-0241 > Fax: 301-496-6608 > [hidden email] > > -- > 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 |
Free forum by Nabble | Edit this page |