Dear Freesurfer experts,

I'm having trouble generating an annotation file for a large number of ROIs
(3000) from Python using Nibabel. The function call that I used is:

nib.freesurfer.io.write_annot(filepath, labels, ctab, names)

where

filepath = 'myFile.annot'
labels = numpy 1D array of type int64, elements between 0-2999 inclusive

ctab = 3000 x 5 array
ctab[:, 0:3] = unique colors for each row
ctab[:, 3] = 255
ctab[:, 4] = [1, 2, 3, etc ..] # this is where I think the problem is

names = [ b'patch0', b'patch1', etc ... ]

The annotation file is created without any warnings, but when I load it
with freesurfer it only shows me only around 10 ROIs (screenshot here
https://ibb.co/dZnkSa) and gives me the following warning:

CTABisEntryValid: index -1 was OOB
Resource temporarily unavailable

I think the problem is with the IDs I generate on the last column of ctab.
I thought those are some unique IDs, one for each ctab row, but they seem
to be used to somehow map colors for each vertex. Does anyone know how they
must be generated?

When I did this before for only around 30 ROIs, I hacked around this
problem by loading in Python the annotation file from
fsaverage lh.aparc.annot, and using the ctab from there, only replacing the
labels and names with my desired values. However, I cannot use this hack
for more than 36 ROIs (the number of ctab entries in aparc.annot).

Any help will be greatly appreciated!

Many thanks,
Razvan
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Reply via email to