Hi,
my macro is using the command Edit>Selection>Straighten in a loop to extract lines from several ROIs on a stack. The code looks like this: ... in a loop { selectWindow(rawStack); roiManager("Select", currROIindex); run("Straighten...", "line=20 process"); rename(currOutputName); } The problem with this is that sometimes the "rename"-command is applied on the raw stack image instead of the straightened output image. I cannot exclude that it is a problem with users' impatience (and clicking on images at the wrong time), but it might help to make it more stable, anyway. Is there an option for Straighten to do the renaming immediately? I imagine something like: run("Straighten...", "line=20 output=whateverWeWantToCallTheOutput"); If there is no such option, could someone give me a hint to the place where I can modify it myself (my Java skills are limited, but I would give it a shot)? Thanks a lot! Best regards, Volker -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Tuesday 06 May 2014 10:00:34 you wrote:
> Hi, > my macro is using the command Edit>Selection>Straighten in a loop to > extract lines from several ROIs on a stack. The code looks like this: > > ... in a loop > { > selectWindow(rawStack); > roiManager("Select", currROIindex); > run("Straighten...", "line=20 process"); > rename(currOutputName); > } > > The problem with this is that sometimes the "rename"-command is > applied on the raw stack image instead of the straightened output > image. I cannot exclude that it is a problem with users' impatience > (and clicking on images at the wrong time), but it might help to make > it more stable, anyway. > > Is there an option for Straighten to do the renaming immediately? I > imagine something like: Not in the macro language. You could specify again the selected image that needs to be renamed. Assuming that the window has no extension, the straightened image name should be predictable: the original name +"-1". Something like: { selectWindow(rawStack); roiManager("Select", currROIindex); run("Straighten...", "line=20 process"); selectWindow(originalName+"-1"); rename(currOutputName); } Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Gabriel,
thank you for the quick reply, I will implement it like that. Cheers, Volker 2014-05-06 10:12 GMT+02:00 Gabriel Landini <[hidden email]>: > On Tuesday 06 May 2014 10:00:34 you wrote: >> Hi, >> my macro is using the command Edit>Selection>Straighten in a loop to >> extract lines from several ROIs on a stack. The code looks like this: >> >> ... in a loop >> { >> selectWindow(rawStack); >> roiManager("Select", currROIindex); >> run("Straighten...", "line=20 process"); >> rename(currOutputName); >> } >> >> The problem with this is that sometimes the "rename"-command is >> applied on the raw stack image instead of the straightened output >> image. I cannot exclude that it is a problem with users' impatience >> (and clicking on images at the wrong time), but it might help to make >> it more stable, anyway. >> >> Is there an option for Straighten to do the renaming immediately? I >> imagine something like: > > Not in the macro language. > > You could specify again the selected image that needs to be renamed. > Assuming that the window has no extension, the straightened image name should > be predictable: the original name +"-1". > > Something like: > > { > selectWindow(rawStack); > roiManager("Select", currROIindex); > run("Straighten...", "line=20 process"); > selectWindow(originalName+"-1"); > rename(currOutputName); > } > > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Volker,
If this does not solve the problem it is possible that the Straighten image is not created yet when you try to rename it. As a result the raw image is renamed. If so, add: wait(100); before rename. You can change the 100 to any number that works (1000 = 1 second). Best wishes Kees -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Volker Wirth Sent: 06 May 2014 09:56 To: [hidden email] Subject: Re: Rename output from "Straighten..." (as a function argument) Hi Gabriel, thank you for the quick reply, I will implement it like that. Cheers, Volker 2014-05-06 10:12 GMT+02:00 Gabriel Landini <[hidden email]>: > On Tuesday 06 May 2014 10:00:34 you wrote: >> Hi, >> my macro is using the command Edit>Selection>Straighten in a loop to >> extract lines from several ROIs on a stack. The code looks like this: >> >> ... in a loop >> { >> selectWindow(rawStack); >> roiManager("Select", currROIindex); >> run("Straighten...", "line=20 process"); >> rename(currOutputName); >> } >> >> The problem with this is that sometimes the "rename"-command is >> applied on the raw stack image instead of the straightened output >> image. I cannot exclude that it is a problem with users' impatience >> (and clicking on images at the wrong time), but it might help to make >> it more stable, anyway. >> >> Is there an option for Straighten to do the renaming immediately? I >> imagine something like: > > Not in the macro language. > > You could specify again the selected image that needs to be renamed. > Assuming that the window has no extension, the straightened image name > should be predictable: the original name +"-1". > > Something like: > > { > selectWindow(rawStack); > roiManager("Select", currROIindex); > run("Straighten...", "line=20 process"); > selectWindow(originalName+"-1"); > rename(currOutputName); > } > > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by wirthvolker
On May 6, 2014, at 4:00 AM, Volker Wirth wrote:
> Hi, > my macro is using the command Edit>Selection>Straighten in a loop to > extract lines from several ROIs on a stack. The code looks like this: > > ... in a loop > { > selectWindow(rawStack); > roiManager("Select", currROIindex); > run("Straighten...", "line=20 process"); > rename(currOutputName); > } > > The problem with this is that sometimes the "rename"-command is > applied on the raw stack image instead of the straightened output > image. I cannot exclude that it is a problem with users' impatience > (and clicking on images at the wrong time), but it might help to make > it more stable, anyway. > > Is there an option for Straighten to do the renaming immediately? I > imagine something like: > > run("Straighten...", "line=20 output=whateverWeWantToCallTheOutput"); The Edit>Selection>Straighten command in the latest ImageJ daily build (1.49a16) adds a "Title:" field to its dialog so you can use something like run("Straighten...", "line=20 title=OutputTitle"); in a macro. -wayne > If there is no such option, could someone give me a hint to the place > where I can modify it myself (my Java skills are limited, but I would > give it a shot)? > > Thanks a lot! > > Best regards, > Volker -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks a lot!
Cheers, Volker 2014-05-07 17:17 GMT+02:00 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>: > On May 6, 2014, at 4:00 AM, Volker Wirth wrote: > >> Hi, >> my macro is using the command Edit>Selection>Straighten in a loop to >> extract lines from several ROIs on a stack. The code looks like this: >> >> ... in a loop >> { >> selectWindow(rawStack); >> roiManager("Select", currROIindex); >> run("Straighten...", "line=20 process"); >> rename(currOutputName); >> } >> >> The problem with this is that sometimes the "rename"-command is >> applied on the raw stack image instead of the straightened output >> image. I cannot exclude that it is a problem with users' impatience >> (and clicking on images at the wrong time), but it might help to make >> it more stable, anyway. >> >> Is there an option for Straighten to do the renaming immediately? I >> imagine something like: >> >> run("Straighten...", "line=20 output=whateverWeWantToCallTheOutput"); > > The Edit>Selection>Straighten command in the latest ImageJ daily build (1.49a16) adds a "Title:" field to its dialog so you can use something like > > run("Straighten...", "line=20 title=OutputTitle"); > > in a macro. > > -wayne > >> If there is no such option, could someone give me a hint to the place >> where I can modify it myself (my Java skills are limited, but I would >> give it a shot)? >> >> Thanks a lot! >> >> Best regards, >> Volker > > -- > 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 |