# The voxel value is showing 'invalid'

**URL:** <https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170>\
**Category:** Support\
**Created:** [February 25, 2022, 6:12am UTC](https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170 "2022-02-25T06:12:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![parvaneh.a](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/parvaneh.a/32/14462_2.png) [@parvaneh.a](https://discourse.slicer.org/u/parvaneh.a)\
**Post date:** [February 25, 2022, 6:12am UTC](https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170/1 "2022-02-25T06:12:42Z")

</div>

I have one image and one segmentation. When I load the image as volume and the segmentation as segmentation everything seems fine with both. There is no NAN voxel value in any of image or segmentation. I use the code below to mask the image with the segment. However, after that when i load the masked image I saw it as below in slicer in which the voxel value shows ‘invalid’ in the left down. why this happening and what does it mean?

```
inputpath='/home/ImgAve_RIPV_Aff.nii.gz'
newimg_path='/home/SegAve_RIPV_Aff_label_0.2.nii.gz'

img = sitk.ReadImage(inputpath)
img_arr=sitk.GetArrayFromImage(img)

seg = sitk.ReadImage(newimg_path)
seg_arr=sitk.GetArrayFromImage(seg)

img_arr[seg_arr==0]=0

newimg11 = sitk.GetImageFromArray(img_arr)

img_ave1 = copyImageParameters(newimg11,img, inputpath)
sitk.WriteImage(img_ave1,'/home/mmm.nii.gz')

```

 ![unnamed](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/4/e4e3587ade2b61843bc3b433217aefe247a114d7.jpeg)

---

<div class="post-metadata">

**Author:** ![parvaneh.a](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/parvaneh.a/32/14462_2.png) [@parvaneh.a](https://discourse.slicer.org/u/parvaneh.a)\
**Post date:** [February 25, 2022, 6:36am UTC](https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170/2 "2022-02-25T06:36:54Z")

</div>

I also checked that there is no NAN in none of the segment and image. The image is an average image of 50 cases.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 25, 2022, 7:03am UTC](https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170/3 "2022-02-25T07:03:36Z")

</div>

There is nothing wrong. `invalid` color name just means that the label value `1332` has no color name specified in the chosen color table.

---

<div class="post-metadata">

**Author:** ![parvaneh.a](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/parvaneh.a/32/14462_2.png) [@parvaneh.a](https://discourse.slicer.org/u/parvaneh.a)\
**Post date:** [February 25, 2022, 12:24pm UTC](https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170/4 "2022-02-25T12:24:54Z")

</div>

Thank you for your answer but the image which is called “ImgAve\_RIPV\_Aff\_label\_0.2” is not a label map to have a color map. It is average of 50 CT images with voxel values 0 to more than 1332. so, it is not like a label map with only one voxel value of 1332. It was a CT image which was masked by a segment with the python code and after being masked, ‘invalid’ appeared in the resultant ct masked image. I would be very grateful if you could help in clarifying.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 25, 2022, 2:24pm UTC](https://discourse.slicer.org/t/the-voxel-value-is-showing-invalid/22170/5 "2022-02-25T14:24:33Z")

</div>

The image appears in the label layer (indicated by the `L` in the Data Probe), therefore it is a labelmap volume.

I think there is a heuristics that by default an image that has `label` in the filename is loaded as a labelmap, so if you want to load this image as a scalar volume instead then you need to change the default in the [“Add data” window](https://slicer.readthedocs.io/en/latest/user_guide/data_loading_and_saving.html#non-dicom-data) (or if you load it using Python then specify the `{"labelmap": 0}` property input of `slicer.util.loadVolume`).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/8/0861e0a42af95099f4795e51c401a4620a8834dd.png)
