I have an image for which I write an AxisArray as an NRRD and I get a header like this:
NRRD0004
type: float
dimension: 3
space dimension: 3
sizes: 390 256 61
spacings: 1.3 1.3 3.0
units: "μm" "μm" "μm"
endian: little
encoding: raw
space origin: (0.32499999999998863,0.32500000000001705,0.0)
When I try loading this image with ITK it fails with this message:
itk::ExceptionObject (0x56a9460)
Location: "unknown"
File: /home/cody/src/antsbin/ITKv4/Modules/IO/NRRD/src/itkNrrdImageIO.cxx
Line: 474
Description: itk::ERROR: NrrdImageIO(0x56a8ae0): ReadImageInformation: Error interpreting nrrd spacing (nrrdSpacingStatusScalarWithSpace)
If I modify the header in this way it loads fine (new fields are starred):
NRRD0004
type: float
dimension: 3
space dimension: 3
sizes: 390 256 61
**space units: "μm" "μm" "μm"**
endian: little
encoding: raw
space origin: (0.32499999999998863,0.32500000000001705,0.0)
**space directions: (1.3,0,0) (0,1.3,0) (0,0,3.0)**
I'm a little confused about why this change was necessary. When reading the NRRD format spec it seems that the "spacings" field should be equivalent to the "space directions" field when the world axes align with the array axes, as in this case. Likewise I don't understand why we need to use the "space units" field instead of the "units" field, but both changes are necessary.
I can submit a PR changing how we write the header. But first I'd like to make sure that I'm handling this in the best way. Any opinions from anyone more familiar with the NRRD format?
I have an image for which I write an
AxisArrayas an NRRD and I get a header like this:When I try loading this image with ITK it fails with this message:
If I modify the header in this way it loads fine (new fields are starred):
I'm a little confused about why this change was necessary. When reading the NRRD format spec it seems that the "spacings" field should be equivalent to the "space directions" field when the world axes align with the array axes, as in this case. Likewise I don't understand why we need to use the "space units" field instead of the "units" field, but both changes are necessary.
I can submit a PR changing how we write the header. But first I'd like to make sure that I'm handling this in the best way. Any opinions from anyone more familiar with the NRRD format?