@@ -252,20 +252,20 @@ def __init__(self, name, voxel=None, vertex=None, affine=None,
252252
253253 Parameters
254254 ----------
255- name : str or np.ndarray
255+ name : array_like
256256 brain structure name or (N, ) string array with the brain structure names
257- voxel : np.ndarray
257+ voxel : array_like, optional
258258 (N, 3) array with the voxel indices (can be omitted for CIFTI-2 files only
259259 covering the surface)
260- vertex : np.ndarray
260+ vertex : array_like, optional
261261 (N, ) array with the vertex indices (can be omitted for volumetric CIFTI-2 files)
262- affine : np.ndarray
262+ affine : array_like, optional
263263 (4, 4) array mapping voxel indices to mm space (not needed for CIFTI-2 files only
264264 covering the surface)
265- volume_shape : tuple of three integers
265+ volume_shape : tuple of three integers, optional
266266 shape of the volume in which the voxels were defined (not needed for CIFTI-2 files only
267267 covering the surface)
268- nvertices : dict from string to integer
268+ nvertices : dict from string to integer, optional
269269 maps names of surface elements to integers (not needed for volumetric CIFTI-2 files)
270270 """
271271 if voxel is None :
@@ -304,7 +304,7 @@ def __init__(self, name, voxel=None, vertex=None, affine=None,
304304 if affine is None or volume_shape is None :
305305 raise ValueError ("Affine and volume shape should be defined "
306306 "for BrainModelAxis containing voxels" )
307- self .affine = affine
307+ self .affine = np . asanyarray ( affine )
308308 self .volume_shape = volume_shape
309309
310310 if np .any (self .vertex [surface_mask ] < 0 ):
@@ -325,12 +325,12 @@ def from_mask(cls, mask, name='other', affine=None):
325325
326326 Parameters
327327 ----------
328- mask : np.ndarray
328+ mask : array_like
329329 all non-zero voxels will be included in the BrainModelAxis axis
330330 should be (Nx, Ny, Nz) array for volume mask or (Nvertex, ) array for surface mask
331- name : str
331+ name : str, optional
332332 Name of the brain structure (e.g. 'CortexRight', 'thalamus_left' or 'brain_stem')
333- affine : np.ndarray
333+ affine : array_like, optional
334334 (4, 4) array with the voxel to mm transformation (defaults to identity matrix)
335335 Argument will be ignored for surface masks
336336
@@ -362,7 +362,7 @@ def from_surface(cls, vertices, nvertex, name='Other'):
362362
363363 Parameters
364364 ----------
365- vertices : np.ndarray
365+ vertices : array_like
366366 indices of the vertices on the surface
367367 nvertex : int
368368 total number of vertices on the surface
@@ -384,7 +384,7 @@ def from_index_mapping(cls, mim):
384384
385385 Parameters
386386 ----------
387- mim : cifti2.Cifti2MatrixIndicesMap
387+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
388388
389389 Returns
390390 -------
@@ -422,7 +422,7 @@ def to_mapping(self, dim):
422422
423423 Returns
424424 -------
425- cifti2.Cifti2MatrixIndicesMap
425+ :class:`. cifti2.Cifti2MatrixIndicesMap`
426426 """
427427 mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_BRAIN_MODELS' )
428428 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
720720
721721 Parameters
722722 ----------
723- name : np.ndarray
723+ name : array_like
724724 (N, ) string array with the parcel names
725- voxels : np.ndarray
725+ voxels : array_like
726726 (N, ) object array each containing a sequence of voxels.
727727 For each parcel the voxels are represented by a (M, 3) index array
728- vertices : np.ndarray
728+ vertices : array_like
729729 (N, ) object array each containing a sequence of vertices.
730730 For each parcel the vertices are represented by a mapping from brain structure name to
731731 (M, ) index array
732- affine : np.ndarray
732+ affine : array_like, optional
733733 (4, 4) array mapping voxel indices to mm space (not needed for CIFTI-2 files only
734734 covering the surface)
735- volume_shape : tuple of three integers
735+ volume_shape : tuple of three integers, optional
736736 shape of the volume in which the voxels were defined (not needed for CIFTI-2 files only
737737 covering the surface)
738- nvertices : dict[String -> int]
738+ nvertices : dict from string to integer, optional
739739 maps names of surface elements to integers (not needed for volumetric CIFTI-2 files)
740740 """
741741 self .name = np .asanyarray (name , dtype = 'U' )
@@ -748,7 +748,7 @@ def __init__(self, name, voxels, vertices, affine=None, volume_shape=None, nvert
748748 voxels [idx ] = as_array [idx ]
749749 self .voxels = np .asanyarray (voxels , dtype = 'object' )
750750 self .vertices = np .asanyarray (vertices , dtype = 'object' )
751- self .affine = affine
751+ self .affine = np . asanyarray ( affine ) if affine is not None else None
752752 self .volume_shape = volume_shape
753753 if nvertices is None :
754754 self .nvertices = {}
@@ -813,7 +813,7 @@ def from_index_mapping(cls, mim):
813813
814814 Parameters
815815 ----------
816- mim : cifti2.Cifti2MatrixIndicesMap
816+ mim : :class:` cifti2.Cifti2MatrixIndicesMap`
817817
818818 Returns
819819 -------
@@ -859,7 +859,7 @@ def to_mapping(self, dim):
859859
860860 Returns
861861 -------
862- cifti2.Cifti2MatrixIndicesMap
862+ :class:` cifti2.Cifti2MatrixIndicesMap`
863863 """
864864 mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_PARCELS' )
865865 if self .affine is not None :
@@ -1008,7 +1008,8 @@ def get_element(self, index):
10081008 tuple with 3 elements
10091009 - unicode name of the parcel
10101010 - (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
10121013 """
10131014 return self .name [index ], self .voxels [index ], self .vertices [index ]
10141015
@@ -1023,9 +1024,9 @@ def __init__(self, name, meta=None):
10231024 """
10241025 Parameters
10251026 ----------
1026- name : np.ndarray of string
1027+ name : array_like
10271028 (N, ) string array with the parcel names
1028- meta : np.ndarray of dict
1029+ meta : array_like
10291030 (N, ) object array with a dictionary of metadata for each row/column.
10301031 Defaults to empty dictionary
10311032 """
@@ -1046,7 +1047,7 @@ def from_index_mapping(cls, mim):
10461047
10471048 Parameters
10481049 ----------
1049- mim : cifti2.Cifti2MatrixIndicesMap
1050+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
10501051
10511052 Returns
10521053 -------
@@ -1067,7 +1068,7 @@ def to_mapping(self, dim):
10671068
10681069 Returns
10691070 -------
1070- cifti2.Cifti2MatrixIndicesMap
1071+ :class:`. cifti2.Cifti2MatrixIndicesMap`
10711072 """
10721073 mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_SCALARS' )
10731074 for name , meta in zip (self .name , self .meta ):
@@ -1151,13 +1152,13 @@ def __init__(self, name, label, meta=None):
11511152 """
11521153 Parameters
11531154 ----------
1154- name : np.ndarray
1155+ name : array_like
11551156 (N, ) string array with the parcel names
1156- label : np.ndarray
1157+ label : array_like
11571158 single dictionary or (N, ) object array with dictionaries mapping
11581159 from integers to (name, (R, G, B, A)), where name is a string and R, G, B, and A are
11591160 floats between 0 and 1 giving the colour and alpha (i.e., transparency)
1160- meta : np.ndarray
1161+ meta : array_like, optional
11611162 (N, ) object array with a dictionary of metadata for each row/column
11621163 """
11631164 self .name = np .asanyarray (name , dtype = 'U' )
@@ -1180,7 +1181,7 @@ def from_index_mapping(cls, mim):
11801181
11811182 Parameters
11821183 ----------
1183- mim : cifti2.Cifti2MatrixIndicesMap
1184+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
11841185
11851186 Returns
11861187 -------
@@ -1202,7 +1203,7 @@ def to_mapping(self, dim):
12021203
12031204 Returns
12041205 -------
1205- cifti2.Cifti2MatrixIndicesMap
1206+ :class:`. cifti2.Cifti2MatrixIndicesMap`
12061207 """
12071208 mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_LABELS' )
12081209 for name , label , meta in zip (self .name , self .label , self .meta ):
@@ -1324,7 +1325,7 @@ def from_index_mapping(cls, mim):
13241325
13251326 Parameters
13261327 ----------
1327- mim : cifti2.Cifti2MatrixIndicesMap
1328+ mim : :class:`. cifti2.Cifti2MatrixIndicesMap`
13281329
13291330 Returns
13301331 -------
@@ -1345,7 +1346,7 @@ def to_mapping(self, dim):
13451346
13461347 Returns
13471348 -------
1348- cifti2.Cifti2MatrixIndicesMap
1349+ :class:` cifti2.Cifti2MatrixIndicesMap`
13491350 """
13501351 mim = cifti2 .Cifti2MatrixIndicesMap ([dim ], 'CIFTI_INDEX_TYPE_SERIES' )
13511352 mim .series_exponent = 0
0 commit comments