New segment for every colour

Hi there

I have a 16bit raw image stack of a segmentation ‘so it doesn’t have a crazy amount of colors in the image itself’. Is there a way in slicer to generate a segment for every existing color in the image using the segment editor? Hopefully slicer can handle a fairly large number of segments. Sorry if it sounds confusing

Any help would be appreciated

It sounds like you have a labelmap volume (you have discrete values in the volume, each value corresponds to a certain structure). You can follow these instructions to load this image and import to segmentation:

1 Like

Thank you so much for the quick reply, I won’t be able to try this until tomorrow. Just one question in regards to your answer, will I be able to re-sample while using the method in the other thread

Yes, you can crop and resample labelmap volumes the same way as scalar volumes, just make sure to use nearest neighbor interpolator if you want to preserve original voxel values at the boundaries.

1 Like

After trying this method with about 1/8th of the dataset, which is a 700mb nrrd file. It did work but took a very long time to compute and with the labels it uses about 98percent of my 16gigs of ram. I will try some other software packages but I feel like they will also be too resource heavy

Currently, you can can probably edit up to about 30-50 segments at a time and move out other segments to another segmentation or labelmap. We are improving the segment editor to better support some neurosegmentation workflows which may involve a few hundred segments.

What kind of data do you work with? How many segments do you have? What is the volume size?

It is a micro-ct of a mammal and has I estimate it will have north of 200 segments if I was to load in the full dataset. Unfortunately I am interested in preserving as much detail as possible so reducing the quality isn’t really an option. Looking forward to future updates to the segment editor.

What is the volume size?

Sorry I am not sure how to check that. However today I did try to do the same with the 1/8th data set using both Itk-snap and Mimics. I wasn’t able to find where to import a labelmap for mimics ‘it probably doesn’t have this functionality’, but with itk-snap I just clicked open segmentation and opened the nrrd and it imported and created the hundred or so masks within a few seconds, and also had almost no effect on the memory usage (to compare, slicer took about 5 minutes to generate the segments and used 98percent ram once they were imported). Itk also had a really nice export all segments into single vtk scene which didn’t create a file size too large. However the downside with Itk-snap is the mesh it created was not as nice and had holes that were larger than the ones in slicer. Since I am interested in mesh quality, I am leaning more towards slicer, however memory usage and calculation speed is an issue with lots of labels

If you keep your mouse cursor above the CT in the Data module, the tooltip will contain the image size. You can also check these (and more) details in the Volumes module.

ITK-SNAP uses the legacy labelmap volume concept, whereas Slicer uses the more advanced PolySeg segmentations concept that allows overlapping segments, automatic conversions, etc. (see this paper).

Yes, segment editor is much more capable than ITK-snap but currently it uses an separate labelmap for each segment, which may require significantly more memory, especially when you have many segments.

We’ll make editing of hundreds of segments more efficient within a couple of months (allow sharing memory between segments, add filtering/searching in the segment list, etc.). Until then, you can edit up to 30-50 segments at a time and merge them into a single labelmap at the end (or upgrade your computer, mainly by add a lot of RAM).