Launch Ilastik GUI from python with a specific image

Hello everyone,

I would like to launch Ilastik GUI in a python script (not in headless mode) with a specific workflow.
I have an image already loaded in the script as a numpy array.
The idea is to open the Ilastik interface with a workflow alreay specified and an image already loaded.
Ideally the script would be

myWorkflow = Pixel classification (for example)
myImage = numpy.array(…)
ilastik.main(myWorkflow, myImage)

If this is not possible from a numpy array, I can also save the image (for example in a tif file) then lauch the script with something like

ilastik.main(myWorkflow, myPathToImage.tif)

Is there a way to do this ?

Thanks in advance for your answers !

Warren

Hey @Warren,

this is a very good question and a very good use-case, indeed. However, right now this is not possible (or you’d have to jump a lot of hoops). We are in the process of changing that, but this can still take a while.

As an alternative you could try to populate .ilp (ilastik project files) configured with the appropriate image and then start ilastik via run_ilastik.sh --project=yourproject.ilp. The ilp files are just h5 files that you can open from python with e.g. h5py.

Hi @k-dominik,

Indeed this is a good alternative solution.
Thank you for the quick reply !