autods_pet.imaging.geometry#
Geometry checks and spatial alignment for SimpleITK images.
- autods_pet.imaging.geometry.check_same_geometry(a, b, tol=0.0001)[source]#
Check whether two images share the same spatial geometry.
Compares size, spacing, origin, and direction cosine matrix.
- autods_pet.imaging.geometry.check_sub_geometry(a, b, tol=0.0001)[source]#
Check whether a lives on a compatible voxel grid as b (sub-volume).
Returns
Truewhen spacing matches within tol and direction cosine axes are parallel (signs may differ - a Z-flip between LPS and RAS conventions is allowed). Size and origin may differ freely.This identifies the common DICOM SEG case where the mask only covers the slices that contain a contour (fewer slices, different origin) and may have been exported with a flipped axis convention.
- autods_pet.imaging.geometry.resample_to_reference(mask, reference)[source]#
Resample mask onto the reference grid (zero-padded, nearest-neighbour).
Used to embed a partial-FOV binary mask (e.g. a DICOM SEG covering only a few slices) into the full reference volume. Voxels outside the mask’s original extent are set to 0.
- Parameters:
mask (
Image) – Binary mask (sub-volume).reference (
Image) – Full-size reference image whose grid defines the output.
- Returns:
Resampled mask with the same size, origin, spacing, and direction as reference.
- Return type:
Image