# Lung ROIs in LungCTAnalyzer

**URL:** <https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349>\
**Category:** Support\
**Tags:** lungctanalyzer\
**Created:** [July 2, 2023, 11:22am UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349 "2023-07-02T11:22:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Leali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marco_leali/32/66628_2.png) [@Marco\_Leali](https://discourse.slicer.org/u/Marco_Leali)\
**Post date:** [July 2, 2023, 11:22am UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/1 "2023-07-02T11:22:50Z")

</div>

Hello everybody. I am using LungCTAnalyzer for a research project: wonderful extension! However, I was wondering about which method LungCTAnalyzer uses to divide lungs into a ventral and a dorsal ROI: is it 50% of the lung maximum height? How would you describe it in section “methods”? I would be grateful if the creator @rbumm could provide support.

---

<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:** [July 2, 2023, 12:18pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/2 "2023-07-02T12:18:07Z")

</div>

Hello Marco,

fantastic that you appreciate the extension.

Using the segment statistics module of 3D Slicers, the extension determines the centroid ras coordinate for each lung.

The “ventral” part of the lung is built as follows:

(1) All examined lung segments of that side are duplicated.  
(2) After creating a matching cube with markups and using “Erase inside” to the cube’s content, 3D Slicer’s Segment Editor “Surface Cut” effect is used to remove the dorsal half taking into account the centroid location. In this manner, the ventral lung’s volumes of interest are the only ones left.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/9/f9b3f786824e4090a6852bc8b2ff10ffe2b5484b.jpeg)

The function is realized [in the Python script](https://github.com/rbumm/SlicerLungCTAnalyzer/blob/e72868c1911c96a91e2b37a3b76955c8a70bd8bd/LungCTAnalyzer/LungCTAnalyzer.py#L2576) but below is shown how to do it manually.

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

Best  
r

---

<div class="post-metadata">

**Author:** ![Marco\_Leali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marco_leali/32/66628_2.png) [@Marco\_Leali](https://discourse.slicer.org/u/Marco_Leali)\
**Post date:** [July 2, 2023, 1:18pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/3 "2023-07-02T13:18:27Z")

</div>

Thank you very much for your prompt response. The centroid is determined as if the whole lung segment had homogeneous density, isn’t it? So that, by definition, 50% of the lung _volume_ will be kept in the ventral ROI and 50% of the lung _volume_ will be cut by “surface cut” tool. Is my understanding correct?

---

<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:** [July 2, 2023, 1:43pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/4 "2023-07-02T13:43:54Z")

</div>

Not exactly.

See here:

> **[ChatGPT](https://chat.openai.com/share/0a7eabf5-e46d-4978-894c-d3e98f5368b4)**
>
> A conversational AI system that listens, learns, and challenges

and here:

| Segment | Number of voxels [voxels] (1) | Volume [mm3] (1) | Volume [cm3] (1) | Centroid | OBB origin | OBB diameter [mm] | OBB X direction | OBB Y direction | OBB Z direction | Number of voxels [voxels] (2) | Volume [mm3] (2) | Volume [cm3] (2) | Minimum | Maximum | Mean | Median | Standard Deviation | Surface area [mm2] | Volume [mm3] (3) | Volume [cm3] (3) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| right lung anterior | 3264838 | 1.37309e+06 | 1373.09 | 54.7007 65.8004 -117.272 | 114.187 -30.2649 -255.738 | 137.078 199.452 239.165 | 0.467616 0.829749 0.304718 | -0.876122 0.480797 0.0352707 | -0.117242 -0.283463 0.951789 | 3264838 | 1.37309e+06 | 1373.09 | -1024 | 762 | -831.541 | -870.035 | 140.353 | 89553.4 | 1.38085e+06 | 1380.85 |
| right lung posterior | 3788027 | 1.59313e+06 | 1593.13 | 61.1447 -21.1237 -110.671 | -29.5151 -65.0638 12.2558 | 106.661 146.044 246.468 | 0.0218395 0.995805 -0.0888537 | 0.992706 -0.0110596 0.120052 | 0.118566 -0.0908275 -0.988783 | 3788027 | 1.59313e+06 | 1593.13 | -1024 | 1121 | -774.699 | -823.046 | 171.703 | 90095.9 | 1.60216e+06 | 1602.16 |

---

<div class="post-metadata">

**Author:** ![Marco\_Leali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marco_leali/32/66628_2.png) [@Marco\_Leali](https://discourse.slicer.org/u/Marco_Leali)\
**Post date:** [July 2, 2023, 2:42pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/5 "2023-07-02T14:42:59Z")

</div>

Thank you very much for you support. However, I am dubious about the AI interpretation: I tried to reformulate the question and it gave a different answer. To my knowledge, centroid calculation should yield the center of mass of an object with homogeneous density, by definition. This is why I wonder whether the volume discrepancies you have pointed out are due to discrete sampling. Should I start a thread asking for support from the segment statistics module authors?

---

<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:** [July 2, 2023, 4:12pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/6 "2023-07-02T16:12:27Z")

</div>

To my understanding, the center of mass of a lung lobe will not guarantee that cutting the organ axially, sagitally, or coronary in that position will always result in two identical volumes of the divided organ as shape and size of the organ, as well as the location of the division plane, can affect the resulting volumes.  
Maybe @lassoan or @pieper can comment?

---

<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:** [July 2, 2023, 5:38pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/7 "2023-07-02T17:38:02Z")

</div>

If i’m following correctly it sounds like @Marco_Leali may be asking for a different calculation that takes into account the density of the lung tissue and maybe calculates a cutting plane that allocates 50% of the density to the dorsal and ventral portions (or apportions 50% of the volume to each?). In any case I believe the technique based on the centroid will be an approximation of that based purely on geometric calculations.

---

<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:** [July 2, 2023, 7:17pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/8 "2023-07-02T19:17:44Z")

</div>

Is there a definition of this cutting plane that is widely used in clinical practice? If yes, then we must use that. If not, then we can freely choose a definition - something simple and reproducible.

---

<div class="post-metadata">

**Author:** ![Marco\_Leali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marco_leali/32/66628_2.png) [@Marco\_Leali](https://discourse.slicer.org/u/Marco_Leali)\
**Post date:** [July 2, 2023, 7:58pm UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/9 "2023-07-02T19:58:04Z")

</div>

Thank you for your response. I beg your pardon: I realized that I was completely wrong about centroid definition. I greatly appreciated your patience. The need for precision about ventral/dorsal separation is for research applications in ARDS, where the point in separating dorsal from ventral areas is that the former have superimposed hydrostatic pressure (and other gravity-dependent phenomena going on). In that case the focus would be more on geometric height than on the centroid. See this (doi: 10.1097/00000542-199101000-00004) as a well-known reference in our field.

---

<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:** [July 3, 2023, 9:52am UTC](https://discourse.slicer.org/t/lung-rois-in-lungctanalyzer/30349/10 "2023-07-03T09:52:01Z")

</div>

As far as I see there is no clear definition of this cutting plane available, so using the centroid level makes sense for now.  
Today masks for “upper half” and “lower half” of the lungs were added for convenience.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/c/2c8dbcfc8486ac844f4461e1209a65489f964578.jpeg)
