@@ -419,14 +419,15 @@ class GiftiImage(xml.XmlSerializable, FileBasedImage):
419
419
valid_exts = ('.gii' ,)
420
420
files_types = (('image' , '.gii' ),)
421
421
422
+ # The parser will in due course be a GiftiImageParser, but we can't set
423
+ # that now, because it would result in a circular import. We set it after
424
+ # the class has been defined, at the end of the class definition.
425
+ parser = None
426
+
422
427
def __init__ (self , header = None , extra = None , file_map = None , meta = None ,
423
428
labeltable = None , darrays = None , version = "1.0" ):
424
429
super (GiftiImage , self ).__init__ (header = header , extra = extra ,
425
430
file_map = file_map )
426
- # placed here temporarily for git diff purposes
427
- from .parse_gifti_fast import GiftiImageParser
428
- GiftiImage .parser = GiftiImageParser
429
-
430
431
if darrays is None :
431
432
darrays = []
432
433
if meta is None :
@@ -606,3 +607,8 @@ def from_filename(klass, filename, buffer_size=35000000):
606
607
file_map = klass .filespec_to_file_map (filename )
607
608
img = klass .from_file_map (file_map , buffer_size = buffer_size )
608
609
return img
610
+
611
+
612
+ # Now GiftiImage is defined, we can import the parser module and set the parser
613
+ from .parse_gifti_fast import GiftiImageParser
614
+ GiftiImage .parser = GiftiImageParser
0 commit comments