You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: