# Interactive lung lobe segmentation fails with NIFTI volume

**URL:** <https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052>\
**Category:** Support\
**Tags:** cip\
**Created:** [June 26, 2022, 1:27pm UTC](https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052 "2022-06-26T13:27:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [June 26, 2022, 1:27pm UTC](https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052/1 "2022-06-26T13:27:31Z")

</div>

Hi,

I am trying to generate lung lobe labels for a MONAI Label segmentation with the “Interactive Lobe Segmentation”.

With a COV-19 lung CT demo dataset (as well as with the Slicers “CTChest” demo) I get:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/6/461e2fc415d6dbac133196e7e2f7d22fdb188333.jpeg)

… which is reasonable.

When I load data from MONAI Labels “Task06Lung” dataset (which obviously is a NIFTI volume) the interactive lobe segmentation is not correct:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/4/14b4a3d8aebec9311d6d31e14e401f11f84ac126.jpeg)

The file name: lung\_001.nii.gz

Do I need to convert the volume?

PS: The “Lung CT Segmenter” works well in both cases.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [June 26, 2022, 1:36pm UTC](https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052/2 "2022-06-26T13:36:38Z")

</div>

“Volume” for “DemoChestCT” (lobe segmentation working) shows:

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

Volume for lung\_001.nii.gz (lobe segmentation not working) shows:

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/4/1481d54fa15c185b43ca4cee69e2433b5f083ada.png)

Two things I tried and that had no effect:

- Export the NIFTI Volume as DICOM dataset, then reload the DICOM
- Load the NIFT volume and “Cast scalar volume” to integer

---

<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:** [June 26, 2022, 8:13pm UTC](https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052/3 "2022-06-26T20:13:57Z")

</div>

This lung\_001.nii.gz image seems to be quite unusual, i.e., messed up.

1. Float scalar type does not make sense for clinical CTs, so change that to `short`. Do not choose `Int`, as that would be 32 bits per voxel, which would be unusual, too.

2. The IJK coordinate system is a left-handed coordinate system (determinant of the IJK to RAS direction matrix is negative, so the transformation turns the volume inside out). You can fix this by resampling the volume using Crop volume module with the default settings (you don’t need to crop away any part of the volume, you just take advantage of that `Interpolated cropping` enables resampling and the module always uses right-handed coordinate system for IJK).

3. Nifti is for brain imaging. For general imaging purposes, use nrrd instead. Nifti has many issues, for example it is very easy to mess up the image orientation (as it is stored in Nifti in a complex, redundant way and interpretation of non-trivial cases is inconsistent between different applications).

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [June 26, 2022, 8:45pm UTC](https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052/4 "2022-06-26T20:45:38Z")

</div>

Thank you, @lassoan  
Did as advised:

- changed (with “Cast Scalar Volume” module) the scalar type to short
- resampled the volume. There is still the circled “1” in the Matrix which is “-1” in all working cases …

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/f/1ffbf8d087116765b8c74a47bdc02d4c5a65e588.png)

Unfortunately still no lobes detected:

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/a/8ae298c0901a3b85862653354155253267bd1b4a.jpeg)

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [June 26, 2022, 9:03pm UTC](https://discourse.slicer.org/t/interactive-lung-lobe-segmentation-fails-with-nifti-volume/24052/5 "2022-06-26T21:03:14Z")

</div>

Link to a folder containing the initial file is here:  
[https://drive.google.com/drive/folders/1-5MlZWz9wbqLsHuaQq81-4HUWwCnJxPs?usp=sharing](https://drive.google.com/drive/folders/1-5MlZWz9wbqLsHuaQq81-4HUWwCnJxPs?usp=sharing)
