|
16 | 16 | import SimpleITK as sitk # noqa: N813 |
17 | 17 | from tqdm import tqdm |
18 | 18 |
|
19 | | -from cinema import LV_LABEL |
| 19 | +from cinema import LV_LABEL, RV_LABEL |
20 | 20 | from cinema.data.mnms2 import MNMS2_LABEL_MAP, MNMS2_LAX_SLICE_SIZE, MNMS2_SAX_SLICE_SIZE, MNMS2_SPACING |
21 | 21 | from cinema.data.sitk import ( |
22 | 22 | cast_to_uint8, |
@@ -151,10 +151,13 @@ def preprocess_pid( # pylint:disable=too-many-statements |
151 | 151 | sax_es_image = sitk.Crop(sax_es_image, crop_lower, crop_upper) |
152 | 152 | sax_es_label = sitk.Crop(sax_es_label, crop_lower, crop_upper) |
153 | 153 |
|
154 | | - # calculate EDV, ESV, EF, HFrEF (EF < 40%) |
155 | | - data["edv"] = sitk.GetArrayFromImage(sax_ed_label).sum() * np.prod(MNMS2_SPACING) / 1000.0 # ml = 1000 mm^3 |
156 | | - data["esv"] = sitk.GetArrayFromImage(sax_es_label).sum() * np.prod(MNMS2_SPACING) / 1000.0 # ml = 1000 mm^3 |
157 | | - data["ef"] = ejection_fraction(edv=data["edv"], esv=data["esv"]) |
| 154 | + # calculate EDV, ESV, EF for LV and RV, ml = 1000 mm^3 |
| 155 | + data["lv_edv"] = sitk.GetArrayFromImage(sax_ed_label == LV_LABEL).sum() * np.prod(MNMS2_SPACING) / 1000.0 |
| 156 | + data["lv_esv"] = sitk.GetArrayFromImage(sax_es_label == LV_LABEL).sum() * np.prod(MNMS2_SPACING) / 1000.0 |
| 157 | + data["lv_ef"] = ejection_fraction(edv=data["lv_edv"], esv=data["lv_esv"]) |
| 158 | + data["rv_edv"] = sitk.GetArrayFromImage(sax_ed_label == RV_LABEL).sum() * np.prod(MNMS2_SPACING) / 1000.0 |
| 159 | + data["rv_esv"] = sitk.GetArrayFromImage(sax_es_label == RV_LABEL).sum() * np.prod(MNMS2_SPACING) / 1000.0 |
| 160 | + data["rv_ef"] = ejection_fraction(edv=data["rv_edv"], esv=data["rv_esv"]) |
158 | 161 |
|
159 | 162 | # normalise intensity |
160 | 163 | lax_4c_ed_image = clip_and_normalise_intensity_3d(lax_4c_ed_image, intensity_range=None) |
|
0 commit comments