File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ def load(filename):
39
39
img : ``SpatialImage``
40
40
Image of guessed type
41
41
'''
42
- return guessed_image_type (filename ).from_filename (filename )
42
+
43
+ img = guessed_image_type (filename ).from_filename (filename )
44
+ if isinstance (img , Nifti2Image ):
45
+ if img .is_cifti :
46
+ return img .as_cifti ()
47
+ return img
43
48
44
49
45
50
def guessed_image_type (filename ):
Original file line number Diff line number Diff line change @@ -232,18 +232,17 @@ class Nifti2Pair(Nifti1Pair):
232
232
class Nifti2Image (Nifti1Image ):
233
233
header_class = Nifti2Header
234
234
235
- @classmethod
236
- def from_file_map (klass , file_map ):
237
- img = super (Nifti2Image , klass ).from_file_map (file_map )
238
- hdr = img .get_header ()
235
+ @property
236
+ def is_cifti (self ):
237
+ hdr = self .get_header ()
239
238
intent_code = hdr .get_intent ('code' )[0 ]
240
- img . is_cifti = False
239
+ cifti_header = False
241
240
if intent_code >= 3000 and intent_code < 3100 :
242
- img .is_cifti = True
243
- img = img .to_cifti ()
244
- return img
241
+ cifti_header = True
242
+ return cifti_header
245
243
246
- def to_cifti (self ):
244
+ def as_cifti (self ):
245
+ """Convert NIFTI-2 file to CIFTI"""
247
246
if not self .is_cifti :
248
247
TypeError ('Nifti2 image is not a CIFTI file' )
249
248
hdr = self .get_header ()
You can’t perform that action at this time.
0 commit comments