Skip to content

Commit

Permalink
FIX: Wrong datatype used for offset when reading ITK's h5 fields.
Browse files Browse the repository at this point in the history
Offset can take negative values and does not need to be integer. Both
assumptions were broken in the reader.

Related: #137.
  • Loading branch information
oesteban committed Mar 15, 2022
1 parent ee4902a commit 2c5603f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nitransforms/io/itk.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def from_h5obj(cls, fileobj, check=True):
if xfm["TransformType"][0].startswith(b"DisplacementFieldTransform"):
_fixed = np.asanyarray(xfm[f"{typo_fallback}FixedParameters"])
shape = _fixed[:3].astype("uint16").tolist()
offset = _fixed[3:6].astype("uint16")
offset = _fixed[3:6].astype("float")
zooms = _fixed[6:9].astype("float")
directions = _fixed[9:].astype("float").reshape((3, 3))
affine = from_matvec(directions * zooms, offset)
Expand Down

0 comments on commit 2c5603f

Please sign in to comment.