@@ -224,9 +224,9 @@ def from_array(klass,
224
224
intent ,
225
225
datatype = None ,
226
226
encoding = "GIFTI_ENCODING_B64GZ" ,
227
- endian = "GIFTI_ENDIAN_LITTLE" ,
227
+ endian = sys . byteorder ,
228
228
coordsys = None ,
229
- ordering = "RowMajorOrder " ,
229
+ ordering = "C " ,
230
230
meta = None ):
231
231
""" Creates a new Gifti data array
232
232
@@ -235,33 +235,35 @@ def from_array(klass,
235
235
darray : ndarray
236
236
NumPy data array
237
237
intent : string
238
- NIFTI intent codes , see util .intent_codes
239
- datatype : string
240
- NIFTI data type codes, see util .data_type_codes
238
+ NIFTI intent code , see nifti1 .intent_codes
239
+ datatype : None or string, optional
240
+ NIFTI data type codes, see nifti1 .data_type_codes
241
241
If None, the datatype of the NumPy array is taken.
242
- encoding : string, default: GIFTI_ENCODING_B64GZ
243
- Encoding of the data, see util.gifti_encoding_codes
244
- endian : string, default: GIFTI_ENDIAN_LITTLE
245
- The Endianness to store the data array.
246
- Should correspond to the machine endianness.
242
+ encoding : string, optionaal
243
+ Encoding of the data, see util.gifti_encoding_codes;
244
+ default: GIFTI_ENCODING_B64GZ
245
+ endian : string, optional
246
+ The Endianness to store the data array. Should correspond to the
247
+ machine endianness. default: system byteorder
247
248
coordsys : GiftiCoordSystem, optional
248
249
If None, a identity transformation is taken.
249
- ordering : string, default: RowMajorOrder
250
- The ordering of the array. see util.array_index_order_codes
250
+ ordering : string, optional
251
+ The ordering of the array. see util.array_index_order_codes;
252
+ default: RowMajorOrder - C ordering
251
253
meta : None or dict, optional
252
254
A dictionary for metadata information. If None, gives empty dict.
253
255
254
256
Returns
255
257
-------
256
- da : instance of class `klass`
258
+ da : instance of our own class
257
259
"""
258
260
if meta is None :
259
261
meta = {}
260
262
cda = klass (darray )
261
263
cda .num_dim = len (darray .shape )
262
264
cda .dims = list (darray .shape )
263
265
if datatype == None :
264
- cda .datatype = data_type_codes .code [darray .dtype . type ]
266
+ cda .datatype = data_type_codes .code [darray .dtype ]
265
267
else :
266
268
cda .datatype = data_type_codes .code [datatype ]
267
269
cda .intent = intent_codes .code [intent ]
@@ -271,7 +273,6 @@ def from_array(klass,
271
273
cda .coordsys = coordsys
272
274
cda .ind_ord = array_index_order_codes .code [ordering ]
273
275
cda .meta = GiftiMetaData .from_dict (meta )
274
-
275
276
return cda
276
277
277
278
def to_xml (self ):
0 commit comments