External Email - Use Caution
hello,
Previously, rh.white and rh.aparc.2009s.annot were used to generate vertex_id and vertex_label,
'
from freesurfer_surface import Surface
from freesurfer_surface import Label
from freesurfer_surface import Annotation
surface = Surface.read_triangular('rh.white')
surface.load_annotation_file('rh.aparc.a2009s.annot')
with open("rhlabels.txt","w") as f:
for vertex_index, vertex in enumerate(surface.vertices):
vertex_label_index = surface.annotation.vertex_label_index[vertex_index]
vertex_label = surface.annotation.labels[vertex_label_index]
#print(vertex_index, vertex, vertex_label)
#f.write("vertex_index:{} vertexlabel:{} \n".format(vertex_index, vertex_label))
f.write("vertex_index:{} vertex_label:{}\n".format(vertex_index, vertex_label))
'
the output:vertex_index:0 vertexlabel:Label(name=S_precentral-sup-part, index=70, color=#1514c8)
and the label_index obtained after a certain algorithm was updated to replace the vertex_labe_index in rh.aparc.2009s.annot, and then load the result with freeview. But I don't know how to replace the vertex_label_index value in .annot?