Autoshrink lung masks in Lung CT Analyzer and Segmenter

Hi all,

By default, lung masks produced by ‘Lung CT Segmenter’ may include pleura, pericardium, and diaphragm at the borderlines. These areas may be wrongly segmented as ‘infiltrated’ or ‘collapsed’ lung parenchyma by ‘Lung CT Analyzer’.

A new ‘Lung CT Segmenter’ option now enables shrinking the lung masks by a small constant amount (1 mm).


Alternatively, the shrinking of the lung masks with variable shrink volumes can be realized by a script call of the newly implemented Lung CT Analyzer logic ‘shrinkLungMasks’.

Python script example:

import LungCTAnalyzer
from LungCTAnalyzer import LungCTAnalyzerLogic

# switch to module 

logic = LungCTAnalyzerLogic()

logic.inputVolume = loadedVolumeNode # you must have loded that before
logic.inputSegmentation = loadedMaskNode  # you must have loded that before
logic.rightLungMaskSegmentID =loadedMaskNode.GetSegmentation().GetSegmentIdBySegmentName("right lung")
logic.leftLungMaskSegmentID =loadedMaskNode.GetSegmentation().GetSegmentIdBySegmentName("left lung")

# shrink masks
val = 1.0
# do processing with current slider settings

where ‘val’ is a value in millimeters.

The described functionality is available in ‘Lung CT Analyzer’ V 2.36.

Result after mask shrinking (data set part of COVID-19 Open Source project PaoloZaffino):

Best regards