Skip to content

Chapter 4 — Physical Geometry, Segmentation, and Resampling

An array is not yet an image in patient space

Chapter 3 closed by reading one real CT contract end to end: which object it is, what its stored values mean, and which metadata a viewer needs before anything on screen can be trusted. This chapter takes the next step with an illustrative geometry failure. A segmentation was created for a CT, and the mask looks plausible — the right organ, the right rough size, clean boundaries. Placed beside the image it was made for, though, it sits shifted: a few centimetres off, or subtly rotated, and a measurement that samples the CT through the misplaced mask can become a measurement of the wrong anatomy. Nothing in the mask’s values announces the problem. The mask is a box of numbers, and a box of numbers has no position in the patient.

That is the chapter’s persistent subject. A NumPy array carries rank, shape, dtype, and values — nothing about millimetres, nothing about orientation, nothing about which way is up. Geometry failures of exactly this kind can be consequential and stay silent whenever arrays are inspected without their metadata: a mask can land on the wrong anatomy, a feature can change for no apparent reason, a validation can silently compare misaligned volumes, and nothing announces itself as a geometry bug because every array involved looks fine. The repair is an explicit vocabulary — origin, spacing, direction, and size — that turns a box of numbers into an object with a location, an extent, and an orientation in patient space. Together the four define a complete regular image grid: spacing is the centre-to-centre distance between samples, not universally the physical support of a voxel; identity direction means the grid’s axes align with the selected physical coordinate axes, not necessarily the scanner; and a nonidentity direction can express obliquity, axis permutation, or reflection. That vocabulary is what lets a CT and a segmentation occupy “the same space”, what lets slices stack into a volume, and what makes resampling anything other than a silent warp.

The chapter builds the vocabulary and then uses it. First: why array indices and physical patient coordinates are different things, and the affine transform that connects them — including the row/column convention trap that quietly transposes people. Then: how slices are ordered geometrically rather than by filename or counting, and when a CT and a segmentation can be said to share space at all. The second half concerns representations and operations: why a SEG, an RTSTRUCT, and a binary mask are not the same object and what each silently loses; why images resample with interpolation while mask resampling is label-aware — nearest-neighbour is the direct label-preserving path, and a declared linear/trilinear interpolation followed by explicit re-binarisation can also be valid, so accidental fractional labels are the problem — and how that choice reaches boundary-dependent measurements. A closing case study shows visual inspection in 3D Slicer complementing — not replacing — geometric and provenance checks.

Each section adds one piece of the same capability: being able to say, with evidence, where a voxel is, whether two objects share a space, and what an operation did to that space. Later chapters build on it: a radiomic value depends on the image samples, the ROI representation, the complete geometry, the preprocessing, and the feature implementation. Geometry is one failure axis among several, and this chapter keeps them distinct: a validation that puts the same patients on both sides of a train/test fold boundary is a split-unit dependence — a leakage and statistical-validity failure, not a geometry statement — while a mask or volume that occupies the wrong coordinates is spatial misalignment. The first piece is the sharpest distinction in the chapter: an array has no physical location.

Sources

  • Zwanenburg A, Vallières M, Abdalah MA, et al. The Image Biomarker Standardisation Initiative: standardized quantitative radiomics for high-throughput image-based phenotyping. Radiology. 2020;295(2):328-338. doi:10.1148/radiol.2020191145. PMID 32154773. (PubMed; published full text: PMC7193906) — IBSI reference for how geometry, interpolation, and preprocessing choices enter radiomic measurements.
  • DICOM PS3.3, Image Plane Module (C.7.6.2) and Image Position and Image Orientation (C.7.6.2.1.1) — ImagePositionPatient, ImageOrientationPatient, PixelSpacing, and the pixel-index ↔ patient-coordinate mapping behind this chapter’s geometry vocabulary. (current edition)
  • SimpleITK, Fundamental Concepts — Images: origin, spacing, size, direction, and the index-to-physical-point mapping that define a regular image geometry. (docs)

© 2026 Adrian Tkacz · BioMedical-IT
Original text and figures are licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0), unless otherwise noted. Please credit Adrian Tkacz / BioMedical-IT and link to the original source. Third-party materials retain their respective rights and licenses.