Ilastik pixel classification in two channel images

Hi everybody,

I have two channel images and I am using Ilastik for pixel classification. At the moment I have a model trained on Channel 1 and another model trained on Channel 2, but the problem is then to re-merge the two outputs.

Does anyone know how to do this in Ilastik itself?

Or can you load a two channel image and use two different models to classify and export a two channel Simple Segmentation image (one for each channel).

Many thanks for your help!

All the best,


Hello @DavidG,

there is no way to combine two classifiers, that operate on different channels in ilastik. ilastik will always work on all channels that you have in your image (I guess that’s why you’ve split your project). It is not possible to get a two channel segmentation image.

For combining the results, one idea, would be to export the probability maps separately and then combine them, in Fiji maybe, or Python, matlab, whatever you are most comfortable with. The “how” there might depend on what you are trying to classify. With the probability maps (in their “natural” state, those are multi channel images (as many channels as there are classes) with the pixel values being float numbers between 0...1, indicating the “probability” that the pixel belongs to the respective class. You could e.g. threshold the channel(s) you’re interested in at 0.5 and then combine the resulting binary images (of course there might be conflicting pixels, so you might have to decide how to deal with those, or maybe you’re not interested in combining them). In Fiji/Imagej you could use our plugin in a macro to automate the whole thing - loading the image, splitting channels, running the respective ilastik predictions, and thresholding. But of course this is an involved worklfow.


1 Like

Thank you very much for your answer @k-dominik !

Regarding the combining of results, I export a simple segmentation at the moment, and I have put the following in the output file info:


It then creates a new folder and names the result ‘simple segmentation’.

This is where my second problem comes: the folder has the name of the image, but the result is inside, and named only ‘simple segmentation’

That makes a FIJI macro more complicated as I’m struggling to extract the image name.

I wondered if there is a way to export the simple segmentation result while keeping the original image name please?
For example: ‘Image1_channel1_simple_segmentation’

Many thanks for your help!



Hi @DavidG

if you are willing to try a commercial alternative (maybe some around has ZEN blue anyway) you can get a trial version of ZEN Intellesis + ZEN Image Analysis.

There one can train a pixel classifier on multiple channels (use features from all channels to classify a pixel) and also use it inside the image analysis. Maybe that can help with your workflow.

For more information have a look here:

Sebi (from ZEISS)

regarding the naming, I think if you put something like


then you’d get almost what you want. (there will be a space in Simple Segmentation.

if you know that you will export the simple segmentation anyway, then you could also set the output to something like


if you want, you could also paste your macro here. While I am far from a macro expert, there are so many this wonderful community that could be drawn in :slight_smile:

How many classes do you have in each project (I’m just asking because you are exporting the simple segmentation. With two classes this is equivalent to a threshold at 0.5, but with more you might end up with pixels highlighted that would not show up with a 0.5 threshold on a particular channel. The simple segmenation will always favor the class/channel of the highest probability. With three classes you might end up with probabilities like [0.4, 0.3, 0.3] and it will “take” the first class with 0.4…)