@@ -246,9 +246,11 @@ def test_linear_save(tmpdir, data_path, get_testdata, image_orientation, sw_tool
246
246
247
247
248
248
@pytest .mark .parametrize ("store_inverse" , [True , False ])
249
- def test_Affine_to_x5 (tmpdir , store_inverse ):
249
+ def test_linear_to_x5 (tmpdir , store_inverse ):
250
250
"""Test affine's operations."""
251
251
tmpdir .chdir ()
252
+
253
+ # Test base operations
252
254
aff = nitl .Affine ()
253
255
node = aff .to_x5 (
254
256
metadata = {"GeneratedBy" : "FreeSurfer 8" }, store_inverse = store_inverse
@@ -261,14 +263,21 @@ def test_Affine_to_x5(tmpdir, store_inverse):
261
263
assert node .array_length == 1
262
264
assert (node .metadata or {}).get ("GeneratedBy" ) == "FreeSurfer 8"
263
265
266
+ io .x5 .to_filename ("export1.x5" , [node ], store_inverse = store_inverse )
267
+
268
+ # Test with Domain
264
269
img = nb .Nifti1Image (np .zeros ((2 , 2 , 2 ), dtype = "float32" ), np .eye (4 ))
265
270
img_path = Path (tmpdir ) / "ref.nii.gz"
266
271
img .to_filename (str (img_path ))
267
-
268
272
aff .reference = img_path
269
273
node = aff .to_x5 ()
270
274
assert node .domain .grid
271
275
assert node .domain .size == aff .reference .shape
276
+ io .x5 .to_filename ("export2.x5" , [node ], store_inverse = store_inverse )
277
+
278
+ # Test with Jacobian
279
+ node .jacobian = np .zeros ((2 , 2 , 2 ), dtype = "float32" )
280
+ io .x5 .to_filename ("export3.x5" , [node ], store_inverse = store_inverse )
272
281
273
282
274
283
def test_mapping_to_x5 ():
0 commit comments