Skip to content

bug: predicted mask file is not completely aligned to the ground truth #13

@strixy16

Description

@strixy16

In the saving of the predicted mask, only partial alignment is completed:

# Save mask
save_mask = sitk.GetImageFromArray(segs_3D)
save_mask.SetSpacing(spacing)
sitk.WriteImage(save_mask, masks_dir / f"{patient_id}.nii.gz")

The spacing is one part, but the origin needs to be copied over as well, or else the images won't overlay in a display (like in 3DSlicer)

To add:

origin = image.GetOrigin()
save_mask.SetOrigin(origin)

We also have a function for this in readii, so alternatively could use:

from readii.image_processing import alignImages

save_mask = alignImages(image, save_mask)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions