Skip to content

Commit bf2e90b

Browse files
committed
fix: LTA file write
1 parent 4b18c65 commit bf2e90b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nitransforms/linear.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from nibabel.affines import from_matvec, voxel_sizes, obliquity
1818
from .base import TransformBase
1919
from .patched import shape_zoom_affine
20-
from .io import LinearTransformArray, LinearTransform, VolumeGeometry
20+
from . import io
2121

2222

2323
LPS = np.diag([-1, -1, 1, 1])
@@ -300,15 +300,15 @@ def to_filename(self, filename, fmt='X5', moving=None):
300300
return filename
301301
elif fmt.lower() == 'lta':
302302
# xform info
303-
lt = LinearTransform()
303+
lt = io.LinearTransform()
304304
lt['sigma'] = 1.
305305
lt['m_L'] = self.matrix
306-
lt['src'] = VolumeGeometry.from_image(moving)
307-
lt['dst'] = VolumeGeometry.from_image(self.reference)
306+
lt['src'] = io.VolumeGeometry.from_image(moving)
307+
lt['dst'] = io.VolumeGeometry.from_image(self.reference)
308308
# to make LTA file format
309-
lta = LinearTransformArray()
309+
lta = io.LinearTransformArray()
310310
lta['type'] = 1 # RAS2RAS
311-
lta['xforms'] = [lt]
311+
lta['xforms'].append(lt)
312312

313313
with open(filename, 'w') as f:
314314
f.write(lta.to_string())
@@ -344,7 +344,7 @@ def load(filename, fmt='X5', reference=None):
344344
# parameters = parameters[:3, :].reshape(-1).tolist()
345345
elif fmt.lower() == 'lta':
346346
with open(filename) as ltafile:
347-
lta = LinearTransformArray.from_fileobj(ltafile)
347+
lta = io.LinearTransformArray.from_fileobj(ltafile)
348348
if lta['nxforms'] > 1:
349349
raise NotImplementedError("Multiple transforms are not yet supported.")
350350
if lta['type'] != 1:

0 commit comments

Comments
 (0)