Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Put the updated vertex_label into .annotation #30

Open
@tanjia123456

Description

@tanjia123456

hello, After I updated the vertex_label of rh.aparc.a2009s.annot with an algorithm, now I want to replace the vertex_label in the .annot with the updated vertex_label, mainly to see the effect of the segmentation, do you know what to do ?

The procedure for extracting vertex_index, vertex_label is as follows:

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("rhlabels1.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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions