I've just created a new version of gtmstats2table (attached). This will take a --volume flag to report the volume of the ROIs instead of the uptake
On 1/6/2021 6:00 PM, Julie Ottoy wrote: External Email - Use Caution Thank you Doug! I have another question related to voxel size. In the GTM PVC pipeline, the gtm.stats.dat file also outputs the NVoxels. However, is there a way to easily retrieve the volume (instead of NVoxels) for each ROI within the gtm.stats file? I know that you should rescale by the pet voxel size; however, I have a multi-site study with all different voxel sizes. Or is there perhaps a way to apply the "aparcstats2table -meas volume" command but get the same ROIs outputted as those in the gtm.stats file? Thank you for the info! Julie On Wed, 23 Dec 2020 at 13:11, Greve, Douglas N.,Ph.D. <dgr...@mgh.harvard.edu<mailto:dgr...@mgh.harvard.edu>> wrote: No, not a problem. On 12/21/2020 12:52 PM, Julie Ottoy wrote: External Email - Use Caution Dear freesurfer team, I am dealing with PET scans that were acquired at different sites. They do not have uniform voxel size and dimensions. I was wondering if this would be an issue for the sGTM and MG PETSurfer-PVC and/or for the "vol2surf --projfrac 0.5" and vertex-wise PET group-analyses. Should I resample to a uniform voxelsize prior to these steps or does freesurfer take care of this issue internally? Thank you for the information. Best regards Julie _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu> MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer<https://secure-web.cisco.com/1u58coWJ8-AkXrLWwU5c4kWgRB7z9zS2zw0Ra9eO1hjd6ge84eAzD3evbeGVj3jBjXy4ArObGAjd58Dq_pR2m2k57kT3YbH3f4Mo8TvicIp4ue7R-V2PUJgX3B1WHTduN1YbmPbDTE9BfxryTwhni-VIFrCceTc5SGkKCGMVIywW4syAzAjn2elnyQnQn7r2NnZNpoKpcaQpSMFgkHmxtrOx1Y4rrC7qjzOLKROb5oYuusaCd4C4hkEIGAnRrHNRUS2CFUjsvxoDnJFFaRU02uQ/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer> _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu> MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer<https://secure-web.cisco.com/1u58coWJ8-AkXrLWwU5c4kWgRB7z9zS2zw0Ra9eO1hjd6ge84eAzD3evbeGVj3jBjXy4ArObGAjd58Dq_pR2m2k57kT3YbH3f4Mo8TvicIp4ue7R-V2PUJgX3B1WHTduN1YbmPbDTE9BfxryTwhni-VIFrCceTc5SGkKCGMVIywW4syAzAjn2elnyQnQn7r2NnZNpoKpcaQpSMFgkHmxtrOx1Y4rrC7qjzOLKROb5oYuusaCd4C4hkEIGAnRrHNRUS2CFUjsvxoDnJFFaRU02uQ/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer> _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
#!/bin/tcsh -f # gtmstats2table - sources if(-e $FREESURFER_HOME/sources.csh) then source $FREESURFER_HOME/sources.csh endif set VERSION = '$Id$'; set output = (); set gtmdirlist = (); set meas = uptake set inputargs = ($argv); set PrintHelp = 0; if($#argv == 0) goto usage_exit; set n = `echo $argv | grep -e -help | wc -l` if($n != 0) then set PrintHelp = 1; goto usage_exit; endif set n = `echo $argv | grep -e -version | wc -l` if($n != 0) then echo $VERSION exit 0; endif goto parse_args; parse_args_return: goto check_params; check_params_return: set StartTime = `date`; set tSecStart = `date '+%s'`; set year = `date +%Y` set month = `date +%m` set day = `date +%d` set hour = `date +%H` set min = `date +%M` set outdir = `dirname $output` mkdir -p $outdir pushd $outdir > /dev/null set outdir = `pwd`; popd > /dev/null #======================================================== rm -f $output set stfile = $gtmdirlist[1]/gtm.stats.dat set roilist = `cat $stfile | awk '{print $3}'` echo "GTM $roilist" >> $output @ nth = 0 foreach gtmdir ($gtmdirlist) @ nth = $nth + 1 set stfile = $gtmdir/gtm.stats.dat switch($meas) case "uptake" set st = `cat $stfile | awk '{print $7}'` breaksw case "voxels" set st = `cat $stfile | awk '{print $5}'` breaksw case "volume" set st0 = `cat $stfile | awk '{print $5}'` set mask = $gtmdir/aux/mask.nii.gz set cmd = (mri_info --voxvol $mask --o /tmp/gtmstats2table.$$.dat) echo $cmd $cmd if($status) exit 1 set voxvol = `cat /tmp/gtmstats2table.$$.dat` rm -f /tmp/gtmstats2table.$$.dat set st = () foreach m ($st0) set mst = `echo "$m*$voxvol" | bc -l ` set st = ($st $mst) end breaksw endsw echo "$nth $st" >> $output end #======================================================== # Done echo "gtmstats2table Done" exit 0 ############################################### ############--------------################## error_exit: echo "ERROR:" exit 1; ############################################### ############--------------################## parse_args: set cmdline = ($argv); while( $#argv != 0 ) set flag = $argv[1]; shift; switch($flag) case "--o": if($#argv < 1) goto arg1err; set output = $argv[1]; shift; breaksw case "--gtmdir": case "--g": if($#argv < 1) goto arg1err; set gtmdir = $argv[1]; shift; set gtmdirlist = ($gtmdirlist $gtmdir) breaksw case "--f": if($#argv < 1) goto arg1err; set gtmdirfile = $argv[1]; shift; set gtmdirlist = ($gtmdirlist `cat $gtmdirfile`) breaksw case "--uptake": set meas = uptake; # default breaksw case "--voxels": set meas = voxels breaksw case "--volume": set meas = volume breaksw case "--debug": set verbose = 1; set echo = 1; breaksw default: echo ERROR: Flag $flag unrecognized. echo $cmdline exit 1 breaksw endsw end goto parse_args_return; ############--------------################## ############--------------################## check_params: if($#output == 0) then echo "ERROR: must spec output" exit 1; endif if($#gtmdirlist == 0) then echo "ERROR: must spec list of gtmdirs" exit 1; endif foreach gtmdir ($gtmdirlist) set stfile = $gtmdir/gtm.stats.dat if(! -e $stfile) then echo "ERROR: cannot find $stfile" exit 1; endif end goto check_params_return; ############--------------################## ############--------------################## arg1err: echo "ERROR: flag $flag requires one argument" exit 1 ############--------------################## arg2err: echo "ERROR: flag $flag requires two arguments" exit 1 ############--------------################## ############--------------################## usage_exit: echo "" echo "gtmstats2table --o outputtable" echo " --gtmdir gtmdir1 <--gtmdir gtmdir2>" echo " --f file : file with a list of gtmdirs" echo " --voxels : report the number of voxels in each ROI instead of uptake" echo " --volume : report the volume (mm3) each ROI instead of uptake" echo "" if(! $PrintHelp) exit 1; echo $VERSION cat $0 | awk 'BEGIN{prt=0}{if(prt) print $0; if($1 == "BEGINHELP") prt = 1 }' exit 1; #---- Everything below here is printed out as part of help -----# BEGINHELP This script collects the GTM values (7th column) from the gtm.stats file (output of mri_gtmpvc) and saves them in a white-space separated table (similar to the output of asegstats2table and aparcstats2table). There are two ways to specify the set of GTM directories to participate: (1) provide a list on the command line with multiple --gtmdir options, eg, --gtmdir cumi001/gtm.psf04 --gtmdir cumi002/gtm.psf04 (2) create a text file file with tall the gtmdirs, eg echo cumi001/gtm.psf04 cumi002/gtm.psf04 > gtmdirlistfile --f gtmdirlistfile The output will be a table where the first row is the list of ROI names. The subsequent rows will be for each input. The first column will be the order number of the input (eg, 1, 2, 3, etc). The output can be treated just like the outputs of asegstats2table and aparcstats2table, eg, mri_glmfit --table gtmstatstable --osgm --o glm.gtmstatstable Alternatively, the number of voxels in each ROI or the volume of each ROI can be reported by adding --voxels or --volume to the command line.
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer