1313from nibabel .tmpdirs import InTemporaryDirectory
1414
1515from 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 )
1718
1819affine = [[- 1.5 , 0 , 0 , 90 ],
1920 [0 , 1.5 , 0 , - 85 ],
@@ -246,7 +247,7 @@ def test_dtseries():
246247 assert_equal (img2 .nifti_header .get_intent ()[0 ],
247248 'ConnDenseSeries' )
248249 assert_true (isinstance (img2 , ci .Cifti2Image ))
249- assert_true (( img2 .get_data () == data ). all () )
250+ assert_array_equal ( img2 .get_fdata (), data )
250251 check_series_map (img2 .header .matrix .get_index_map (0 ))
251252 check_geometry_map (img2 .header .matrix .get_index_map (1 ))
252253 del img2
@@ -268,7 +269,7 @@ def test_dscalar():
268269 img2 = nib .load ('test.dscalar.nii' )
269270 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDenseScalar' )
270271 assert_true (isinstance (img2 , ci .Cifti2Image ))
271- assert_true (( img2 .get_data () == data ). all () )
272+ assert_array_equal ( img2 .get_fdata (), data )
272273 check_scalar_map (img2 .header .matrix .get_index_map (0 ))
273274 check_geometry_map (img2 .header .matrix .get_index_map (1 ))
274275 del img2
@@ -290,7 +291,7 @@ def test_dlabel():
290291 img2 = nib .load ('test.dlabel.nii' )
291292 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDenseLabel' )
292293 assert_true (isinstance (img2 , ci .Cifti2Image ))
293- assert_true (( img2 .get_data () == data ). all () )
294+ assert_array_equal ( img2 .get_fdata (), data )
294295 check_label_map (img2 .header .matrix .get_index_map (0 ))
295296 check_geometry_map (img2 .header .matrix .get_index_map (1 ))
296297 del img2
@@ -310,7 +311,7 @@ def test_dconn():
310311 img2 = nib .load ('test.dconn.nii' )
311312 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDense' )
312313 assert_true (isinstance (img2 , ci .Cifti2Image ))
313- assert_true (( img2 .get_data () == data ). all () )
314+ assert_array_equal ( img2 .get_fdata (), data )
314315 assert_equal (img2 .header .matrix .get_index_map (0 ),
315316 img2 .header .matrix .get_index_map (1 ))
316317 check_geometry_map (img2 .header .matrix .get_index_map (0 ))
@@ -333,7 +334,7 @@ def test_ptseries():
333334 img2 = nib .load ('test.ptseries.nii' )
334335 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnParcelSries' )
335336 assert_true (isinstance (img2 , ci .Cifti2Image ))
336- assert_true (( img2 .get_data () == data ). all () )
337+ assert_array_equal ( img2 .get_fdata (), data )
337338 check_series_map (img2 .header .matrix .get_index_map (0 ))
338339 check_parcel_map (img2 .header .matrix .get_index_map (1 ))
339340 del img2
@@ -355,7 +356,7 @@ def test_pscalar():
355356 img2 = nib .load ('test.pscalar.nii' )
356357 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnParcelScalr' )
357358 assert_true (isinstance (img2 , ci .Cifti2Image ))
358- assert_true (( img2 .get_data () == data ). all () )
359+ assert_array_equal ( img2 .get_fdata (), data )
359360 check_scalar_map (img2 .header .matrix .get_index_map (0 ))
360361 check_parcel_map (img2 .header .matrix .get_index_map (1 ))
361362 del img2
@@ -377,7 +378,7 @@ def test_pdconn():
377378 img2 = ci .load ('test.pdconn.nii' )
378379 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnParcelDense' )
379380 assert_true (isinstance (img2 , ci .Cifti2Image ))
380- assert_true (( img2 .get_data () == data ). all () )
381+ assert_array_equal ( img2 .get_fdata (), data )
381382 check_geometry_map (img2 .header .matrix .get_index_map (0 ))
382383 check_parcel_map (img2 .header .matrix .get_index_map (1 ))
383384 del img2
@@ -399,7 +400,7 @@ def test_dpconn():
399400 img2 = ci .load ('test.dpconn.nii' )
400401 assert_equal (img2 .nifti_header .get_intent ()[0 ], 'ConnDenseParcel' )
401402 assert_true (isinstance (img2 , ci .Cifti2Image ))
402- assert_true (( img2 .get_data () == data ). all () )
403+ assert_array_equal ( img2 .get_fdata (), data )
403404 check_parcel_map (img2 .header .matrix .get_index_map (0 ))
404405 check_geometry_map (img2 .header .matrix .get_index_map (1 ))
405406 del img2
@@ -420,7 +421,7 @@ def test_plabel():
420421 img2 = ci .load ('test.plabel.nii' )
421422 assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnUnknown' )
422423 assert_true (isinstance (img2 , ci .Cifti2Image ))
423- assert_true (( img2 .get_data () == data ). all () )
424+ assert_array_equal ( img2 .get_fdata (), data )
424425 check_label_map (img2 .header .matrix .get_index_map (0 ))
425426 check_parcel_map (img2 .header .matrix .get_index_map (1 ))
426427 del img2
@@ -440,7 +441,7 @@ def test_pconn():
440441 img2 = ci .load ('test.pconn.nii' )
441442 assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnParcels' )
442443 assert_true (isinstance (img2 , ci .Cifti2Image ))
443- assert_true (( img2 .get_data () == data ). all () )
444+ assert_array_equal ( img2 .get_fdata (), data )
444445 assert_equal (img2 .header .matrix .get_index_map (0 ),
445446 img2 .header .matrix .get_index_map (1 ))
446447 check_parcel_map (img2 .header .matrix .get_index_map (0 ))
@@ -465,7 +466,7 @@ def test_pconnseries():
465466 img2 = ci .load ('test.pconnseries.nii' )
466467 assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnPPSr' )
467468 assert_true (isinstance (img2 , ci .Cifti2Image ))
468- assert_true (( img2 .get_data () == data ). all () )
469+ assert_array_equal ( img2 .get_fdata (), data )
469470 assert_equal (img2 .header .matrix .get_index_map (0 ),
470471 img2 .header .matrix .get_index_map (1 ))
471472 check_parcel_map (img2 .header .matrix .get_index_map (0 ))
@@ -491,7 +492,7 @@ def test_pconnscalar():
491492 img2 = ci .load ('test.pconnscalar.nii' )
492493 assert_equal (img .nifti_header .get_intent ()[0 ], 'ConnPPSc' )
493494 assert_true (isinstance (img2 , ci .Cifti2Image ))
494- assert_true (( img2 .get_data () == data ). all () )
495+ assert_array_equal ( img2 .get_fdata (), data )
495496 assert_equal (img2 .header .matrix .get_index_map (0 ),
496497 img2 .header .matrix .get_index_map (1 ))
497498
0 commit comments