imagej / imagej-legacy

ImageJ+ImageJ2 compatibility layer
https://imagej.net/libs/imagej-legacy
BSD 2-Clause "Simplified" License
16 stars 25 forks source link

IJ2 commands returning Dataset/Img don't work with setBatchMode(true) in macros #215

Closed imagejan closed 2 years ago

imagejan commented 5 years ago

Consider the following macro, using the File > Import > Image... command:

#@ File input
setBatchMode(true);
run("Image... ", "source=[" + input +"] crop=false autoscale=true computeminmax=false x=0 y=0 w=0 h=0 groupfiles=false mode=Auto range=0");
run("Z Project...", "projection=[Max Intensity] all");
setBatchMode("show");

This will throw and error:

There are no images open in line 4

Changing line 2 to setBatchMode(false); makes it work as expected.

I guess the issue is that Dataset objects are not (or too lazily) synced with IJ1 ImagePluses.

hinerm commented 2 years ago

Note that despite the fix this won't work running headlessly currently.