Hi Kirstie, Thank you very much for the suggestions! I modified my snippet to prevent it from looping the same value and still got the same results?
###### input=($(cat ./names_68parc.txt)) labels=() hemis=() j=0 for i in "${input[@]}"; do if [[ $i == lh_* ]]; then hemis[j]="lh" i=$(echo $i | sed 's/^lh_//g') labels[j]="$i" (( j++ )) elif [[ $i == rh_* ]]; then hemis[j]="rh" i=$(echo $i | sed 's/^rh_//g') labels[j]="$i" (( j++ )) fi done nlabel=68 if [[ ${#labels[@]} != $nlabel ]] && [[ ${#hemi[@]} != $nlabel ]]; then echo " number of label not match " fi for hemi in lh rh; do mri_annotation2label --subject fsaverage --hemi ${hemi} --outdir ./labels done for ((i=0;i<${#labels[@]};i++)); do mri_surfcluster --in /usr/local/freesurfer_orig/subjects/fsaverage/surf/${hemis[i]}.thickness --clabel ./labels/${hemis[i]}.${labels[i]}.label --sum ./labels/sum.${hemis[i]}.${labels[i]} --centroid --thmin 0 --hemi ${hemis[i]} --subject fsaverage tail -1 ./labels/sum.${hemis[i]}.${labels[i]} | sed 's/ */ /g' | cut -d' ' -f6-8 >> ./labels/68parc.centroids.txt done ###### The output message of mri_surfcluster: ###### thsign = abs, id = 0 version $Id: mri_surfcluster.c,v 1.57.2.3 2016/11/17 18:19:42 zkaufman Exp $ hemi = rh srcid = /usr/local/freesurfer_orig/subjects/fsaverage/surf/rh.thickness srcsubjid = fsaverage srcsurf = white srcframe = 0 thsign = abs thmin = 0 thmax = -1 fdr = -1 minarea = 0 xfmfile = talairach.xfm clabelfile = ./labels/rh.lateraloccipital.label clabelinv = 0 nth = -1 sumfile = ./labels/sum.rh.lateraloccipital subjectsdir = /usr/local/freesurfer_orig/subjects FixMNI = 1 Loading clabel ./labels/rh.lateraloccipital.label. Found 5963 points in clabel. ------------- XFM matrix (RAS2RAS) --------------- /usr/local/freesurfer_orig/subjects/fsaverage/mri/transforms/talairach.xfm 1.00000 0.00000 0.00000 0.00000; 0.00000 1.00000 0.00000 0.00000; 0.00000 0.00000 1.00000 0.00000; 0.00000 0.00000 0.00000 1.00000; ---------------------------------------------------- Reading source surface /usr/local/freesurfer_orig/subjects/fsaverage/surf/rh.white Done reading source surface Computing metric properties Loading source values number of voxels in search space = 5963 Done loading source values (nvtxs = 163842) overall max = 3.19752 at vertex 122846 overall min = 0 at vertex 0 surface nvertices 163842 metric props tot surface area 65020.839844 group_avg_vtxarea_loaded 1 masked surface area 4459.747559 NOT Adjusting threshold for 1-tailed test thminadj = 0 Searching for Clusters ... thmin=0.000000 (0.000000), thmax=-1.000000 (-1), thsignid=0, minarea=0.000000 Found 1 clusters Max cluster size 82167.000000 INFO: fixing MNI talairach coordinates On Wed, Feb 21, 2018 at 3:15 PM, Kirstie Whitaker <kw...@cam.ac.uk> wrote: > Hi Foucault, > > In the snippet you added you don’t define the labels variable (which you > subsequently loop over in for label in ${labels}). > > There are two possible mistakes that are easy to fix. One may be that you > forgot to read in the labels! And the other is that to get all the values > in an array you need ${labels[@]}. > > I don’t think you need greater precision than you have. The regions are > pretty far apart in mm terms :) > > Kirstie > > Sent from my iPhone, please excuse any typos or excessive brevity > > On 21 Feb 2018, at 03:44, zuxfoucault Wong <zuxfouca...@gmail.com> wrote: > > Dear Freesurfer experts, > > Based on this https://mail.nmr.mgh.harvard.edu/pipermail// > freesurfer/2013-September/033337.html , I wrote a short script to extract > the centroids from Desikan-Killiany atlas. > > ###### > for hemi in lh rh; do > mri_annotation2label --subject fsaverage --hemi ${hemi} --outdir ./labels > for label in ${labels}; do > mri_surfcluster --in > /usr/local/freesurfer/subjects/fsaverage/surf/${hemi}.thickness > --clabel ./labels/${label}.label --sum ./labels/sum.${label} --centroid > --thmin 0 --hemi ${hemi} --subject fsaverage > tail -1 ./labels/sum.${label} | sed 's/ */ /g' | cut -d' ' -f6-8 >> > ./labels/68parc.centroids.txt > done > done > ####### > > However, 1) the value is not precise enough, it is only one digit after > decimal point. And 2) I kept getting the same value for each hemisphere. > Eg,. > 29.8 -20.7 18.0 > 29.8 -20.7 18.0 > 29.8 -20.7 18.0 > 29.8 -20.7 18.0 > 29.8 -20.7 18.0 > 29.8 -20.7 18.0 > 29.8 -20.7 18.0 > > I would appreciate if you have any suggestions regarding extracting > centroids and the aforementioned issues! > Thank you for your time! > > Best, > Foucault > > _______________________________________________ > 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. > > > _______________________________________________ > 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. > >
_______________________________________________ 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.