Hi,
Yes, very good catch! you are exactly right on the bug as well as the fix, thank you very much for the precise explanation (the exact bug fix had actually already made it into the development version of CONN -in github- but it is still not in the stable version -in NITRC- until the hopefully-very-soon next release)
Thanks again!
Alfonso
Originally posted by tposside:
Hi there,
I'm using Conn 22a.
I was inputting my own ROIs into Conn from freesurfer lh/rh.ROI.annot files and noticed that if the lh and rh annot files did not have the same ROIs, conn_annot2nii would hit an indexing error. For example, if the lh.ROI.annot file contained 12 ROIs but the rh.ROI.annot file was missing one of those ROIs it would hit an indexing error on line 100 of conn_annot2nii.
conn_annot2nii already had some code to handle this exact situation (if/else statement starting on line 88):
if isequal(log.labels{ifile(1)},log.labels{ifile(2)})
names_rois=[cellfun(@(x)[x ' (L)'],names_rois,'uni',0); cellfun(@(x)[x ' (R)'],names_rois,'uni',0)];
else
%names_rois=[log.labels{ifile(1)}; log.labels{ifile(2)}];
names_rois=[cellfun(@(x)[x ' (L)'],regexprep(log.labels{ifile(1)},'^l\.','','ignorecase'),'uni',0); cellfun(@(x)[x ' (R)'],regexprep(log.labels{ifile(1)},'^r\.','','ignorecase'),'uni',0)];
end
But it works improperly because in the else statement you are indexing 1 of ifile (lh) for both lh and rh. So it should be:
names_rois=[cellfun(@(x)[x ' (L)'],regexprep(log.labels{ifile(1)},'^l\.','','ignorecase'),'uni',0); cellfun(@(x)[x ' (R)'],regexprep(log.labels{ifile(2)},'^r\.','','ignorecase'),'uni',0)];
With this change I think it works as intended.
Let me know if this is indeed a bug and the correct fix for it.
Thanks!
Threaded View
| Title | Author | Date |
|---|---|---|
| tposside | Jun 19, 2024 | |
| tposside | Jun 21, 2024 | |
| Alfonso Nieto-Castanon | Jun 19, 2024 | |
