Using labelled segmentation image for object classification

I am using the “Object Classification [Inputs: Raw Data, Segmentation]” pipeline, i.e., I prepare my own segmentation image as the input.

My question is whether the segmentation input can be a label image (each object has its own integer identifier, with image type as uint16 to accommodate > 255 objects), instead of a binary image.

The reason is if I save my own segmentation results into a binary image, connect components will then be incorrectly treated as one object during the object classification workflow.

Thanks!

Hi @Mark,

yes, you can use such an image and object identities will be respected. uint32 will also work. It’s only important that the background is 0.

Cheers
Dominik

Thank you for the quick reply! It indeed works, as I see an example where connecting cells were assigned different class labels. Awesome!

1 Like

Hello! Following the advice in this thread, I created a new “Object Classification [Inputs: Raw Data, Segmentation]” pipeline in Windows ilastik (version 1.3.3post3) and prepared a 32-bit (numpy.uint32) labelled segmentation image that identified nuclei in my raw image. I then attempted to load the segmentation image into the Segmentation Image tab of the Input Data section in my pipeline, but I received a “File selection error” popup message with the following contradictory description:

“OpLabelVigra: dtype ‘<class ‘numpy.uint32’>’ not supported with method ‘vigra’. Supported types: [<class ‘numpy.uint8’>, <class ‘numpy.uint32’>, <class ‘numpy.float32’>]”

Is this a bug in Windows ilastik?

Hi @Frederick,

welcome to the image.sc forum!

hmmm, that looks really weird and I am eager to reproduce it. Could you please give us a little more details on the exact steps you’ve taken to generate the data?

Hope we can resolve this quickly!
Cheers
Dominik

Hi Dominik

Thanks for troubleshooting with me! Our team’s code generates a numpy.uint32 labelled mask for objects discovered in a raw input image. The labelled mask has background pixels with intensity 0. The first detected object has all intensity 1 pixels, the second object has all intensity 2 pixels, etc. Loading this image into the Segmentation Image tab (with or without a corresponding Raw Data image) causes the aforementioned error.

I would be happy to send you an example labelled mask image, if this forum has some method to upload one. My company forbids the use of file sharing sites like DropBox or Google Drive unfortunately.

Hi Dominik

I was giving permission to use DropBox. Here is a link (https://www.dropbox.com/sh/w0bqvkcevx1mhg0/AAAcktlMq01SHD_vuxfWhr8ua?dl=0) to a folder containing two files. One (labelled_nuclei.tiff) is an example labelled nuclei mask file that will produce the aforementioned error. The second (error.png) is a screenshot of the error that appears when trying to add the labelled nuclei mask to the project. Hope that helps with the troubleshooting! Thanks again for your help!

1 Like

Hi @Frederick,

thank you very much for providing the data. Interestingly, I could open it just fine on linux, but not on windows!

In the meantime you could use the ilastik fiji import/export plugin to convert the data to .h5 (hdf5, the file format ilastik works best with). I have confirmed that it can be loaded into fiji then.

Nevertheless, we’ll be looking for a fix for that problem.

Best
Dominik