A way to disable macro recording "selectWindow("Title")" for output images?

I have a command

@Plugin(type = Command.class)
public class StetsonHarrison extends ContextCommand {
    @Parameter (type = ItemIO.OUTPUT)
    private List<ImgPlus> outputImages;

    @Override
    public void run() { 
        outputImages = doScience();
    }
}

now if I have macro recording running it records a bunch of selectWindow("Output image n") lines, one for each output image. Is there any way to disable this? I tried calling IJ1Helper.finishRecording() before the output images are assigned, but that didn’t help (because the images get displayed after the command proper has exited…?)

Hey @rimadoma,

not sure if it will work for your purpose as well, but in clij turn the recorder off for every individual command by calling:

Recorder.setCommand(null);

But this also may turn off the recording of the command itself (I’m not so exprienced how this works with IJ2)… But maybe it works if you call it at the right moment…

Cheers,
Robert

1 Like

Thanks @haesleinhuepf,

I tried this, but it only turned off the recording of my command, i.e. the “selectWindow” rows are still there. But maybe in this particular case the output images don’t have to be output parameters. Then I can explicitly not show them if IJ1Helper.isMacro or something.

1 Like

Outputs of #scijava commands/modules are post-processed by DisplayPostprocessor to display them if possible:

I suppose that something in the displayService.createDisplay(), in combination with the MacroRecorderPostprocessor, might lead to those selectWindow calls being recorded.


Here is an issue where more granular setup of pre- and post-processing was discussed:

1 Like