Hello everyone,
I'm trying to write a macro that makes multiple circular ROIs in the image but with the option to decide the diameter of them. I wrote this: macro "Macro 1 [a]" { defaultValue=15; radius = getNumber("Diameter", defaultValue); } macro "Macro 2 [d]" { getCursorLoc(x, y, z, flags); makeOval(x-radius, y-radius, radius*2, radius*2); roiManager("add"); } but obviously when I press the "d" key the macro can't find the "radius" value! I don't want to merge all the lines in only one macro because I'd like to enter only one time the "radius" value pressing "a" and then make multiple ROIs pressing "d". Is there a way to pass the value entered in the first macro to the second macro? Thanks for your time! Best regards, Riccardo -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Riccardo,
have a look at "Macro Language (download PDF)" at <http://rsb.info.nih.gov/ij/developer/index.html> Especially the topic "Macro Sets" and global variables should help. HTH Herbie ___________________________ On 30.12.12 15:37, Riccardo Cabbri wrote: > Hello everyone, > I'm trying to write a macro that makes multiple circular ROIs in the > image but with the option to decide the diameter of them. > I wrote this: > > macro "Macro 1 [a]" { > defaultValue=15; > radius = getNumber("Diameter", defaultValue); > } > macro "Macro 2 [d]" { > getCursorLoc(x, y, z, flags); > makeOval(x-radius, y-radius, radius*2, radius*2); > roiManager("add"); > } > > but obviously when I press the "d" key the macro can't find the "radius" > value! > I don't want to merge all the lines in only one macro because I'd like > to enter only one time the "radius" value pressing "a" and then make > multiple ROIs pressing "d". > Is there a way to pass the value entered in the first macro to the > second macro? > Thanks for your time! > Best regards, > Riccardo > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I had already seen that piece on the pdf you suggested me but I didn't
read it carefully, sorry for that! Now it works like a charm! Thank you for your kindness and happy new year! Riccardo On 30/12/2012 15:58, Herbie wrote: > Riccardo, > > have a look at "Macro Language (download PDF)" at > > <http://rsb.info.nih.gov/ij/developer/index.html> > > Especially the topic "Macro Sets" and global variables should help. > > HTH > > Herbie > ___________________________ > On 30.12.12 15:37, Riccardo Cabbri wrote: >> Hello everyone, >> I'm trying to write a macro that makes multiple circular ROIs in the >> image but with the option to decide the diameter of them. >> I wrote this: >> >> macro "Macro 1 [a]" { >> defaultValue=15; >> radius = getNumber("Diameter", defaultValue); >> } >> macro "Macro 2 [d]" { >> getCursorLoc(x, y, z, flags); >> makeOval(x-radius, y-radius, radius*2, radius*2); >> roiManager("add"); >> } >> >> but obviously when I press the "d" key the macro can't find the "radius" >> value! >> I don't want to merge all the lines in only one macro because I'd like >> to enter only one time the "radius" value pressing "a" and then make >> multiple ROIs pressing "d". >> Is there a way to pass the value entered in the first macro to the >> second macro? >> Thanks for your time! >> Best regards, >> Riccardo >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |