Closed hjmjohnson closed 1 week ago
Local mac testing:
100% tests passed, 0 tests failed out of 3011
@jhlegarreta I appreciate your comments, but I don't have the bandwidth to make this perfect. I'm going to add it as is.
Is this at all related to https://github.com/InsightSoftwareConsortium/ITK/issues/4794 ?
I just tracked down 916a40cb3cebf817f91b69ef80a428b346c46fef as the cause of one of our app's unit test failures.
With the new less-strict tolerance check, ITK_non_uniform_sampling_deviation
is no longer added to the metadata dictionary, and our test was expecting it to be there.
We use the value of ITK_non_uniform_sampling_deviation
to decide for ourselves if it is above/below an acceptable tolerance. But 916a40cb3cebf817f91b69ef80a428b346c46fef has now hardcoded a tolerance, making it impossible for us to choose ourselves.
It's not clear to me from the commit message what bug this commit was fixing... Yes, AlmostEquals()
will return false for "slices that are only 1e-15 different for 1.5mm slices", but so what? Then ITK_non_uniform_sampling_deviation
will contain a tiny number and callers can decide if they care. They can also just ignore ITK_non_uniform_sampling_deviation
.
Where does this magic 1e-6 (DefaultImageCoordinateTolerance
) number come from? What are its units? millimetres? metres? inches? How can we assume this number is appropriate for every kind of DICOM file under the sun?
Dicom files that do not have explicit "SliceThickness" listed can still be used. The actual "spacing between slices" is computed from the stack of slices when multiple dicoms are provided such that the initial setting of the "SliceThickness" placeholder is not used. (NOTE: SliceThickness is used when a single slice is read into a 3D image).
This fixes an issue when a stack of 124 dicom slices does not have "SliceThickness" fields, but does have "ImagePositionPatient" for each slice.
The previous implementation would throw an exception prior to getting to the code that explicitly computes the slice space from the "ImagePositionPatient" values.
The new code now allows ITK to make 3D nifti volumes that are compatible with those created by the dcm2niix package.
PR Checklist