# Lung airway segmentation

**URL:** <https://discourse.slicer.org/t/lung-airway-segmentation/2467>\
**Category:** SlicerCIP\
**Tags:** cip\
**Created:** [March 29, 2018, 7:52am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467 "2018-03-29T07:52:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [March 29, 2018, 7:52am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/1 "2018-03-29T07:52:53Z")

</div>

i want to use lung airway segmentation tool in 3D slicer but i can’t find it in the slicer i downloaded. pl help

---

<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:** [March 29, 2018, 12:50pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/2 "2018-03-29T12:50:30Z")

</div>

> **[Workstation (SlicerCIP)](https://chestimagingplatform.org/workstation-slicer-cip)**
>
> Extension to the Slicer that integrates:

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [March 29, 2018, 2:07pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/3 "2018-03-29T14:07:00Z")

</div>

i am quite new to 3d slicer. when i am viewing RGB image set, it’s giving me R G B values separately. pl tell me how to find HU at different locations

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [March 29, 2018, 2:07pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/4 "2018-03-29T14:07:40Z")

</div>

thanks for workstation info

---

<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:** [March 29, 2018, 3:49pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/5 "2018-03-29T15:49:26Z")

</div>

> [@anitakh1](#):
>
> i am quite new to 3d slicer. when i am viewing RGB image set, it’s giving me R G B values separately. pl tell me how to find HU at different locations

Sorry, you’ll need to provide more detail if you need help (what data you loaded, how you loaded it, what you expected to see and what you see instead). Sometime screenshots help (but no patient-identifiable data please). If your data is RGB typically the mapping back to HU is not recoverable.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [March 30, 2018, 4:50am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/6 "2018-03-30T04:50:45Z")

</div>

one more thing. i have downloaded workstation CIP but how to add it in 3D slicer??

---

<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:** [March 31, 2018, 1:36am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/7 "2018-03-31T01:36:00Z")

</div>

Download “Slicer with CIP integrated” - that contains a Slicer distribution that already contains CIP modules.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 2, 2018, 5:35am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/8 "2018-04-02T05:35:24Z")

</div>

thanks, could install slicer with CIP integrated. i am in the learning stage and working on airway and vessel segmentation of lung CT dicom images. i have segmented out the lung lobes. as airways and vessels are very different than bone, what strategy should i follow. moreover as i am doing phd, for research will it be enough if i use slicer tools for segmentation or i have to do coding. i am quite new, sorry if i sound stupid.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 2, 2018, 9:10am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/9 "2018-04-02T09:10:15Z")

</div>

one more thing. i did some vessel segmentation work on jpeg image set using matlab. is there any way to view its 3D view in 3D slicer?

---

<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:** [April 2, 2018, 1:05pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/10 "2018-04-02T13:05:33Z")

</div>

Saving 3D medical images as a sequence of JPEG files leads to many problems (decreased image quality: bit depth limited to 8 bits or less, potential compression artifacts; no slice spacing information, no anatomical image orientation information; etc). Instead, you can use image file formats that are developed for this purpose and widely supported by all medical image computing applications, such as NRRD.

You can find Matlab reader and writer for NRRD files here: [https://github.com/PerkLab/SlicerMatlabBridge/tree/master/MatlabCommander/commandserver](https://github.com/PerkLab/SlicerMatlabBridge/tree/master/MatlabCommander/commandserver)

You can also run your Matlab functions directly from Slicer using MatlabBridge extension:  
[https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MatlabBridge](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MatlabBridge)

---

<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:** [April 2, 2018, 1:15pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/11 "2018-04-02T13:15:52Z")

</div>

> [@anitakh1](#):
>
> as airways and vessels are very different than bone, what strategy should i follow

Could you please clarify segmentation of what structures you would like to get advice on?

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 4, 2018, 7:44am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/12 "2018-04-04T07:44:27Z")

</div>

thanks for very informative words. i added MatlabBridge into 3D slicer and trying to understand. i have my own codes written in matlab, can i run these codes through MatlabBridge or have to use modules available.

moreover i have one serious problem. i have dicom data by the name ‘dicom\_021.dcm’ with header file ‘dicom\_021.mhd’. dicom\_021.dcm contains all 459 dicom images but i can’t view it as dicom folder showing separate dicom images. how can i achieve that. actually i want to take images one by one and process them using my matlab code.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 4, 2018, 7:45am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/13 "2018-04-04T07:45:30Z")

</div>

actually i am working on CT lung airways and blood vessel segmentation.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [April 4, 2018, 2:24pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/14 "2018-04-04T14:24:16Z")

</div>

Yes, you can run your own Matlab code using Matlab Bridge. After you generate your module skeleton you can call your function from the module’s Matlab file. There are nice tutorials, even videos in the [page](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MatlabBridge) @lassoan linked above.

Have you tried loading that DICOM with Slicer? You can do it in the DICOM module: in the browser that pops up you need to import the folder containing the DICOM files and the patient/study/series will appear in the browser. Once you load it, you have access to the 3D image data, which is then transferred to Matlab by Matlab Bridge (from the module you generate).

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 6, 2018, 6:05am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/15 "2018-04-06T06:05:11Z")

</div>

thank you sir. i made a segmentation program on matlab for jpeg images. but now as i have to work on dicom images, i converted the whole lot into nifti ‘.nii’ and ran my program. i saved each individual output as .nii image in a folder. so now i have some 300 .nii segmented outputs. how can i do volume rendering to view the segmented output in volume form? i tried but slicer is taking single .nii image at a time.

---

<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:** [April 6, 2018, 11:38am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/16 "2018-04-06T11:38:58Z")

</div>

Unless you work with brain images (where nii is probably the most widely used file format), I would recommend to use nrrd file format instead of nii, because nrrd is a somewhat simpler and better specified file format, which has better support in Slicer. You can find nrrd reader and writer for Matlab here: [https://github.com/PerkLab/SlicerMatlabBridge/tree/master/MatlabCommander/commandserver](https://github.com/PerkLab/SlicerMatlabBridge/tree/master/MatlabCommander/commandserver)

Since you work with volumetric images, you must save the image as a 3D volume (so that you can specify position, orientation, and voxel size in 3D). The nrrdwrite.m script that I referenced above can save a 3D Matlab matrix as a single 3D nrrd file, which Slicer can load and render as a volume.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 9, 2018, 7:30am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/17 "2018-04-09T07:30:24Z")

</div>

thanks for your valuable advice. sir i am learning to use matlab with slicer and trying to understand how to do that. but i am not getting the essence. i have my matlab code which starts like…

“im\_mask = nrrdread(‘C:/Users/ND\_Londhe/Desktop/lung\_mask.nrrd’);”  
and then i have to take images one by one and apply segmentation program which follows. but how to merge these codes in the module generated by module generator. do i have to transform codes in .m and XML file to be read by slicer. i followed the two videos but not understanding how to connect matlab and run codes from slicer. pl guide

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 10, 2018, 1:15pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/18 "2018-04-10T13:15:49Z")

</div>

sir actually when i am making my own module using matlab module generator, it is showing threshold tabs. how to use my program and make it to run?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [April 10, 2018, 1:39pm UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/19 "2018-04-10T13:39:30Z")

</div>

You need to edit the XML so that the module UI contains the input fields you require. The threshold control is just part of the example.

This may help: [https://www.slicer.org/wiki/Documentation/Nightly/Developers/SlicerExecutionModel#XML\_Schema](https://www.slicer.org/wiki/Documentation/Nightly/Developers/SlicerExecutionModel#XML_Schema)

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [April 11, 2018, 6:29am UTC](https://discourse.slicer.org/t/lung-airway-segmentation/2467/20 "2018-04-11T06:29:56Z")

</div>

thank you. i will try to understand. sir how can i see two image sets one over other?

[Next page](https://discourse.slicer.org/t/lung-airway-segmentation/2467.md?page=2)
