13
13
from nibabel .tmpdirs import InTemporaryDirectory
14
14
15
15
from nose .tools import assert_true , assert_equal , assert_raises
16
- from nibabel .testing import clear_and_catch_warnings , error_warnings , suppress_warnings
16
+ from nibabel .testing import (
17
+ clear_and_catch_warnings , error_warnings , suppress_warnings , assert_array_equal )
17
18
18
19
affine = [[- 1.5 , 0 , 0 , 90 ],
19
20
[0 , 1.5 , 0 , - 85 ],
@@ -246,7 +247,7 @@ def test_dtseries():
246
247
assert_equal (img2 .nifti_header .get_intent ()[0 ],
247
248
'ConnDenseSeries' )
248
249
assert_true (isinstance (img2 , ci .Cifti2Image ))
249
- assert_true (( img2 .get_data () == data ). all () )
250
+ assert_array_equal ( img2 .get_fdata (), data )
250
251
check_series_map (img2 .header .matrix .get_index_map (0 ))
251
252
check_geometry_map (img2 .header .matrix .get_index_map (1 ))
252
253
del img2
@@ -268,7 +269,7 @@ def test_dscalar():
268
269
img2 = nib .load ('test.dscalar.nii' )
269
270
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDenseScalar' )
270
271
assert_true (isinstance (img2 , ci .Cifti2Image ))
271
- assert_true (( img2 .get_data () == data ). all () )
272
+ assert_array_equal ( img2 .get_fdata (), data )
272
273
check_scalar_map (img2 .header .matrix .get_index_map (0 ))
273
274
check_geometry_map (img2 .header .matrix .get_index_map (1 ))
274
275
del img2
@@ -290,7 +291,7 @@ def test_dlabel():
290
291
img2 = nib .load ('test.dlabel.nii' )
291
292
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDenseLabel' )
292
293
assert_true (isinstance (img2 , ci .Cifti2Image ))
293
- assert_true (( img2 .get_data () == data ). all () )
294
+ assert_array_equal ( img2 .get_fdata (), data )
294
295
check_label_map (img2 .header .matrix .get_index_map (0 ))
295
296
check_geometry_map (img2 .header .matrix .get_index_map (1 ))
296
297
del img2
@@ -310,7 +311,7 @@ def test_dconn():
310
311
img2 = nib .load ('test.dconn.nii' )
311
312
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDense' )
312
313
assert_true (isinstance (img2 , ci .Cifti2Image ))
313
- assert_true (( img2 .get_data () == data ). all () )
314
+ assert_array_equal ( img2 .get_fdata (), data )
314
315
assert_equal (img2 .header .matrix .get_index_map (0 ),
315
316
img2 .header .matrix .get_index_map (1 ))
316
317
check_geometry_map (img2 .header .matrix .get_index_map (0 ))
@@ -333,7 +334,7 @@ def test_ptseries():
333
334
img2 = nib .load ('test.ptseries.nii' )
334
335
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnParcelSries' )
335
336
assert_true (isinstance (img2 , ci .Cifti2Image ))
336
- assert_true (( img2 .get_data () == data ). all () )
337
+ assert_array_equal ( img2 .get_fdata (), data )
337
338
check_series_map (img2 .header .matrix .get_index_map (0 ))
338
339
check_parcel_map (img2 .header .matrix .get_index_map (1 ))
339
340
del img2
@@ -355,7 +356,7 @@ def test_pscalar():
355
356
img2 = nib .load ('test.pscalar.nii' )
356
357
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnParcelScalr' )
357
358
assert_true (isinstance (img2 , ci .Cifti2Image ))
358
- assert_true (( img2 .get_data () == data ). all () )
359
+ assert_array_equal ( img2 .get_fdata (), data )
359
360
check_scalar_map (img2 .header .matrix .get_index_map (0 ))
360
361
check_parcel_map (img2 .header .matrix .get_index_map (1 ))
361
362
del img2
@@ -377,7 +378,7 @@ def test_pdconn():
377
378
img2 = ci .load ('test.pdconn.nii' )
378
379
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnParcelDense' )
379
380
assert_true (isinstance (img2 , ci .Cifti2Image ))
380
- assert_true (( img2 .get_data () == data ). all () )
381
+ assert_array_equal ( img2 .get_fdata (), data )
381
382
check_geometry_map (img2 .header .matrix .get_index_map (0 ))
382
383
check_parcel_map (img2 .header .matrix .get_index_map (1 ))
383
384
del img2
@@ -399,7 +400,7 @@ def test_dpconn():
399
400
img2 = ci .load ('test.dpconn.nii' )
400
401
assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDenseParcel' )
401
402
assert_true (isinstance (img2 , ci .Cifti2Image ))
402
- assert_true (( img2 .get_data () == data ). all () )
403
+ assert_array_equal ( img2 .get_fdata (), data )
403
404
check_parcel_map (img2 .header .matrix .get_index_map (0 ))
404
405
check_geometry_map (img2 .header .matrix .get_index_map (1 ))
405
406
del img2
@@ -420,7 +421,7 @@ def test_plabel():
420
421
img2 = ci .load ('test.plabel.nii' )
421
422
assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnUnknown' )
422
423
assert_true (isinstance (img2 , ci .Cifti2Image ))
423
- assert_true (( img2 .get_data () == data ). all () )
424
+ assert_array_equal ( img2 .get_fdata (), data )
424
425
check_label_map (img2 .header .matrix .get_index_map (0 ))
425
426
check_parcel_map (img2 .header .matrix .get_index_map (1 ))
426
427
del img2
@@ -440,7 +441,7 @@ def test_pconn():
440
441
img2 = ci .load ('test.pconn.nii' )
441
442
assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnParcels' )
442
443
assert_true (isinstance (img2 , ci .Cifti2Image ))
443
- assert_true (( img2 .get_data () == data ). all () )
444
+ assert_array_equal ( img2 .get_fdata (), data )
444
445
assert_equal (img2 .header .matrix .get_index_map (0 ),
445
446
img2 .header .matrix .get_index_map (1 ))
446
447
check_parcel_map (img2 .header .matrix .get_index_map (0 ))
@@ -465,7 +466,7 @@ def test_pconnseries():
465
466
img2 = ci .load ('test.pconnseries.nii' )
466
467
assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnPPSr' )
467
468
assert_true (isinstance (img2 , ci .Cifti2Image ))
468
- assert_true (( img2 .get_data () == data ). all () )
469
+ assert_array_equal ( img2 .get_fdata (), data )
469
470
assert_equal (img2 .header .matrix .get_index_map (0 ),
470
471
img2 .header .matrix .get_index_map (1 ))
471
472
check_parcel_map (img2 .header .matrix .get_index_map (0 ))
@@ -491,7 +492,7 @@ def test_pconnscalar():
491
492
img2 = ci .load ('test.pconnscalar.nii' )
492
493
assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnPPSc' )
493
494
assert_true (isinstance (img2 , ci .Cifti2Image ))
494
- assert_true (( img2 .get_data () == data ). all () )
495
+ assert_array_equal ( img2 .get_fdata (), data )
495
496
assert_equal (img2 .header .matrix .get_index_map (0 ),
496
497
img2 .header .matrix .get_index_map (1 ))
497
498
0 commit comments