@@ -991,8 +991,8 @@ def add_annotation(self, annot, borders=True, alpha=1, hemi=None,
991
991
self .annot_list = al
992
992
self ._toggle_render (True , views )
993
993
994
- def add_label (self , label , color = "crimson" , alpha = 1 ,
995
- scalar_thresh = None , borders = False , hemi = None ):
994
+ def add_label (self , label , color = "crimson" , alpha = 1 , scalar_thresh = None ,
995
+ borders = False , hemi = None , subdir = None ):
996
996
"""Add an ROI label to the image.
997
997
998
998
Parameters
@@ -1015,6 +1015,9 @@ def add_label(self, label, color="crimson", alpha=1,
1015
1015
If None, it is assumed to belong to the hemipshere being
1016
1016
shown. If two hemispheres are being shown, an error will
1017
1017
be thrown.
1018
+ subdir : None | str
1019
+ If a label is specified as name, subdir specifies the path of the
1020
+ directory containing the label relative to the label directory.
1018
1021
1019
1022
Notes
1020
1023
-----
@@ -1026,11 +1029,11 @@ def add_label(self, label, color="crimson", alpha=1,
1026
1029
filepath = label
1027
1030
label_name = os .path .basename (filepath ).split ('.' )[1 ]
1028
1031
else :
1029
- dirname , label_name = os . path . split ( label )
1032
+ label_name = label
1030
1033
filepath = pjoin (self .subjects_dir ,
1031
1034
self .subject_id ,
1032
1035
'label' ,
1033
- dirname ,
1036
+ subdir ,
1034
1037
"." .join ([hemi , label_name , 'label' ]))
1035
1038
if not os .path .exists (filepath ):
1036
1039
raise ValueError ('Label file %s does not exist'
0 commit comments