@@ -213,13 +213,14 @@ def test_dtseries():
213
213
hdr = ci .Cifti2Header (matrix )
214
214
data = np .random .randn (13 , 9 )
215
215
img = ci .Cifti2Image (data , hdr )
216
- with assert_raises (ValueError ):
217
- img .to_filename ('test.dtseries.nii' )
216
+ print (img .nifti_header .get_intent ())
218
217
img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_SERIES' )
219
218
220
219
with InTemporaryDirectory ():
221
220
ci .save (img , 'test.dtseries.nii' )
222
221
img2 = nib .load ('test.dtseries.nii' )
222
+ assert_true (img2 .nifti_header .get_intent ()[0 ]
223
+ == 'dense data series/fiber fans' )
223
224
assert_true (isinstance (img2 , ci .Cifti2Image ))
224
225
assert_true ((img2 .get_data () == data ).all ())
225
226
check_series_map (img2 .header .matrix .get_index_map (0 ))
@@ -236,13 +237,12 @@ def test_dscalar():
236
237
hdr = ci .Cifti2Header (matrix )
237
238
data = np .random .randn (2 , 9 )
238
239
img = ci .Cifti2Image (data , hdr )
239
- with assert_raises (ValueError ):
240
- nib .save (img , 'test.dscalar.nii' )
241
240
img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_SCALARS' )
242
241
243
242
with InTemporaryDirectory ():
244
243
ci .save (img , 'test.dscalar.nii' )
245
244
img2 = nib .load ('test.dscalar.nii' )
245
+ assert_true (img2 .nifti_header .get_intent ()[0 ] == 'dense scalar' )
246
246
assert_true (isinstance (img2 , ci .Cifti2Image ))
247
247
assert_true ((img2 .get_data () == data ).all ())
248
248
check_scalar_map (img2 .header .matrix .get_index_map (0 ))
@@ -259,13 +259,12 @@ def test_dlabel():
259
259
hdr = ci .Cifti2Header (matrix )
260
260
data = np .random .randn (2 , 9 )
261
261
img = ci .Cifti2Image (data , hdr )
262
- with assert_raises (ValueError ):
263
- ci .save (img , 'test.dlabel.nii' )
264
262
img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_LABELS' )
265
263
266
264
with InTemporaryDirectory ():
267
265
ci .save (img , 'test.dlabel.nii' )
268
266
img2 = nib .load ('test.dlabel.nii' )
267
+ assert_true (img2 .nifti_header .get_intent ()[0 ] == 'dense label' )
269
268
assert_true (isinstance (img2 , ci .Cifti2Image ))
270
269
assert_true ((img2 .get_data () == data ).all ())
271
270
check_label_map (img2 .header .matrix .get_index_map (0 ))
@@ -285,6 +284,7 @@ def test_dconn():
285
284
with InTemporaryDirectory ():
286
285
ci .save (img , 'test.dconn.nii' )
287
286
img2 = nib .load ('test.dconn.nii' )
287
+ assert_true (img2 .nifti_header .get_intent ()[0 ] == 'dense connectivity' )
288
288
assert_true (isinstance (img2 , ci .Cifti2Image ))
289
289
assert_true ((img2 .get_data () == data ).all ())
290
290
assert_equal (img2 .header .matrix .get_index_map (0 ),
@@ -307,6 +307,8 @@ def test_ptseries():
307
307
with InTemporaryDirectory ():
308
308
ci .save (img , 'test.ptseries.nii' )
309
309
img2 = nib .load ('test.ptseries.nii' )
310
+ assert_true (img2 .nifti_header .get_intent ()[0 ]
311
+ == 'parcellated data series' )
310
312
assert_true (isinstance (img2 , ci .Cifti2Image ))
311
313
assert_true ((img2 .get_data () == data ).all ())
312
314
check_series_map (img2 .header .matrix .get_index_map (0 ))
@@ -328,6 +330,7 @@ def test_pscalar():
328
330
with InTemporaryDirectory ():
329
331
ci .save (img , 'test.pscalar.nii' )
330
332
img2 = nib .load ('test.pscalar.nii' )
333
+ assert_true (img2 .nifti_header .get_intent ()[0 ] == 'parcellated scalar' )
331
334
assert_true (isinstance (img2 , ci .Cifti2Image ))
332
335
assert_true ((img2 .get_data () == data ).all ())
333
336
check_scalar_map (img2 .header .matrix .get_index_map (0 ))
@@ -344,11 +347,13 @@ def test_pdconn():
344
347
hdr = ci .Cifti2Header (matrix )
345
348
data = np .random .randn (2 , 3 )
346
349
img = ci .Cifti2Image (data , hdr )
347
- img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_PARCELLATED ' )
350
+ img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_PARCELLATED_DENSE ' )
348
351
349
352
with InTemporaryDirectory ():
350
353
ci .save (img , 'test.pdconn.nii' )
351
354
img2 = ci .load ('test.pdconn.nii' )
355
+ assert_true (img2 .nifti_header .get_intent ()[0 ]
356
+ == 'parcellated dense connectivity' )
352
357
assert_true (isinstance (img2 , ci .Cifti2Image ))
353
358
assert_true ((img2 .get_data () == data ).all ())
354
359
check_geometry_map (img2 .header .matrix .get_index_map (0 ))
@@ -370,6 +375,8 @@ def test_dpconn():
370
375
with InTemporaryDirectory ():
371
376
ci .save (img , 'test.dpconn.nii' )
372
377
img2 = ci .load ('test.dpconn.nii' )
378
+ assert_true (img2 .nifti_header .get_intent ()[0 ]
379
+ == 'dense parcellated connectivity' )
373
380
assert_true (isinstance (img2 , ci .Cifti2Image ))
374
381
assert_true ((img2 .get_data () == data ).all ())
375
382
check_parcel_map (img2 .header .matrix .get_index_map (0 ))
@@ -386,11 +393,12 @@ def test_plabel():
386
393
hdr = ci .Cifti2Header (matrix )
387
394
data = np .random .randn (2 , 3 )
388
395
img = ci .Cifti2Image (data , hdr )
389
- img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_UNKNOWN' )
390
396
391
397
with InTemporaryDirectory ():
392
398
ci .save (img , 'test.plabel.nii' )
393
399
img2 = ci .load ('test.plabel.nii' )
400
+ assert_true (img .nifti_header .get_intent ()[0 ]
401
+ == 'dense fiber/fan samples' )
394
402
assert_true (isinstance (img2 , ci .Cifti2Image ))
395
403
assert_true ((img2 .get_data () == data ).all ())
396
404
check_label_map (img2 .header .matrix .get_index_map (0 ))
@@ -410,6 +418,8 @@ def test_pconn():
410
418
with InTemporaryDirectory ():
411
419
ci .save (img , 'test.pconn.nii' )
412
420
img2 = ci .load ('test.pconn.nii' )
421
+ assert_true (img .nifti_header .get_intent ()[0 ]
422
+ == 'parcellated connectivity' )
413
423
assert_true (isinstance (img2 , ci .Cifti2Image ))
414
424
assert_true ((img2 .get_data () == data ).all ())
415
425
assert_equal (img2 .header .matrix .get_index_map (0 ),
@@ -433,6 +443,8 @@ def test_pconnseries():
433
443
with InTemporaryDirectory ():
434
444
ci .save (img , 'test.pconnseries.nii' )
435
445
img2 = ci .load ('test.pconnseries.nii' )
446
+ assert_true (img .nifti_header .get_intent ()[0 ]
447
+ == 'parcellated connectivity series' )
436
448
assert_true (isinstance (img2 , ci .Cifti2Image ))
437
449
assert_true ((img2 .get_data () == data ).all ())
438
450
assert_equal (img2 .header .matrix .get_index_map (0 ),
@@ -457,6 +469,8 @@ def test_pconnscalar():
457
469
with InTemporaryDirectory ():
458
470
ci .save (img , 'test.pconnscalar.nii' )
459
471
img2 = ci .load ('test.pconnscalar.nii' )
472
+ assert_true (img .nifti_header .get_intent ()[0 ]
473
+ == 'parcellated connectivity scalar' )
460
474
assert_true (isinstance (img2 , ci .Cifti2Image ))
461
475
assert_true ((img2 .get_data () == data ).all ())
462
476
assert_equal (img2 .header .matrix .get_index_map (0 ),
0 commit comments