@@ -68,10 +68,10 @@ def print_summary(self):
68
68
69
69
70
70
class GiftiNVPairs (object ):
71
-
71
+ """
72
72
name = str
73
73
value = str
74
-
74
+ """
75
75
def __init__ (self , name = '' , value = '' ):
76
76
self .name = name
77
77
self .value = value
@@ -104,6 +104,7 @@ def print_summary(self):
104
104
105
105
106
106
class GiftiLabel (xml .XmlSerializable ):
107
+ """
107
108
key = int
108
109
label = str
109
110
# rgba
@@ -114,6 +115,7 @@ class GiftiLabel(xml.XmlSerializable):
114
115
green = float
115
116
blue = float
116
117
alpha = float
118
+ """
117
119
118
120
def __init__ (self , key = 0 , label = '' , red = None , green = None , blue = None ,
119
121
alpha = None ):
@@ -157,9 +159,11 @@ def _arr2txt(arr, elem_fmt):
157
159
158
160
159
161
class GiftiCoordSystem (xml .XmlSerializable ):
162
+ """
160
163
dataspace = int
161
164
xformspace = int
162
165
xform = np.ndarray # 4x4 numpy array
166
+ """
163
167
164
168
def __init__ (self , dataspace = 0 , xformspace = 0 , xform = None ):
165
169
self .dataspace = dataspace
@@ -224,7 +228,7 @@ def _data_tag_element(dataarray, encoding, datatype, ordering):
224
228
225
229
226
230
class GiftiDataArray (xml .XmlSerializable ):
227
-
231
+ """
228
232
# These are for documentation only; we don't use these class variables
229
233
intent = int
230
234
datatype = int
@@ -238,14 +242,30 @@ class GiftiDataArray(xml.XmlSerializable):
238
242
data = np.ndarray
239
243
coordsys = GiftiCoordSystem
240
244
meta = GiftiMetaData
245
+ """
241
246
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
+ """
243
256
self .data = data
244
257
self .dims = []
245
- self .meta = GiftiMetaData ()
246
- self .coordsys = GiftiCoordSystem ()
258
+ self .meta = meta or GiftiMetaData ()
259
+ self .coordsys = coordsys or GiftiCoordSystem ()
247
260
self .ext_fname = ''
248
261
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
+
249
269
250
270
@classmethod
251
271
def from_array (klass ,
0 commit comments