@@ -68,10 +68,10 @@ def print_summary(self):
6868
6969
7070class GiftiNVPairs (object ):
71-
71+ """
7272 name = str
7373 value = str
74-
74+ """
7575 def __init__ (self , name = '' , value = '' ):
7676 self .name = name
7777 self .value = value
@@ -104,6 +104,7 @@ def print_summary(self):
104104
105105
106106class GiftiLabel (xml .XmlSerializable ):
107+ """
107108 key = int
108109 label = str
109110 # rgba
@@ -114,6 +115,7 @@ class GiftiLabel(xml.XmlSerializable):
114115 green = float
115116 blue = float
116117 alpha = float
118+ """
117119
118120 def __init__ (self , key = 0 , label = '' , red = None , green = None , blue = None ,
119121 alpha = None ):
@@ -157,9 +159,11 @@ def _arr2txt(arr, elem_fmt):
157159
158160
159161class GiftiCoordSystem (xml .XmlSerializable ):
162+ """
160163 dataspace = int
161164 xformspace = int
162165 xform = np.ndarray # 4x4 numpy array
166+ """
163167
164168 def __init__ (self , dataspace = 0 , xformspace = 0 , xform = None ):
165169 self .dataspace = dataspace
@@ -224,7 +228,7 @@ def _data_tag_element(dataarray, encoding, datatype, ordering):
224228
225229
226230class GiftiDataArray (xml .XmlSerializable ):
227-
231+ """
228232 # These are for documentation only; we don't use these class variables
229233 intent = int
230234 datatype = int
@@ -238,14 +242,30 @@ class GiftiDataArray(xml.XmlSerializable):
238242 data = np.ndarray
239243 coordsys = GiftiCoordSystem
240244 meta = GiftiMetaData
245+ """
241246
242- def __init__ (self , data = None ):
247+ def __init__ (self , data = None ,
248+ encoding = "GIFTI_ENCODING_B64GZ" ,
249+ endian = sys .byteorder ,
250+ coordsys = None ,
251+ ordering = "C" ,
252+ meta = None ):
253+ """
254+ Returns a shell object that cannot be saved.
255+ """
243256 self .data = data
244257 self .dims = []
245- self .meta = GiftiMetaData ()
246- self .coordsys = GiftiCoordSystem ()
258+ self .meta = meta or GiftiMetaData ()
259+ self .coordsys = coordsys or GiftiCoordSystem ()
247260 self .ext_fname = ''
248261 self .ext_offset = ''
262+ self .intent = 0 # required attribute, NIFTI_INTENT_NONE
263+ self .datatype = 0 # required attribute, void/none
264+ # python/numpy default: column major order
265+ self .ind_ord = array_index_order_codes .code [ordering ]
266+ self .encoding = encoding
267+ self .endian = endian
268+
249269
250270 @classmethod
251271 def from_array (klass ,
0 commit comments