|
17 | 17 | from nibabel.affines import from_matvec, voxel_sizes, obliquity
|
18 | 18 | from .base import TransformBase
|
19 | 19 | from .patched import shape_zoom_affine
|
20 |
| -from .io import LinearTransformArray, LinearTransform, VolumeGeometry |
| 20 | +from . import io |
21 | 21 |
|
22 | 22 |
|
23 | 23 | LPS = np.diag([-1, -1, 1, 1])
|
@@ -300,15 +300,15 @@ def to_filename(self, filename, fmt='X5', moving=None):
|
300 | 300 | return filename
|
301 | 301 | elif fmt.lower() == 'lta':
|
302 | 302 | # xform info
|
303 |
| - lt = LinearTransform() |
| 303 | + lt = io.LinearTransform() |
304 | 304 | lt['sigma'] = 1.
|
305 | 305 | 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) |
308 | 308 | # to make LTA file format
|
309 |
| - lta = LinearTransformArray() |
| 309 | + lta = io.LinearTransformArray() |
310 | 310 | lta['type'] = 1 # RAS2RAS
|
311 |
| - lta['xforms'] = [lt] |
| 311 | + lta['xforms'].append(lt) |
312 | 312 |
|
313 | 313 | with open(filename, 'w') as f:
|
314 | 314 | f.write(lta.to_string())
|
@@ -344,7 +344,7 @@ def load(filename, fmt='X5', reference=None):
|
344 | 344 | # parameters = parameters[:3, :].reshape(-1).tolist()
|
345 | 345 | elif fmt.lower() == 'lta':
|
346 | 346 | with open(filename) as ltafile:
|
347 |
| - lta = LinearTransformArray.from_fileobj(ltafile) |
| 347 | + lta = io.LinearTransformArray.from_fileobj(ltafile) |
348 | 348 | if lta['nxforms'] > 1:
|
349 | 349 | raise NotImplementedError("Multiple transforms are not yet supported.")
|
350 | 350 | if lta['type'] != 1:
|
|
0 commit comments