# Fixing labelmap based on CT voxel intensity ranges

**URL:** <https://discourse.slicer.org/t/fixing-labelmap-based-on-ct-voxel-intensity-ranges/11836>\
**Category:** Support\
**Created:** [June 2, 2020, 7:20pm UTC](https://discourse.slicer.org/t/fixing-labelmap-based-on-ct-voxel-intensity-ranges/11836 "2020-06-02T19:20:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_C](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vincent_c/32/5759_2.png) [@Vincent\_C](https://discourse.slicer.org/u/Vincent_C)\
**Post date:** [June 2, 2020, 7:20pm UTC](https://discourse.slicer.org/t/fixing-labelmap-based-on-ct-voxel-intensity-ranges/11836/1 "2020-06-02T19:20:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [June 2, 2020, 9:19pm UTC](https://discourse.slicer.org/t/fixing-labelmap-based-on-ct-voxel-intensity-ranges/11836/2 "2020-06-02T21:19:15Z")

</div>

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](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Accessing_Volume_data_as_numpy_array)

```auto
a[:] = numpy.clip(a, -29, 150)

```
