@@ -44,7 +44,7 @@ def __init__(
44
44
surf_type : str = "pial" ,
45
45
subject : str = "fsaverage" ,
46
46
coordinate_space : str = 'FSAverage' ,
47
- atlas : str = '' ,
47
+ atlas = None ,
48
48
subject_dir = None ,
49
49
):
50
50
"""
@@ -61,7 +61,7 @@ def __init__(
61
61
Subject to use, must be a directory within ``subject_dir``
62
62
coordinate_space : str, default='FSAverage'
63
63
Coordinate space of brain vertices. Must be 'FSAverage' or 'MNI152'
64
- atlas : str, default=''
64
+ atlas : str, default=None
65
65
Atlas for brain parcellation. Defaults to 'Destrieux' for coordinate_space='FSAverage'
66
66
and 'Desikan-Killiany' for 'MNI152'. Can also be an annotation file name given by
67
67
``{subject_dir}/{subject}/label/?h.{atlas}.annot``
@@ -84,6 +84,8 @@ def __init__(
84
84
self .surf_type = surf_type
85
85
self .subject = subject
86
86
self .coordinate_space = coordinate_space
87
+ if atlas not in ['Desikan-Killiany' , 'Destrieux' ] and not os .path .exists (self .label_file (f'{ self .hemi } .{ self .atlas } .annot' )):
88
+ raise ValueError ('Bad atlas. Try "Desikan-Killiany" or "Destrieux"' )
87
89
self .atlas = atlas
88
90
89
91
if subject_dir is None :
@@ -327,6 +329,7 @@ def zones(self, labels, min_alpha=0):
327
329
"""
328
330
if isinstance (labels , str ):
329
331
labels = (labels ,)
332
+ labels = [l for l in labels if l in self .label2num ]
330
333
331
334
verts = np .zeros (self .n_verts , dtype = bool )
332
335
zones = np .zeros (self .n_verts , dtype = int )
@@ -804,7 +807,7 @@ def __init__(
804
807
surf_type : str = "pial" ,
805
808
subject : str = "fsaverage" ,
806
809
coordinate_space : str = 'FSAverage' ,
807
- atlas : str = '' ,
810
+ atlas = None ,
808
811
subject_dir = None
809
812
):
810
813
"""
@@ -820,7 +823,7 @@ def __init__(
820
823
Subject to use, must be a directory within ``subject_dir``
821
824
coordinate_space : str, default='FSAverage'
822
825
Coordinate space of brain vertices. Must be 'FSAverage' or 'MNI152'
823
- atlas : str, default=''
826
+ atlas : str, default=None
824
827
Atlas for brain parcellation. Defaults to 'Destrieux' for coordinate_space='FSAverage'
825
828
and 'Desikan-Killiany' for 'MNI152'. Can also be an annotation file name given by
826
829
``{subject_dir}/{subject}/label/?h.{atlas}.annot``
@@ -974,7 +977,7 @@ def annotate_coords(
974
977
If provided, specifies a boolean which is True for each electrode that is in the left hemisphere.
975
978
If not given, this will be inferred from the first dimension of the coords (negative is left).
976
979
distance_cutoff : float, default=10
977
- Electrodes further than this distance (in mm) from the cortical surface will be labeled as "Other"
980
+ Electrodes further than this distance (in mm) from the cortical surface will be labeled as None
978
981
is_surf : boolean np.ndarray
979
982
Array of the same shape as the number of vertices in the surface (e.g. len(self.lh.surf[0])) indicating
980
983
whether those points should be included as surface options. If an electrode is closest to a point
0 commit comments