Clinical indices (layer 3)¶
pipeline ¶
Clinical indices of a tidal recording or of a PEEP trial (layer 3).
Definitions and evidence: notebooks/07_clinical_indices.ipynb (section 5):
- EELI and TIV of a breath: one sample at the frames of the layer 2 breaths, on the signal inside the lung mask; EELI at the start of the breath, TIV = peak - start (TREND: Frerichs et al., Thorax 2017, DOI: 10.1136/thoraxjnl-2016-208357);
- per breath: TIV, EELI and share by region, GI, centre of ventilation, respiratory rate, compliance in EIT units (TIV / driving pressure) and in mL/cmH2O (tidal volume / driving pressure); with a tidal volume, the TIV and compliance of each region in mL (share x tidal volume);
- tidal recording: median and quartiles over the valid breaths;
- PEEP trial: per step, medians of the analysed breaths, compliance (also as % of the best step), Costa collapse and overdistension, changes vs the previous and the first step (EELI in tidal volumes and in mL, compliance); for the trial, the crossing PEEP, the best PEEP and the recruitment-to-inflation ratio, global and by region.
The tables hold the keys (breath_id, step, peep, region) and what this
layer computes; what layers 2 and 2b measured stays in recording.breaths,
trial.breaths and trial.steps, reached from the same object.
tidal_features ¶
tidal_features(recording: EITRecording, phase: Segment | None = None) -> TidalFeatures
Clinical indices of each breath of a recording at one setting, and their summary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recording
|
EITRecording
|
Output of |
required |
phase
|
Segment | None
|
The tidal part of the recording: a segment with |
None
|
Returns:
| Type | Description |
|---|---|
TidalFeatures
|
The breath, region and summary tables. The summary uses the valid breaths of |
TidalFeatures
|
the phase (no quality flag, not excluded). |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the phase is not usable or no breath is inside it. |
peep_trial_features ¶
peep_trial_features(trial: PeepTrial, config: AnalysisConfig | None = None) -> PeepTrialFeatures
Clinical indices of each breath and of each PEEP step of a PEEP trial.
The indices of a step come from its analysed breaths (segment_peep_trial()):
medians of the breath indices; compliance in EIT units = median TIV / driving
pressure of the step, in mL/cmH2O = tidal volume / driving pressure of the step
(both kept: the EIT compliance also sees what changes in the slice); Costa
collapse and overdistension from the median tidal image of each step; the
recruitment-to-inflation ratio between the steps nearest to the PEEP levels of the
config, globally and by region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trial
|
PeepTrial
|
Output of |
required |
config
|
AnalysisConfig | None
|
Parameters; defaults of |
None
|
Returns:
| Type | Description |
|---|---|
PeepTrialFeatures
|
The breath, region, step, step-region and summary tables. |
breath_indices ¶
Indices of the distribution of ventilation in one breath, from its tidal image.
The tidal image of a breath is each pixel at the end-inspiratory peak minus the same pixel at the start of the breath (end-expiratory valley), inside the lung mask: the "inspiratory" TIV of TREND (Frerichs et al., Thorax 2017, DOI: 10.1136/thoraxjnl-2016-208357), one sample at the frames of the layer 2 breaths (notebooks/07_clinical_indices.ipynb, sections 1-2).
tidal_images ¶
tidal_images(pixels: ndarray, starts: ndarray, peaks: ndarray, lung_mask: ndarray) -> np.ndarray
Tidal image of each breath: pixel at the peak minus pixel at the start.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixels
|
ndarray
|
(N, rows, cols) images after the cardiac step. |
required |
starts
|
ndarray
|
Frame of the start of each breath. |
required |
peaks
|
ndarray
|
Frame of the peak of each breath. |
required |
lung_mask
|
ndarray
|
(rows, cols) bool, the ventilated lung. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(n_breaths, rows, cols) float, NaN outside the lung mask. |
global_inhomogeneity ¶
global_inhomogeneity(image: ndarray) -> float
Global inhomogeneity index of one tidal image (lung pixels, NaN elsewhere).
GI = sum(|DI_xy - median(DI_lung)|) / sum(DI_lung), over the lung pixels (Zhao et al., Intensive Care Med 2009;35:1900-1906, DOI: 10.1007/s00134-009-1589-y). 0 for a homogeneous ventilation; higher when the ventilation is uneven.
Returns:
| Type | Description |
|---|---|
float
|
GI; NaN if the lung has no tidal variation. |
centre_of_ventilation ¶
centre_of_ventilation(image: ndarray) -> tuple[float, float]
Centre of ventilation of one tidal image, ventro-dorsal and right-left.
TIV-weighted mean row (column), divided by the last row (column) of the image (Frerichs et al., Am J Respir Crit Care Med 2006;174:772-779, DOI: 10.1164/rccm.200512-1942OC), on the image grid, not on the regions of the lung, so that a shift of ventilation is not hidden (notebooks 05 and 07). The image is seen from the feet: ventro-dorsal 0 = ventral, 1 = dorsal; right-left 0 = patient right, 1 = patient left. 0.5 is the middle of the image.
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
(ventro-dorsal, right-left); NaN if the lung has no tidal variation. |
costa ¶
Collapse and overdistension in a PEEP trial, from the compliance of each pixel.
Costa et al., Intensive Care Med 2009;35:1132-1137, DOI: 10.1007/s00134-009-1447-y; formulas as reported by Shono and Kotani, J Intensive Care 2019;7:4, DOI: 10.1186/s40560-019-0358-4 (notebooks/07_clinical_indices.ipynb, section 4):
- compliance of a pixel at a step = TIV of the pixel / driving pressure of the step;
- each pixel has its best compliance, at its best PEEP;
- at a step with a PEEP below the best PEEP of the pixel, its loss of compliance as % of its best is collapse; above, overdistension;
- collapse (overdistension) of a step = mean of the pixel %, weighted by the best compliance of each pixel, over the pixels of the lung mask;
- the crossing of the two curves is the PEEP with the best balance between them.
Compliance stays in EIT units: the method needs no tidal volume. An error common to all the pixels of a step (its driving pressure, the share of the tidal volume seen by the slice) shifts them together and appears as collapse or overdistension.
collapse_and_overdistension ¶
collapse_and_overdistension(pixel_compliance: ndarray, peep: ndarray, lung_mask: ndarray) -> pd.DataFrame
Collapse and overdistension (%) of each step (Costa 2009, formulas of Shono and Kotani 2019, see the module docstring).
collapse(step) = sum(loss_pixel(step) x best_pixel) / sum(best_pixel) over the pixels whose best PEEP is above the PEEP of the step, with loss_pixel = (best_pixel - compliance_pixel(step)) / best_pixel x 100; overdistension the same over the pixels whose best PEEP is below it. The loss of a pixel is at most 100 %.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixel_compliance
|
ndarray
|
(n_steps, rows, cols) compliance of each pixel at each step (TIV / driving pressure); NaN where unknown, e.g. a step without a driving pressure. |
required |
peep
|
ndarray
|
PEEP of each step. |
required |
lung_mask
|
ndarray
|
(rows, cols) bool, the pixels used. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per step: |
DataFrame
|
without compliance, and for every step if fewer than 2 steps have one or no |
DataFrame
|
pixel has a positive best compliance. |
crossing_peep ¶
crossing_peep(peep: ndarray, collapse: ndarray, overdistension: ndarray) -> float
PEEP where the collapse and overdistension curves cross (Costa 2009).
Going up in PEEP, collapse - overdistension must change sign, from positive to negative: linear interpolation between the two steps, or the PEEP of a step where the two are equal between them. Curves that only touch (the difference goes back to positive, or stays at 0 up to the highest PEEP) do not cross. If they cross more than once, the lowest crossing.
Returns:
| Type | Description |
|---|---|
float
|
The crossing PEEP; NaN if the curves do not cross. |
recruitment ¶
Recruitment-to-inflation ratio (R/I) of a PEEP trial, from EIT.
R/I (Chen et al., Am J Respir Crit Care Med 2020;201:178-187, DOI: 10.1164/rccm.201902-0334OC): when PEEP falls from a high to a low level, the lung loses more volume than its compliance at the low PEEP predicts; the excess is the volume that was recruited at the high PEEP:
predicted volume = C_low x dPEEP
recruited volume = dEELV - C_low x dPEEP
R/I = (recruited volume / dPEEP) / C_low
With EIT the change of end-expiratory lung volume is the change of EELI converted with the tidal volume / TIV of the low PEEP step (Wang et al., Med Sci Monit 2020;26:e922609, DOI: 10.12659/MSM.922609), and C_low = tidal volume / driving pressure of the low step. The tidal volume cancels in R/I, which therefore needs only EIT and the driving pressure:
R/I = dEELI / (C_EIT,low x dPEEP) - 1, with C_EIT,low = TIV_low / driving_low
and it applies to a region with its own EELI and EIT compliance. The original method reads one expiration after the drop of PEEP; here each level is the equilibrium EELI of a step, as in Wang 2020.
ri_steps ¶
ri_steps(peep: ndarray, high: float, low: float, min_drop: float) -> tuple[int, int] | None
The two steps used for R/I: the nearest to the high and to the low PEEP.
The high step is the step nearest to high; the low step is the step nearest to
low among those at least min_drop below the high step (the first one if two
are equally near).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peep
|
ndarray
|
PEEP of each step. |
required |
high
|
float
|
Target high PEEP (e.g. 15). |
required |
low
|
float
|
Target low PEEP (e.g. 5). |
required |
min_drop
|
float
|
Smallest drop of PEEP between the two steps. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int] | None
|
Index of the high and of the low step, or None if no pair drops enough. |
recruitment_to_inflation ¶
recruitment_to_inflation(eeli_high: float, eeli_low: float, tiv_low: float, driving_low: float, peep_drop: float, tidal_volume_low: float) -> tuple[float, float]
R/I and recruited volume between a high and a low PEEP step (see the module).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eeli_high
|
float
|
EELI of the high step (EIT units, global or of a region). |
required |
eeli_low
|
float
|
EELI of the low step, of the same region (EIT units). |
required |
tiv_low
|
float
|
TIV of the low step, of the same region (EIT units). |
required |
driving_low
|
float
|
Driving pressure of the low step (cmH2O). |
required |
peep_drop
|
float
|
PEEP of the high step minus PEEP of the low step (cmH2O). |
required |
tidal_volume_low
|
float
|
Tidal volume of the low step, times the share of the region for a region (mL); NaN if unknown. |
required |
Returns:
| Type | Description |
|---|---|
float
|
R/I, and the recruited volume in mL (NaN without a tidal volume); NaN if a value |
float
|
is missing or the low compliance or the drop of PEEP is not positive. |