From 2c5603f00e7d3e995098ee35c7f616f65822bb15 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Tue, 15 Mar 2022 11:16:16 +0100 Subject: [PATCH] FIX: Wrong datatype used for offset when reading ITK's h5 fields. Offset can take negative values and does not need to be integer. Both assumptions were broken in the reader. Related: #137. --- nitransforms/io/itk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nitransforms/io/itk.py b/nitransforms/io/itk.py index b45a84de..fe74d64f 100644 --- a/nitransforms/io/itk.py +++ b/nitransforms/io/itk.py @@ -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)