From ff3cfdd53efd2c6c85bdab18110eedf77a560c39 Mon Sep 17 00:00:00 2001 From: Phillip Chlap Date: Mon, 25 Nov 2024 04:23:11 +1100 Subject: [PATCH 1/2] Visualise masks only ignoring other files --- pydicer/visualise/data.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pydicer/visualise/data.py b/pydicer/visualise/data.py index 664d6c9..b2e7f30 100644 --- a/pydicer/visualise/data.py +++ b/pydicer/visualise/data.py @@ -59,6 +59,7 @@ def visualise( ) visualise_modalities = ["CT", "MR", "RTSTRUCT", "RTDOSE", "PT"] + render_mask_types = [sitk.sitkUInt8, sitk.sitkUInt16, sitk.sitkUInt32, sitk.sitkUInt64] df_process = df_process[df_process.modality.isin(visualise_modalities)] for _, row in get_iterator( @@ -203,6 +204,8 @@ def visualise( for f in struct_dir.glob("*.nii.gz") } + masks = {k: masks[k] for k in masks if masks[k].GetPixelID() in render_mask_types} + if len(masks) == 0: logger.warning( "No contours found in structure directory: %s", {struct_dir} @@ -280,6 +283,7 @@ def visualise( f.name.replace(".nii.gz", ""): sitk.ReadImage(str(f)) for f in struct_dir.glob("*.nii.gz") } + masks = {k: masks[k] for k in masks if masks[k].GetPixelID() in render_mask_types} if len(masks) == 0: logger.warning( From 00e4076c2e3405c1ee29cc455a5ccb69fd1108b3 Mon Sep 17 00:00:00 2001 From: Phillip Chlap Date: Mon, 25 Nov 2024 07:16:34 +1100 Subject: [PATCH 2/2] Fix line too long --- pydicer/visualise/data.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pydicer/visualise/data.py b/pydicer/visualise/data.py index b2e7f30..8608ae0 100644 --- a/pydicer/visualise/data.py +++ b/pydicer/visualise/data.py @@ -204,7 +204,10 @@ def visualise( for f in struct_dir.glob("*.nii.gz") } - masks = {k: masks[k] for k in masks if masks[k].GetPixelID() in render_mask_types} + masks = { + k: masks[k] for k in masks + if masks[k].GetPixelID() in render_mask_types + } if len(masks) == 0: logger.warning( @@ -283,7 +286,10 @@ def visualise( f.name.replace(".nii.gz", ""): sitk.ReadImage(str(f)) for f in struct_dir.glob("*.nii.gz") } - masks = {k: masks[k] for k in masks if masks[k].GetPixelID() in render_mask_types} + masks = { + k: masks[k] for k in masks + if masks[k].GetPixelID() in render_mask_types + } if len(masks) == 0: logger.warning(