Fixing labelmap based on CT voxel intensity ranges

Hi all,

I am wondering if there is a function to fix labels that are “out-of-range” based on CT voxel intensity ranges or HU ranges. For example, for all label values equal to 1 below -29 and above 150 intensity, I want to change it to “0” as a fix for over-segmentation. I was exploring the Simple Filters modules but could not find anything to achieve this. Is there a function in Slicer specifically do this for labelmap volumes? Or must this be performed on segmentation nodes in Segment Editor and converted to a labelmap?

Thanks

You can do pretty much anything by accessing the volume as a numpy array. Maybe you want something like this:

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Accessing_Volume_data_as_numpy_array

a[:] = numpy.clip(a, -29, 150)
1 Like