No test asserts that a NIfTI scl_slope survives a write/read round trip at full precision. The two places scl_slope appears in the NIfTI tests use it for other purposes, so the precision fix in #6003 is currently unguarded against regression.
Current coverage, verified on upstream/main
git grep scl_slope -- Modules/IO/NIFTI/test returns exactly three lines:
| Location |
What it does |
itkNiftiImageIOTest.cxx:192 |
format string in a header printf |
itkNiftiImageIOTest.cxx:204 |
the matching hp->scl_slope printf argument |
itkNiftiImageIOTest5.cxx:57 |
sets scl_slope = 1.0 / 256.0 to exercise pixel rescale-on-read |
Test5 sets the value but asserts on rescaled pixel data, not on the
round-tripped slope itself. Nothing fails if the stored slope loses precision.
Proposed test
Write an image with a scl_slope that is not exactly representable after a
narrowing conversion, read it back, and assert the recovered slope equals the
written one to full double precision. A value such as 1.0 / 3.0 or a
scanner-realistic slope with many significant digits exercises the path that
#6003 fixed.
Small and self-contained — one test function in the existing NIfTI driver.
No test asserts that a NIfTI
scl_slopesurvives a write/read round trip at full precision. The two placesscl_slopeappears in the NIfTI tests use it for other purposes, so the precision fix in #6003 is currently unguarded against regression.Current coverage, verified on
upstream/maingit grep scl_slope -- Modules/IO/NIFTI/testreturns exactly three lines:itkNiftiImageIOTest.cxx:192itkNiftiImageIOTest.cxx:204hp->scl_slopeprintf argumentitkNiftiImageIOTest5.cxx:57scl_slope = 1.0 / 256.0to exercise pixel rescale-on-readTest5 sets the value but asserts on rescaled pixel data, not on the
round-tripped slope itself. Nothing fails if the stored slope loses precision.
Proposed test
Write an image with a
scl_slopethat is not exactly representable after anarrowing conversion, read it back, and assert the recovered slope equals the
written one to full
doubleprecision. A value such as1.0 / 3.0or ascanner-realistic slope with many significant digits exercises the path that
#6003 fixed.
Small and self-contained — one test function in the existing NIfTI driver.