@@ -80,6 +80,39 @@ def test_LinearTransform(tmpdir):
80
80
for vol in ("src" , "dst" ):
81
81
assert lt [vol ]["valid" ] == 0
82
82
83
+ lta_text = """\
84
+ # LTA file created by NiTransforms
85
+ type = 1
86
+ nxforms = 1
87
+ mean = 0.0000 0.0000 0.0000
88
+ sigma = 1.0000
89
+ 1 4 4
90
+ 1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00
91
+ 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00
92
+ 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
93
+ 0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00
94
+ src volume info
95
+ valid = 1 # volume info valid
96
+ filename = file.nii.gz
97
+ volume = 57 67 56
98
+ voxelsize = 2.750000000000000e+00 2.750000000000000e+00 2.750000000000000e+00
99
+ xras = -1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00
100
+ yras = 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
101
+ zras = 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00
102
+ cras = -2.375000000000000e+00 1.125000000000000e+00 -1.400000000000000e+01
103
+ dst volume info
104
+ valid = 1 # volume info valid
105
+ filename = file.nii.gz
106
+ volume = 57 67 56
107
+ voxelsize = 2.750000000000000e+00 2.750000000000000e+00 2.750000000000000e+00
108
+ xras = -1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00
109
+ yras = 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
110
+ zras = 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00
111
+ cras = -2.375000000000000e+00 1.125000000000000e+00 -1.400000000000000e+01
112
+ """
113
+ xfm = LT .from_string (lta_text )
114
+ assert xfm .to_string () == lta_text
115
+
83
116
84
117
def test_LinearTransformArray (tmpdir , data_path ):
85
118
lta = LTA ()
@@ -177,12 +210,10 @@ def test_Linear_common(tmpdir, data_path, sw, image_orientation, get_testdata):
177
210
xfm = factory .from_fileobj (f )
178
211
179
212
# Test to_string
180
- if (sw , image_orientation ) != ("fs" , "oblique" ): # Rounding errors
181
- assert fs ._drop_comments (text ) == fs ._drop_comments (xfm .to_string ())
213
+ assert fs ._drop_comments (text ) == fs ._drop_comments (xfm .to_string ())
182
214
183
215
xfm .to_filename (fname )
184
- if (sw , image_orientation ) != ("fs" , "oblique" ): # Rounding errors
185
- assert filecmp .cmp (fname , str ((data_path / fname ).resolve ()))
216
+ assert filecmp .cmp (fname , str ((data_path / fname ).resolve ()))
186
217
187
218
# Test from_ras
188
219
RAS = from_matvec (euler2mat (x = 0.9 , y = 0.001 , z = 0.001 ), [4.0 , 2.0 , - 1.0 ])
0 commit comments