Skip to content

Commit

Permalink
Merge pull request #172 from AustralianCancerDataNetwork/visualise-ma…
Browse files Browse the repository at this point in the history
…sks-only

Visualise masks only ignoring other files
  • Loading branch information
pchlap authored Dec 3, 2024
2 parents 35edb1b + 00e4076 commit 778e763
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pydicer/visualise/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -203,6 +204,11 @@ 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}
Expand Down Expand Up @@ -280,6 +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
}

if len(masks) == 0:
logger.warning(
Expand Down

0 comments on commit 778e763

Please sign in to comment.