Ilastik error on ilastik4ij-1.7.3

Hello,

I’m trying to run ilastik plugin from fiji using jython.

When I’m using ilastik4ij-1.7.2 it works OK !

But when I’m using ilastik4ij-1.7.3 I get this error :

"inputimage" is required but unset

I’m trying to run the Pixel Classification Prediction

IJ.run("Run Pixel Classification Prediction", "projectfilename=["+IlastikClassifierPath+"] inputimage=["+imageName+"] pixelclassificationtype=Probabilities")

Best Regards

Hi @Ebi,

Have you kept anything else constant in your setup? If so…

I have never tried running a macro from Jython. I’ve checked the changes from 1.7.2 to 1.7.3 and what I can see there is that @NicoKiaru and @imagejan contributed a string to dataset converter. This is the only thing I can see that should have an effect on interpretation of that parameter. Have you made sure that the srtring imageName holds a dataset name?

Cheers

Hi @Ebi,

What does your imageName refer to ? Is it an already opened image ? Is it a file ? Do you think you can give us a (minimal) complete recipe to reproduce the error ?

Best,

Nicolas

I can reproduce the issue with the following script (it’s Groovy, but it equally works with any scripting language):

#@ Dataset (persist=false) inputImage
#@ File (persist=false) projectFileName
#@ String (persist=false) pixelClassificationType

println inputImage.getName()
println projectFileName.getName()
println pixelClassificationType

Let’s say I saved this in my Fiji installation under Fiji.app/scripts/Testing/Ilastik_Bug.groovy, so it appears in the menu at Testing > Ilastik Bug.

Without ilastik4ij-1.7.3.jar on the classpath, I can run another script calling the above like this:

import ij.IJ

IJ.run("Ilastik Bug", "inputimage=/Users/eglinger/temp/boats.png projectfilename=. pixelclassificationtype=tou")

Note that I try to load a file from disk here, which works, so the command prints the image name (boats.png).


Now, when I put ilastik4ij-1.7.3.jar in my Fiji installation, I see the same error as reported by @Ebi.

The reason is that the newly introduced StringToDatasetConverter too eagerly tries to convert the input string into an already opened image with that name, so if there’s no image open already, it throws ‘inputImage’ is required but unset.

The solution is to add a canConvert() method to that converter, such that it only accepts conversion requests for which an open image actually exists. This has been discussed in this issue already:

From the “to do”-list posted there by @NicoKiaru:

  • Improve the (OpenedImage)String => Dataset converter to only support a conversion when the input string matches an opened image.

Alright: let’s see that we get this into imagej-legacy quickly and release it, so that this converter can leave the ilastik4ij repository where it doesn’t belong : )

2 Likes

Hi @imagejan,

thank you so much for the detailed answer!!

Just to clarify - the current workaround would be to load the image first (using open or whatever import plugin…), and only then calling the ilastik plugin with the appropriate dataset name (so probably a good idea to rename after loading…).