Pixel operations
Resample (spacing, matrix)
Resample pixel data to a target voxel spacing or matrix size.
Problem
You need to standardize a dataset to a uniform matrix size — e.g. all images must be 256×256 for an AI training pipeline that expects consistent input dimensions. The original images have varying matrix sizes (512×512, 320×320, etc.). Resampling with bilinear interpolation produces a consistent grid while preserving anatomical proportions by updating the Pixel Spacing tag.
Steps
-
Open the file (⌘O) and record the original Pixel Spacing (0028,0030) in Edit mode.
-
Open Pixel Operations — ⌘K → “Pixel operations…”.
-
Select Resample.
-
Set target dimensions:
- Target width: 256
- Target height: 256
-
Click Apply transform.
-
Verify:
- Rows (0028,0010) →
256 - Columns (0028,0011) →
256 - Pixel Spacing (0028,0030) → updated to reflect the scale change (different from original)
- Rows (0028,0010) →
Expected Result
- Output image is exactly 256×256 pixels.
- Pixel Spacing is recalculated: if the original was 1.0mm × 1.0mm on a 512×512 image, the resampled spacing becomes ~2.0mm × 2.0mm to preserve physical dimensions.
- Bilinear interpolation ensures smooth pixel value transitions.
- The output is a derived copy with a new SOP Instance UID.