Skip to content

replace the vertex_label_index in .annot file #5

Description

@tanjia123456

hello,freesurfer
Previously, rh.white and rh.aparc.2009s.annot were used to generate vertex_id
and vertex_label,
'
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)
after some algorthm: vertex_index:0 label_index=71
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 file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions