I don't know of an "elegant" way. You could convert the annotations to
labels (mri_annotatoin2label), the binarize the labels (mri_label2label
with --mask output), then AND them (fscalc bin1.mgz and bin2.mgz -o
and.mgz), then convert that back to a label (mri_cor2label, make sure to
use the --surf option)
On 2/16/2021 11:18 AM, Dr. Cornelius Kronlage wrote:
External Email - Use Caution
Dear freesurfers,
is there an elegant way of computing the intersection or overlap of
different labels or - which would be even more useful for my
application - annotations?
I only managed to find labels_intersect (which appears to be from
*MailScanner has detected a possible fraud attempt from
"secure-web.cisco.com" claiming to be*
https://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg11344.html
<https://secure-web.cisco.com/12D3ntbm8RDBV366hh41UjEkFWk2mrjQHSMiY8WEom0naUegbdbmI9Bk7UNIwOTDDV40505y4xUMucZzUUWAKig63gNPrAZl0JMYNPDR9rlE4fUcOuQETynMWSKJG67sRNzzZQq8VF7AEsupWpjkrPP17ola-zMVT-3GDtM_dSs0-j76spejYlLevtumd4uKC8BNXwnxiW47uZxy5cBV4IPlI1yL8DP4GKO7QCjCWHuSjiE1xMapPwxOxVnVfHUKM/https%3A%2F%2Fwww.mail-archive.com%2Ffreesurfer%40nmr.mgh.harvard.edu%2Fmsg11344.html>)
which is awfully slow. In case this is of use for anyone else, I
attached a modified version using 'join' that runs much faster, only
has some compatibility issues with Mac.
>time labels_intersect precentral.label frontal.label out1.label > /dev/null
real 1m41.862s
user 0m31.052s
sys 0m30.757s
>time bash bash_labels_intersect.sh precentral.label frontal.label
out2.label
real 0m0.193s
user 0m0.118s
sys 0m0.015s
>diff -w out1.label out2.label
>
Thank you and best wishes
Cornelius
--
Cornelius Kronlage
Assistenzarzt
Klinik für Neurologie | Neurologie mit Schwerpunkt Epileptologie
Universitätsklinikum Tübingen
Hoppe-Seyler-Str. 3 | 72076 Tübingen
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer