ilastik / ilastik4ij

ImageJ plugins to run ilastik workflows
MIT License
22 stars 17 forks source link

Pixel Classification: macro does not record values when segmentation output is selected #46

Closed k-dominik closed 4 years ago

k-dominik commented 4 years ago

Yah, a weird one... When running pixel classification and selecting probabilities as an output the macro recorder correctly records all parameters:

run("Run Pixel Classification Prediction", "projectfilename=/xxxxx/2dcells_pc.ilp inputimage=2d_cells_apoptotic_1channel.png pixelclassificationtype=Probabilities");

When segmentations are selected it will only record the following:

run("Run Pixel Classification Prediction");

I would expect to always see all parameters recorded. Also from the code it is extremely non-obvious how this can happen...

wolny commented 4 years ago

Hey @k-dominik,

the only difference in the execution flow between selecting 'Probabilities' vs 'Segmentation' as an output is that selecting segmentation will trigger another command which applies a given LUT to the segmentation output, see: https://github.com/ilastik/ilastik4ij/blob/master/src/main/java/org/ilastik/ilastik4ij/ui/DisplayUtils.java#L28. This executes another ImageJ command via IJ.run (see: https://github.com/ilastik/ilastik4ij/blob/master/src/main/java/org/ilastik/ilastik4ij/ui/DisplayUtils.java#L14) and somehow causes the macro recording to skip the necessary invocation parameters. When I commend the if-statement, the macro recording works as expected:

run("Run Pixel Classification Prediction", "projectfilename=xxx/pixel_class_2d_cells_apoptotic.ilp inputimage=2d_cells_apoptotic.tif pixelclassificationtype=Segmentation");

As a quick fix I'd remove the if-statement and always left it to the end user to apply the LUT if needed.