Watershed lung space
eitprocessing.roi.watershed.WatershedLungspace
dataclass
¶
WatershedLungspace(*, threshold_fraction: float = 0.15)
Create a pixel mask based on the watershed method.
This method was designed to improve functional lung space detection in the presence of pendelluft. Functional lung space defined as pixels with a tidal impedance variation (TIV) at or above a percentage of the maximum TIV can result in underdetection of pixels that have reduced TIV due to the pendelluft phenomenon. An alternate approach using the pixel amplitude instead of the TIV results in overinclusion of pixels.
Watershed regions
The concept of watershed regions come from geography, where it refers to the area of land that drains into a single river or body of water. In the context of image processing, it refers to the region of an image that is associated with a particular local minimum. The region borders are defined by the 'ridges' between the local minima. The inverse watershed method uses maxima and 'valleys' between them. This algorithm uses the inverse method, where local maximum impedance values form the centers of watershed regions.
In this method, the inverse watershed method is applied to the pixel amplitude. This results in distinct regions with high values for more central pixels, and low values for edge pixels. Regions where the highest value falls within the TIV-based functional lung space definition are included in the mask. Other regions are excluded. Pixels that fall outside the amplitude based functional lung space definition are excluded.
Example usage:
>>> mask = WatershedLungspace(threshold_fraction=0.15).apply(eit_data)
>>> masked_eit_data = mask.apply(eit_data)
PARAMETER | DESCRIPTION |
---|---|
threshold_fraction
|
The fraction of the maximum TIV for the initial functional lung space definition that is used in the algorithm. Defaults to 0.15 (15%).
TYPE:
|
apply
¶
apply(
eit_data: EITData,
*,
timing_data: ContinuousData | None = None,
captures: dict | None = None
) -> PixelMask
Apply the watershed method to the EIT data.
TIVLungspace is used to gather the mean TIV and mean amplitude maps, and their associated functional lung space masks. The lung space masks are redefined here to ensure that the same breaths are used for both TIV and amplitude.
Local peaks in the amplitude map are found using skimage.feature.peak_local_max
. These peaks are used to find
the (inverse) watershed regions in the amplitude map. Regions whose peaks fall inside the functional TIV mask
are included, the others are excluded. The final watershed mask is the intersection of the functional amplitude
mask and the remaining included watershed regions.
PARAMETER | DESCRIPTION |
---|---|
eit_data
|
The EIT data to apply the watershed method to.
TYPE:
|
timing_data
|
The timing data to use for the TIV calculation. If None, the summed impedance is used.
TYPE:
|
captures
|
An optional dictionary to capture intermediate results. If None, no captures are made.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PixelMask
|
A mask of the functional lung space based on the watershed method.
TYPE:
|