[ImageJ-devel] Problems running Versatile Wand in batch mode

Curtis Rueden ctrueden at wisc.edu
Thu May 28 13:42:45 CDT 2015


Hi Michael,

[Added the imagej-devel mailing list to CC, since this discussion may
interest other ImageJ plugin developers.]

> A quick search for PlugInFilterRunner in the ij1-patcher seems to
> indicate that the PlugInFilterRunner is not patched.

There is another project on top of ij1-patcher that does the bulk of the
actual patching for ImageJ2:

    https://github.com/imagej/imagej-legacy

And it does have logic that affects PlugInFilters:


https://github.com/imagej/imagej-legacy/blob/imagej-legacy-0.15.0/src/main/java/net/imagej/legacy/IJ1Helper.java#L591-L621

But at first glance, this is only used for the Script Editor's Run command
in case the Java code being run is a PlugInFilter:


https://github.com/imagej/imagej-legacy/blob/imagej-legacy-0.15.0/src/main/java/net/imagej/legacy/LegacyJavaRunner.java#L54

I apologize that I will not have time to dig into this issue more over the
summer -- but I'm insanely busy with work on the ImageJ Common data model
and ImageJ OPS and SCIFIO APIs, ImageJ-OMERO integration, IT infrastructure
resources and Fiji plugin maintenance, upcoming Madison ImageJ conference
planning, paper writing, etc.

Backwards compatibility with ImageJ1 is extremely challenging, especially
as things continue to evolve -- e.g., the major changes to how Java works
on OS X, and the breaking changes of Java 8. The best we can do right now
is to prioritize work that critically affects a large number of ImageJ
users, where no easy workaround is possible. In the case of compiling Java
plugins, there are several ways of doing it that do not require "Compile
and Run" and similar, so for now that's what I'll recommend. I hope that
plugin developers will make installation easy for their users by creating
ImageJ update sites, rather than shipping bare .java files.

Regards,
Curtis

P.S. When searching for code, you might try http://search.imagej.net/ and
click the GitHub button.


On Thu, May 21, 2015 at 3:01 PM, Michael Schmid <schmid at iap.tuwien.ac.at>
wrote:

> Hi Curtis,
>
> thank you!
> My fault was looking at the fiji, not the imagej repository.
>
> A quick search for PlugInFilterRunner in the ij1-patcher seems to indicate
> that the PlugInFilterRunner is not patched.
> I agree that the ij1-patcher is not easy too understand, and I did not
> find anything that looks like it could cause the problem of Avital.
>
> Michael
> ________________________________________________________________
> Michael Schmid                    email: schmid at iap.tuwien.ac.at
> Institut für Angewandte Physik, Technische Universität Wien
> Wiedner Hauptstr. 8-10/E134, A 1040 Wien, Austria
> Tel. +43 1 58801-13452 or -13453, Fax +43 1 58801 13499
> ________________________________________________________________
>
> On May 21, 2015, at 21:23, Curtis Rueden wrote:
>
> > Hi Michael,
> >
> > > [I must admit, I know nothing about how Fiji modifies ImageJ; in a
> > > quick search I did not find anything on fiji.sc or the github]
> >
> > The relevant project is:
> > https://github.com/imagej/ij1-patcher/
> >
> > But digging into it is a substantial endeavor.
> >
> > Regards,
> > Curtis
> >
> > On Thu, May 21, 2015 at 1:35 PM, Michael Schmid <schmid at iap.tuwien.ac.at>
> wrote:
> > Hi Wayne,
> >
> > thank you for finding this out!
> >
> > It must be a strange Fiji bug! When called like this, the Versatile Wand
> behaves like an ordinary ExtendedPlugInFilter. It uses the ImagePlus passed
> to the showDialog method, which comes directly from
> WindowManager.getCurrentImage() executed by the PlugInFilterRunner.
> >
> > [I must admit, I know nothing about how Fiji modifies ImageJ; in a quick
> search I did not find anything on fiji.sc or the github]
> >
> > Best regards,
> >
> > Michael
> > ________________________________________________________________
> > Michael Schmid                    email: schmid at iap.tuwien.ac.at
> > Institut für Angewandte Physik, Technische Universität Wien
> > Wiedner Hauptstr. 8-10/E134, A 1040 Wien, Austria
> > Tel. +43 1 58801-13452 or -13453, Fax +43 1 58801 13499
> > ________________________________________________________________
> >
> > On May 21, 2015, at 18:54, Rasband, Wayne (NIH/NIMH) [E] wrote:
> >
> > > Dear Avital,
> > >
> > > This is a Fiji issue. You should be able to work around it by deleting
> the file “Versatile_Wand.java" (location is shown in Console error
> messages), copying Versatile_Wand.class into the Fiji.app/plugins folder,
> and restarting Fiji. I have attached a copy of Versatile_Wand.class or you
> can download it from the Versatile Wand webpage.
> > >
> > > Best regards,
> > >
> > > -wayne
> > >
> > >
> > >> On May 21, 2015, at 3:03 AM, Avital Steinberg <
> steinbergavital at GMAIL.COM> wrote:
> > >>
> > >> Hi Wayne,
> > >> When I run your code (in which you create 2 images), I get an error
> message - ROI manager, "the active image does not have a selection". Also,
> it didn't form an ROI - the ROI manager is empty.
> > >>
> > >> There is also a console window that shows red warnings - I've had it
> for a long time, ever since I upgraded imageJ. This console shows up both
> on my mac and also on my Linux machine. I don't remember when it first
> showed up. It didn't bother me, since everything was working then.
> > >>
> > >> Are the attached warning messages related to the problem?
> > >>
> > >> Thanks,
> > >> Avital
> > >>
> > >> On Wed, May 20, 2015 at 6:42 PM, Rasband, Wayne (NIH/NIMH) [E] <
> rasbandw at mail.nih.gov> wrote:
> > >> Dear Avital,
> > >>
> > >> The following version of your test macro creates a selection in the
> saved image.
> > >>
> > >> Best regards,
> > >>
> > >> -wayne
> > >>
> > >>   setBatchMode(true);
> > >>   newImage("Untitled", "8-bit ramp", 500, 500, 1);
> > >>   image1ID = getImageID();
> > >>   newImage("Untitled", "8-bit ramp", 500, 500, 1);
> > >>   image2ID = getImageID();
> > >>   selectImage(image1ID);
> > >>   if(isActive(image1ID))
> > >>      print("The first image is active");
> > >>   else
> > >>      print("The first image isn't active");
> > >>   if (isActive(image2ID))
> > >>      print("The second image is active");
> > >>   else
> > >>      print("The second image isn't active");
> > >>   run("Gaussian Blur...", "sigma=2");
> > >>   run("Set Scale...", "distance=0");
> > >>   run("Versatile Wand", "value=60 color=-100 gradient=10
> connectedness=8-connected x=2 y=2 do");
> > >>   run("ROI Manager...");
> > >>   roiManager("Add");
> > >>   saveAs("tiff", getDirectory("home")+"test.tif”)
> > >>
> > >>
> > >>> On May 20, 2015, at 5:35 AM, Avital Steinberg <
> steinbergavital at GMAIL.COM> wrote:
> > >>>
> > >>> Thanks, but the problem isn't solved. Can anyone else check if
> they're
> > >>> having similar problems running this code? Does this code create a
> > >>> selection in the saved image also for you?
> > >>>
> > >>> setBatchMode(true);
> > >>> open();
> > >>> image1ID = getImageID();
> > >>> open();
> > >>> image2ID = getImageID();
> > >>> selectImage(image1ID);
> > >>> if(isActive(image1ID)){
> > >>>   print("The first image is active");
> > >>> }
> > >>> else {
> > >>>   print("The first image isn't active");
> > >>> }
> > >>>
> > >>> if(isActive(image2ID)){
> > >>>   print("The second image is active");
> > >>> }
> > >>> else {
> > >>>   print("The second image isn't active");
> > >>> }
> > >>> makePoint(1854, 726);
> > >>> run("Gaussian Blur...", "sigma=2");
> > >>> run("Set Scale...", "distance=0");
> > >>> run("Versatile Wand", "value=60 color=-100 gradient=10
> > >>> connectedness=8-connected x=2 y=2 do");
> > >>> run("ROI Manager...");
> > >>> roiManager("Add");
> > >>> saveAs("Tiff");
> > >>>
> > >>>
> > >>> I am using ImageJ 1.49t7, which came with Java 1.6.0_065 (64 bit). I
> am
> > >>> running it on a mac, but I had the same problems also on a Linux
> machine
> > >>> with ImageJ 1.49s and java 1.6.0_24.
> > >>>
> > >>> MakePoint isn't needed, but it's besides the point, since the bug has
> > >>> nothing to do with it and exists also without it.
> > >>>
> > >>> Thanks,
> > >>> Avital
> > >>>
> > >>> On Tue, May 19, 2015 at 6:25 PM, Michael Schmid <
> schmid at iap.tuwien.ac.at>
> > >>> wrote:
> > >>>
> > >>>> Hi Avital,
> > >>>>
> > >>>> sorry, I can't reproduce the problem. Your macro works; it blurs
> the first
> > >>>> image and does the wand selection on it. I also get the selection
> in the
> > >>>> ROI Manager.
> > >>>> I tried with both 8-bit grayscale as well as RGB images.
> > >>>>
> > >>>> What I don't understand is the "makePoint(1854, 726)" command;
> Gaussian
> > >>>> Blur does not care about point selections. So it blurs the whole
> image.
> > >>>>
> > >>>> I am using ImageJ 1.49u4, Java 1.6.0_45.
> > >>>>
> > >>>> Michael
> > >>>> ________________________________________________________________
> > >>>> On May 19, 2015, at 17:01, Avital Steinberg wrote:
> > >>>>
> > >>>>> Hi,
> > >>>>> I'm trying to use Versatile Wand in batch mode. The following
> macro works
> > >>>>> well in batch mode:
> > >>>>>
> > >>>>> setBatchMode(true);
> > >>>>> open();
> > >>>>> makePoint(1854, 726);
> > >>>>> run("Gaussian Blur...", "sigma=2");
> > >>>>> run("Set Scale...", "distance=0");
> > >>>>> run("Versatile Wand", "value=60 color=-100 gradient=10
> > >>>>> connectedness=8-connected x=2 y=2 do");
> > >>>>> run("ROI Manager...");
> > >>>>> roiManager("Add");
> > >>>>> saveAs("Tiff");
> > >>>>>
> > >>>>> However - when I try to work with multiple images, select the
> active
> > >>>> image
> > >>>>> and then use the Versatile Wand, no selection is created:
> > >>>>>
> > >>>>> setBatchMode(true);
> > >>>>> open();
> > >>>>> image1ID = getImageID();
> > >>>>> open();
> > >>>>> image2ID = getImageID();
> > >>>>> selectImage(image1ID);
> > >>>>> if(isActive(image1ID)){
> > >>>>>  print("The first image is active");
> > >>>>> }
> > >>>>> else {
> > >>>>>  print("The first image isn't active");
> > >>>>> }
> > >>>>>
> > >>>>> if(isActive(image2ID)){
> > >>>>>  print("The second image is active");
> > >>>>> }
> > >>>>> else {
> > >>>>>  print("The second image isn't active");
> > >>>>> }
> > >>>>> makePoint(1854, 726);
> > >>>>> run("Gaussian Blur...", "sigma=2");
> > >>>>> run("Set Scale...", "distance=0");
> > >>>>> run("Versatile Wand", "value=60 color=-100 gradient=10
> > >>>> connectedness=8-connected x=2 y=2 do");
> > >>>>> run("ROI Manager...");
> > >>>>> roiManager("Add");
> > >>>>> saveAs("Tiff");
> > >>>>>
> > >>>>> Why wouldn't this script work? Only one image is active.
> > >>>>>
> > >>>>> Thank you,
> > >>>>> Avital
> > >>>>
> > >>>> --
> > >>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >>>>
> > >>>
> > >>> --
> > >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >>
> > >>
> > >> <OutputWindowsWaynesCode.jpg><ConsoleWindowRedWarnings.jpg>
> > >
> > > <Versatile_Wand.class>
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20150528/e73a71c5/attachment-0001.html>


More information about the ImageJ-devel mailing list