Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In MATLAB, I use write_annotation(fname, v, L, ct) to save an annotation file where: v is a 40962x1 matrix. L is a 40962x1 matrix. ct.table is a 113x5 array. This MATLAB code runs without problems. #1376

Open
SuperLuckyKris opened this issue Oct 15, 2024 · 0 comments

Comments

@SuperLuckyKris
Copy link

In MATLAB, I use write_annotation(fname, v, L, ct) to save an annotation file where:
v is a 40962x1 matrix.
L is a 40962x1 matrix.
ct.table is a 113x5 array.
This MATLAB code runs without problems.
However, in Python, I encountered an error when using FreeSurfer's nibabel.freesurfer.write_annot function. Here is my Python code:
nib.freesurfer.write_annot(fname, labels, ct_table, names)
where:
labels is a 40962x1 array.
ct_table is a 113x5 array.
names is a list of structure names.
File ‘F:\Desktop\Individualising PythonCoder\func_WriteParcellation_to_annotation_fs6_113LUT.py’, line 64, in func_WriteParcellation_to_annotation_ fs6_113LUT
nib.freesurfer.write_annot(fname,labels, ct_table,names)
File ‘C:\Users\kris\AppData\Local\Programs\Python\Python311\Lib\site-packages\nibabel\freesurfer\io.py’, line 541, in write_annot
clut_labels = ctab[:, -1][labels]
~~~~~~~~~~~^^^^^^^^
IndexError: index 11403468 is out of bounds for axis 0 with size 113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant