ENH: model DICOM acquisition geometry (addresses #4409)
Add a step to the DICOMScalarVolumePlugin to check that the loaded volume node's slice geometry matches what is expected from the position and orientation information of the individual slices in the DICOM headers.
If needed, a grid transform is created to reposition each slice to the appropriate position in patient space.
The DICOMReaders self test has been extended to test this in the case where slices are missing from the middle of the volume. The grid transform results in an interpolated band of pixels using information from adjacent slices to 'fill in' for the missing data. The test confirms that the last slice of the reconstructed volume is in the expected location in patient space. This correction means that calculations like ruler or segment statistics can be robust even with missing slices.
Currently the only available testing data is for the case of missing slices. However this code should allow proper loading and display of several not-uncommon imaging scenarios:
-
Missing slices due to network failure or accidental file deletion.
-
Gantry tilted image acquisitons (see #4409) which is used, for example, to minimize radiation exposure to the retinas especially in pediatric imaging.
-
Variable table speed during CT acquisition, which is sometimes used in abdominal or musculoskeletal imaging to provide high resolution in selected body parts and lower resolution between (e.g. high res at the ankle, knee and hip, but low res in the shin and thigh).
Consderations:
By creating a transform we preserve the original data and leave it to the user to resample if desired. The option of resampling during load was rejected since it is unclear what sampling grid would be best in all cases.
Although the transform should correct the geometry, a warning dialog is still generated during loading since the issue could be correctable (such as missing slices) or may be triggered by other data issues not forseen by this code.