Run ilastik headless mode with bash in KNIME?

Hi, all,
I’m running ilastik with headless mode. Here is the cmd I used.

	integrated_data=`find $d -name "BF_*_integrated.tif"`
	mask_data=`find $d -name "BF_*_clean_watersheded.tif"`
	echo $integrated_data
	echo $mask_data
	#python $ILASTIK_PATH --headless \
	bash $ILASTIK_PATH --headless --readonly READONLY\
	--project=$PROJECT \
	--raw_data $integrated_data \
	--segmentation_image $mask_data \
	--output_filename_format {dataset_dir}/{nickname}_label.h5 \
	--export_source "Object Predictions" \
	--export_dtype "uint8" \
	--output_internal_path "label"

I also want to use KNIME to create a user-friendly GUI for non-developer usage.
But in the example you provided, I can not find where to specify my local ilastik path (it’s by default 1.1.8).
Nor can I use the wildcard image searching like I use in the bash script.
Is it possible to fill this gap ?

It’s in the KNIME preferences (File>Preferences)

Also for Ilastik in KNIME you have a single node (Pixel Classification) that takes as input a column of images (as opened by the image reader node) and an ilastik project (ilp) containing the trained classifier.
So no need for headless command line style.

You can achieve the same result than the whild card pattern with the list file node followed by image reader (table) node.

Thank you ! That is what I’m looking for!
It seems working now, but what about these options ?

The single-node pixel classification can not specify these options, is it ?
BTW, I just realized that, pix classification is the only available option for instance ? No object classification ?

Most parameters are read from the Ilastik project file (.ilp) so maybe if you configure the project with the bit type for export it will be taken into account in KNIME. But indeed the node itself has limited options.

I think you are right, you will get some images as output of the Ilastik node, I am not sure it can do object classes to yet.
You could try the external tool node instead to call Ilastik via the command line.
In this case KNIME stores the input table to a temporary file that is passed as argument to the program in the command line and Ilastik is also supposed to return a table like csv that KNIME will read back.
Not very straightforward…

Maybe the @ilastik_team can tell more…

Hi @BioinfoTongLI,

Indeed, the current version of the integration only supports pixel classification.

We try to be smart about e.g. --export_dtype "uint8", so that a user doesn’t have to provide this. Also, output_filename_format is superfluous since images are written into a temporary folder to be picked up by KNIME after execution of the project.

We will be working on improving the situation together with @ilastik_team some time this fall. Let’s see where we can get :slight_smile: