@@ -252,20 +252,20 @@ def __init__(self, name, voxel=None, vertex=None, affine=None,
252
252
253
253
Parameters
254
254
----------
255
- name : str or np.ndarray
255
+ name : array_like
256
256
brain structure name or (N, ) string array with the brain structure names
257
- voxel : np.ndarray
257
+ voxel : array_like, optional
258
258
(N, 3) array with the voxel indices (can be omitted for CIFTI-2 files only
259
259
covering the surface)
260
- vertex : np.ndarray
260
+ vertex : array_like, optional
261
261
(N, ) array with the vertex indices (can be omitted for volumetric CIFTI-2 files)
262
- affine : np.ndarray
262
+ affine : array_like, optional
263
263
(4, 4) array mapping voxel indices to mm space (not needed for CIFTI-2 files only
264
264
covering the surface)
265
- volume_shape : tuple of three integers
265
+ volume_shape : tuple of three integers, optional
266
266
shape of the volume in which the voxels were defined (not needed for CIFTI-2 files only
267
267
covering the surface)
268
- nvertices : dict from string to integer
268
+ nvertices : dict from string to integer, optional
269
269
maps names of surface elements to integers (not needed for volumetric CIFTI-2 files)
270
270
"""
271
271
if voxel is None :
@@ -304,7 +304,7 @@ def __init__(self, name, voxel=None, vertex=None, affine=None,
304
304
if affine is None or volume_shape is None :
305
305
raise ValueError ("Affine and volume shape should be defined "
306
306
"for BrainModelAxis containing voxels" )
307
- self .affine = affine
307
+ self .affine = np . asanyarray ( affine )
308
308
self .volume_shape = volume_shape
309
309
310
310
if np .any (self .vertex [surface_mask ] < 0 ):
@@ -325,12 +325,12 @@ def from_mask(cls, mask, name='other', affine=None):
325
325
326
326
Parameters
327
327
----------
328
- mask : np.ndarray
328
+ mask : array_like
329
329
all non-zero voxels will be included in the BrainModelAxis axis
330
330
should be (Nx, Ny, Nz) array for volume mask or (Nvertex, ) array for surface mask
331
- name : str
331
+ name : str, optional
332
332
Name of the brain structure (e.g. 'CortexRight', 'thalamus_left' or 'brain_stem')
333
- affine : np.ndarray
333
+ affine : array_like, optional
334
334
(4, 4) array with the voxel to mm transformation (defaults to identity matrix)
335
335
Argument will be ignored for surface masks
336
336
@@ -362,7 +362,7 @@ def from_surface(cls, vertices, nvertex, name='Other'):
362
362
363
363
Parameters
364
364
----------
365
- vertices : np.ndarray
365
+ vertices : array_like
366
366
indices of the vertices on the surface
367
367
nvertex : int
368
368
total number of vertices on the surface
@@ -384,7 +384,7 @@ def from_index_mapping(cls, mim):
384
384
385
385
Parameters
386
386
----------
387
- mim : cifti2.Cifti2MatrixIndicesMap
387
+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
388
388
389
389
Returns
390
390
-------
@@ -422,7 +422,7 @@ def to_mapping(self, dim):
422
422
423
423
Returns
424
424
-------
425
- cifti2.Cifti2MatrixIndicesMap
425
+ :class:`. cifti2.Cifti2MatrixIndicesMap`
426
426
"""
427
427
mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_BRAIN_MODELS' )
428
428
for name , to_slice , bm in self .iter_structures ():
@@ -720,22 +720,22 @@ def __init__(self, name, voxels, vertices, affine=None, volume_shape=None, nvert
720
720
721
721
Parameters
722
722
----------
723
- name : np.ndarray
723
+ name : array_like
724
724
(N, ) string array with the parcel names
725
- voxels : np.ndarray
725
+ voxels : array_like
726
726
(N, ) object array each containing a sequence of voxels.
727
727
For each parcel the voxels are represented by a (M, 3) index array
728
- vertices : np.ndarray
728
+ vertices : array_like
729
729
(N, ) object array each containing a sequence of vertices.
730
730
For each parcel the vertices are represented by a mapping from brain structure name to
731
731
(M, ) index array
732
- affine : np.ndarray
732
+ affine : array_like, optional
733
733
(4, 4) array mapping voxel indices to mm space (not needed for CIFTI-2 files only
734
734
covering the surface)
735
- volume_shape : tuple of three integers
735
+ volume_shape : tuple of three integers, optional
736
736
shape of the volume in which the voxels were defined (not needed for CIFTI-2 files only
737
737
covering the surface)
738
- nvertices : dict[String -> int]
738
+ nvertices : dict from string to integer, optional
739
739
maps names of surface elements to integers (not needed for volumetric CIFTI-2 files)
740
740
"""
741
741
self .name = np .asanyarray (name , dtype = 'U' )
@@ -748,7 +748,7 @@ def __init__(self, name, voxels, vertices, affine=None, volume_shape=None, nvert
748
748
voxels [idx ] = as_array [idx ]
749
749
self .voxels = np .asanyarray (voxels , dtype = 'object' )
750
750
self .vertices = np .asanyarray (vertices , dtype = 'object' )
751
- self .affine = affine
751
+ self .affine = np . asanyarray ( affine ) if affine is not None else None
752
752
self .volume_shape = volume_shape
753
753
if nvertices is None :
754
754
self .nvertices = {}
@@ -813,7 +813,7 @@ def from_index_mapping(cls, mim):
813
813
814
814
Parameters
815
815
----------
816
- mim : cifti2.Cifti2MatrixIndicesMap
816
+ mim : :class:` cifti2.Cifti2MatrixIndicesMap`
817
817
818
818
Returns
819
819
-------
@@ -859,7 +859,7 @@ def to_mapping(self, dim):
859
859
860
860
Returns
861
861
-------
862
- cifti2.Cifti2MatrixIndicesMap
862
+ :class:` cifti2.Cifti2MatrixIndicesMap`
863
863
"""
864
864
mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_PARCELS' )
865
865
if self .affine is not None :
@@ -1008,7 +1008,8 @@ def get_element(self, index):
1008
1008
tuple with 3 elements
1009
1009
- unicode name of the parcel
1010
1010
- (M, 3) int array with voxel indices
1011
- - Dict[String -> (K, ) int array] with vertex indices for a specific surface brain structure
1011
+ - dict from string to (K, ) int array with vertex indices
1012
+ for a specific surface brain structure
1012
1013
"""
1013
1014
return self .name [index ], self .voxels [index ], self .vertices [index ]
1014
1015
@@ -1023,9 +1024,9 @@ def __init__(self, name, meta=None):
1023
1024
"""
1024
1025
Parameters
1025
1026
----------
1026
- name : np.ndarray of string
1027
+ name : array_like
1027
1028
(N, ) string array with the parcel names
1028
- meta : np.ndarray of dict
1029
+ meta : array_like
1029
1030
(N, ) object array with a dictionary of metadata for each row/column.
1030
1031
Defaults to empty dictionary
1031
1032
"""
@@ -1046,7 +1047,7 @@ def from_index_mapping(cls, mim):
1046
1047
1047
1048
Parameters
1048
1049
----------
1049
- mim : cifti2.Cifti2MatrixIndicesMap
1050
+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
1050
1051
1051
1052
Returns
1052
1053
-------
@@ -1067,7 +1068,7 @@ def to_mapping(self, dim):
1067
1068
1068
1069
Returns
1069
1070
-------
1070
- cifti2.Cifti2MatrixIndicesMap
1071
+ :class:`. cifti2.Cifti2MatrixIndicesMap`
1071
1072
"""
1072
1073
mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_SCALARS' )
1073
1074
for name , meta in zip (self .name , self .meta ):
@@ -1151,13 +1152,13 @@ def __init__(self, name, label, meta=None):
1151
1152
"""
1152
1153
Parameters
1153
1154
----------
1154
- name : np.ndarray
1155
+ name : array_like
1155
1156
(N, ) string array with the parcel names
1156
- label : np.ndarray
1157
+ label : array_like
1157
1158
single dictionary or (N, ) object array with dictionaries mapping
1158
1159
from integers to (name, (R, G, B, A)), where name is a string and R, G, B, and A are
1159
1160
floats between 0 and 1 giving the colour and alpha (i.e., transparency)
1160
- meta : np.ndarray
1161
+ meta : array_like, optional
1161
1162
(N, ) object array with a dictionary of metadata for each row/column
1162
1163
"""
1163
1164
self .name = np .asanyarray (name , dtype = 'U' )
@@ -1180,7 +1181,7 @@ def from_index_mapping(cls, mim):
1180
1181
1181
1182
Parameters
1182
1183
----------
1183
- mim : cifti2.Cifti2MatrixIndicesMap
1184
+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
1184
1185
1185
1186
Returns
1186
1187
-------
@@ -1202,7 +1203,7 @@ def to_mapping(self, dim):
1202
1203
1203
1204
Returns
1204
1205
-------
1205
- cifti2.Cifti2MatrixIndicesMap
1206
+ :class:`. cifti2.Cifti2MatrixIndicesMap`
1206
1207
"""
1207
1208
mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_LABELS' )
1208
1209
for name , label , meta in zip (self .name , self .label , self .meta ):
@@ -1324,7 +1325,7 @@ def from_index_mapping(cls, mim):
1324
1325
1325
1326
Parameters
1326
1327
----------
1327
- mim : cifti2.Cifti2MatrixIndicesMap
1328
+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
1328
1329
1329
1330
Returns
1330
1331
-------
@@ -1345,7 +1346,7 @@ def to_mapping(self, dim):
1345
1346
1346
1347
Returns
1347
1348
-------
1348
- cifti2.Cifti2MatrixIndicesMap
1349
+ :class:` cifti2.Cifti2MatrixIndicesMap`
1349
1350
"""
1350
1351
mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_SERIES' )
1351
1352
mim .series_exponent = 0
0 commit comments