Login  Register

Re: command default settings in a macro

Posted by Fco. Javier Diez Guerra on Sep 23, 2019; 10:48am
URL: http://imagej.273.s1.nabble.com/command-default-settings-in-a-macro-tp5022452p5022456.html

Dear Stein,

I understand, many thanks for the clever settlement.

I figure then that the macro can run a first Rotate command with the
desired settings and the angle fixed to 0 (this should do nothing) and a
second Rotate command without parameters, to allow interaction:

run("Rotate... ", "angle=0 grid=20 interpolation=Bicubic");
run("Rotate... ");

In this way, I'd only need to activate preview and find the right angle.

Javier


El 23/09/2019 a las 10:53, Stein Rørvik escribió:

> As you already found out, you must either call the command with parameters which executes it right away, or call it without parameters which opens the dialog and allows you to do the rotation in an interactive mode. Subsequent calls will remember the chosen interpolation and grid settings. So just use run("Rotate... "); in your macro and the dialog should appear and allow you to adjust the rotation as needed. When I tested this, all settings except the "Preview" checkbox was remembered from call to call. A restart of ImageJ reverts to the default settings. A dummy call with the parameters set will result in new "default" values being set for your session.
>
> So you can do something like this pseudocode:
>
> {open sample image}
> run("Rotate... ", "angle=0.4 grid=20 interpolation=Bicubic");
> close; //the default values for Rotate... are now as specified above
> do {
> {open image to be rotated}
> run("Rotate... "); //click the preview checkbox and adjust rotation
> } until (finished);
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of F Javier Diez Guerra
> Sent: 22. september 2019 23:22
> To: [hidden email]
> Subject: Re: command default settings in a macro
>
> Dear Gabriel,
>
> Thanks for your input.
>
> I have already tried what you suggest:
>
> run("Rotate... ", "angle=0.4 grid=20 interpolation=Bicubic");
>
> However, in this case, the command is executed right away.
>
> On the other hand, when the macro
>
> run("Rotate... ");
>
> is run, the Rotate command is not executed. The macro just opens a window that lets you modify the settings before excuting the command.
>
> I have a set with a lot of images to be rotated. Each one needs a different angle of rotation, but the same grid size and interpolation settings. What I am trying to avoid is to change the grid size and interpolation settings every time I open a new image, before finding the right rotation angle and running the Rotate command. The rotation angle needs to be manually adjusted for each individual image.
>
> Best
>
> Javier
>
>
> El 22/09/2019 a las 22:33, Gabriel Landini escribió:
>> On Sunday, 22 September 2019 19:18:30 BST [hidden email] wrote:
>>> I would like to know how default settings for a given command can be
>>> changed within a macro.
>> Hi, run the Macro Recorder before calling the command, and it will show you
>> how you call all the parameters in the command dialog.
>> 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

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