http://imagej.273.s1.nabble.com/Rename-output-from-Straighten-as-a-function-argument-tp5007587p5007591.html
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).
thank you for the quick reply, I will implement it like that.
> 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