Hi José,

when you save a multilabel segmentation from MITK, make sure to select the MITK 
Multilabel Image writer. This is the default file writer when you right-click 
on a multilabel segmentation and chose Save as... The segmentation is then 
saved as a NRRD file with additional header data and an additional image 
dimension that maps to the layer feature of our multilabel segmentation images. 
Loading such images in MITK should automatically default to the corresponding 
file reader as all file readers are asked if they can read this file and the 
multilabel image file reader will report back that it can and it also reports a 
higher confidence level then the plain NRRD reader.


Loading other file formats directly as multilabel segmentation out-of-the-box 
is not possible to my knowledge. Classic segmentations / binary images were 
read as their actual file type but after loading MITK checked pixel by pixel if 
there were only two different pixel values and then marked the image as binary 
image which boils down to a single property that can be checked/unchecked by a 
user in the Properties View, too.


If you saved your images as MITK Multilabel Image and they are still read in as 
plain NRRD images in your application, please check if the Multilabel Image 
reader is available (for example by placing a break point in its CanRead() 
method. If it is available but not selected for some other reason by the 
mitk::IOUtil::Load() method, it also has an overloaded signature where you can 
enforce a certain file reader as far as I know.


If you have another file format and writing a preprocessing/converter app for 
your files is not an option, you can consider to write your own file reader, 
deriving from the file reader that is currently chosen by MITK and implement a 
little business logic to decide if your file reader should have precedence and 
then assemble an mitk::LabelSetImage directly. You can look into the Multilabel 
Image file reader for inspiration.


Best,

Stefan



________________________________
Von: José Alonso Solís Lemus <alonso.jasl+...@gmail.com>
Gesendet: Montag, 23. Mai 2022 13:59
An: mitk-users@lists.sourceforge.net
Betreff: [mitk-users] MITK load multilabel segmentation programmatically

Hello,
My group has an application built as an MITK_EXTENSION 
(www.cemrg.com<http://www.cemrg.com>).

When I load a mulilabel segmentation from MITK, it shows as a grayscale image. 
If I want to edit the tags, I need to right click on the multilabel 
segmentation and click on Convert to segmentation.

I would like to load it programmatically, and have it be recognised 
automatically as a multilabel segmentation. Is there a way to do this? 
Normally, with single label segmentation, MITK is able to recognise it 
automatically, but I have not found how to do it for multilabel segmentations. 
Any help would be greatly appreciated.

Best,
José

_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to