I was having an issue where one label in an annotation would mistakenly be colored bright blue. e.g. this is an incorrect rending of the Yeo2011_7Networks_N1000 annot included with Freesurfer:
The issue seems to be this. add_annotation is setting the colors by calling surf.module_manager.scalar_lut_manager.load_lut_from_list. This keeps the lookup table at 255 colors and sets the first n colors where n is the length of the list you pass in. So what's happening is the "wrong" label is the largest ID in the annotation, and it is being colored in with the next color, which is blue (for a relatively small annotation). Why is that happening? It's not exactly clear. I don't see anything obviously wrong with the code we are using to set the scalar values of the annotation mesh. It may be a bug in mayavi.
In either case, it's also possible to set the LUT trait directly. This seems to fix my issue:
I was having an issue where one label in an annotation would mistakenly be colored bright blue. e.g. this is an incorrect rending of the Yeo2011_7Networks_N1000 annot included with Freesurfer:
The issue seems to be this.
add_annotation
is setting the colors by callingsurf.module_manager.scalar_lut_manager.load_lut_from_list
. This keeps the lookup table at 255 colors and sets the firstn
colors wheren
is the length of the list you pass in. So what's happening is the "wrong" label is the largest ID in the annotation, and it is being colored in with the next color, which is blue (for a relatively small annotation). Why is that happening? It's not exactly clear. I don't see anything obviously wrong with the code we are using to set the scalar values of the annotation mesh. It may be a bug in mayavi.In either case, it's also possible to set the LUT trait directly. This seems to fix my issue: