Hi Martin,
Now I move onto the mri_glmfit step (still within the two stage method). The on-line tutorial for doing this is not very clear.
"The output of the first stage is stored in the subject-template (base), already in fsaverage space. Simply replace the thickness file with your long.thickness-pc1fit (etc) and run your analysis. "
For the normal group analysis, one mgh file (the stacked image for all subject for each hemisphere) is created under the SUBJECT folder after the mri_prepro, and the mri_surf2surf steps. However, I assume that after the long_mris_slopes command, the mgh file (lh.long.thickness-spc.fwhm5.fsaverage.mgh, etc.) saved within each subject's base/surf folder is just for that subject. Right?
My question is: what is the right way to process these subject specific mgh files within mri_glmfit? How to design the FSGD file for this particular glmfit?
I appreciate your clarification on this issue, and I do believe that it would be very helpful if you could add your clarification onto the online tutorial for the two stage method ( http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalTwoStageModel)
Many thanks
Keith
On Wed, May 8, 2013 at 4:28 PM, Martin Reuter mreuter@nmr.mgh.harvard.eduwrote:
Hi Keith,
your longitudinal qdec file looks OK. Something must have gone wrong before (in the processing, e.g. maybe the base was reprocessed and the longs were not updated or things were renamed?)
I would create a new directory with only this subject, then start from scratch. create both cross (kp5 and kp5b), the base (kp5_base) and both longs with the correct naming . Then check if the long_mris_slopes command still fails.
Best, Martin
On 05/01/2013 12:11 PM, Qi Wu wrote:
Dear Freesurfer experts,
I have a dataset of 2 time points. I ran into problems when I tried to use the two-stage approach to pull out statistics such as the rate of change in Freesurfer 5.1.
I could not even get the first stage working. The error messages I got were “ERROR: MRISar1: Surf/Src dimension mismatch” “ERROR -11 : mri_glmfit did not work?”
I did further trouble-shooting for this particular message "nv1 = 140942, nv1 = 143525", and I found out that "143525" was in the "base" folder (kp5_base), and "140942" was for the two longitudinally registered images (kp5.long.kp5_base, and kp5b.long.kp5_base).
The command line I used was : “long_mris_slopes --qdec ./qdec/AS_long_qdec.dat --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time weeks –nosmooth”.
The first three lines in the qdec file:
“fsid fsid-base weeks age sex FSS avgPain
kp5 kp5_base 0 48 0 4.1 7
kp5b kp5_base 20 48 0 8.6 6”
This error was similar to what was in a previous post ( https://mail.nmr.mgh.harvard.edu/pipermail/freesurfer/2012-June/024576.htmlb... joost janssen Jun 29, 2012). I tried to fix any similar problems, but still wasn’t able to get it working.
What else could I have been doing wrong?
The on screen error output is provided as follows
Many thanks
Keith
Postdoctoral fellow Toronto Western Hospital Toronto, Ontario Canada
Parsing the qdec table: ./qdec/AS_long_qdec.dat
Working in SUBJECTS_DIR: /data/keith/freesurferdata/subjects_longitudinal_5.1_old
Subject-Template: kp5_base
INFO: 2 TPs in kp5_base , mean age: 10.0
===============================================================================
SUBJECT kp5_base Intersecting Within-Subject Cortex Label
cp /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5.long.kp5_base/label/lh.cortex.label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label
mris_label_calc intersect /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5b.long.kp5_base/label/lh.cortex.label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label
LabelWrite: saving to /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label
===============================================================================
SUBJECT kp5_base Stackinbg Within-Subject Maps
mri_concat /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5.long.kp5_base/surf/lh.thickness /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5b.long.kp5_base/surf/lh.thickness --o /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh
ninputs = 2
Checking inputs
nframestot = 2
Allocing output
Done allocing
nframes = 2
Writing to /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh
===============================================================================
SUBJECT kp5_base Running Within-Subject GLM
Writing ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat ...
mri_glmfit --y /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh --X ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat --allow-zero-dof --no-contrasts-ok --surf kp5_base lh --label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label --glmdir ./tmp-kp5_base_lh_thickness_6PR2rH/glm
Reading source surface /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.white
Number of vertices 143525
Number of faces 287046
Total area 91438.851562
AvgVtxArea 0.637094
AvgVtxDist 0.873064
StdVtxDist 0.245806
$Id: mri_glmfit.c,v 1.196.2.6 2011/05/05 20:54:25 greve Exp $
cwd /data/keith/freesurferdata/subjects_longitudinal_5.1_old
cmdline mri_glmfit --y /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh --X ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat --allow-zero-dof --no-contrasts-ok --surf kp5_base lh --label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label --glmdir ./tmp-kp5_base_lh_thickness_6PR2rH/glm
sysname Linux
hostname davissvr1.uhnres.utoronto.ca
machine x86_64
user qwu
FixVertexAreaFlag = 1
UseMaskWithSmoothing 1
OneSampleGroupMean 0
y /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh
logyflag 0
X ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat
usedti 0
labelmask /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label
maskinv 0
glmdir ./tmp-kp5_base_lh_thickness_6PR2rH/glm
IllCondOK 0
ReScaleX 1
DoFFx 0
Creating output directory ./tmp-kp5_base_lh_thickness_6PR2rH/glm
Loading y from /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh
Saving design matrix to ./tmp-kp5_base_lh_thickness_6PR2rH/glm/Xg.dat
Normalized matrix condition is 1
Matrix condition is 10
Found 131455 points in label.
ERROR: mri_reshape: number of elements cannot change
nv1 = 143525, nv1 = 140942
Pruning voxels by thr: 0.000000
Found 134956 voxels in mask
Saving mask to ./tmp-kp5_base_lh_thickness_6PR2rH/glm/mask.mgh
Reshaping mriglm->mask...
ERROR: mri_reshape: number of elements cannot change
nv1 = 140942, nv1 = 143525
search space = 91439.090793
DOF = 0
Starting fit and test
Fit completed in 0.0042 minutes
Computing spatial AR1 on surface
ERROR: MRISar1: Surf/Src dimension mismatch.
ERROR -11 : mri_glmfit did not work?
Freesurfer mailing listFreesurfer@nmr.mgh.harvard.eduhttps://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
-- Dr. Martin Reuter Assistant in Neuroscience - Massachusetts General Hospital Instructor in Neurology - Harvard Medical School MGH / HMS / MIT
A.A.Martinos Center for Biomedical Imaging 149 Thirteenth Street, Suite 2301 Charlestown, MA 02129
Phone: +1-617-724-5652 Email: mreuter@nmr.mgh.harvard.edu reuter@mit.edu Web : http://reuter.mit.edu
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.
Hi Keith,
you are right, the lh.long.thickness-spc.fwhm5.fsaverage.mgh in each base folder is only for that subject. You process this the same way as you'd usually do thickness in a cross sectional analysis. Except you can skip the mris_prepoc step (as everyting is mapped to fsaverage and presmoothed already, when using the qcache flag to long_mris_slopes). You have several options - simply use mri_concat to stack those files to create the stack - or (probably easier) tell long_mris_slopes to do the job for you with the --stack-rate or --stack-spc etc. options
Then you have a stack on fsaverage with the right smoothing level(s). the FSGD file is also as usual, make sure the order of your subjects agrees with the order in the long.qdec table used for the stacking.
Added that to the wiki , thanks.
Best, Martin
On 05/21/2013 02:36 PM, Qi Wu wrote:
Hi Martin,
Now I move onto the mri_glmfit step (still within the two stage method). The on-line tutorial for doing this is not very clear.
"The output of the first stage is stored in the subject-template (base), already in fsaverage space. Simply replace the thickness file with your long.thickness-pc1fit (etc) and run your analysis. "
For the normal group analysis, one mgh file (the stacked image for all subject for each hemisphere) is created under the SUBJECT folder after the mri_prepro, and the mri_surf2surf steps. However, I assume that after the long_mris_slopes command, the mgh file (lh.long.thickness-spc.fwhm5.fsaverage.mgh, etc.) saved within each subject's base/surf folder is just for that subject. Right? My question is: what is the right way to process these subject specific mgh files within mri_glmfit? How to design the FSGD file for this particular glmfit?
I appreciate your clarification on this issue, and I do believe that it would be very helpful if you could add your clarification onto the online tutorial for the two stage method (http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalTwoStageModel)
Many thanks
Keith
On Wed, May 8, 2013 at 4:28 PM, Martin Reuter <mreuter@nmr.mgh.harvard.edu mailto:mreuter@nmr.mgh.harvard.edu> wrote:
Hi Keith, your longitudinal qdec file looks OK. Something must have gone wrong before (in the processing, e.g. maybe the base was reprocessed and the longs were not updated or things were renamed?) I would create a new directory with only this subject, then start from scratch. create both cross (kp5 and kp5b), the base (kp5_base) and both longs with the correct naming . Then check if the long_mris_slopes command still fails. Best, Martin On 05/01/2013 12:11 PM, Qi Wu wrote:Dear Freesurfer experts, I have a dataset of 2 time points. I ran into problems when I tried to use the two-stage approach to pull out statistics such as the rate of change in Freesurfer 5.1. I could not even get the first stage working. The error messages I got were “ERROR: MRISar1: Surf/Src dimension mismatch” “ERROR -11 : mri_glmfit did not work?” I did further trouble-shooting for this particular message "nv1 = 140942, nv1 = 143525", and I found out that "143525" was in the "base" folder (kp5_base), and "140942" was for the two longitudinally registered images (kp5.long.kp5_base, and kp5b.long.kp5_base). The command line I used was : “long_mris_slopes --qdec ./qdec/AS_long_qdec.dat --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time weeks –nosmooth”. The first three lines in the qdec file: “fsid fsid-base weeks age sex FSS avgPain kp5 kp5_base 0 48 0 4.1 7 kp5b kp5_base 20 48 0 8.6 6” This error was similar to what was in a previous post (https://mail.nmr.mgh.harvard.edu/pipermail/freesurfer/2012-June/024576.html by joost janssen Jun 29, 2012). I tried to fix any similar problems, but still wasn’t able to get it working. What else could I have been doing wrong? The on screen error output is provided as follows Many thanks Keith Postdoctoral fellow Toronto Western Hospital Toronto, Ontario Canada *********************************** Parsing the qdec table: ./qdec/AS_long_qdec.dat Working in SUBJECTS_DIR: /data/keith/freesurferdata/subjects_longitudinal_5.1_old Subject-Template: kp5_base INFO: 2 TPs in kp5_base , mean age: 10.0 =============================================================================== SUBJECT kp5_base Intersecting Within-Subject Cortex Label cp /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5.long.kp5_base/label/lh.cortex.label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label mris_label_calc intersect /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5b.long.kp5_base/label/lh.cortex.label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label LabelWrite: saving to /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label =============================================================================== SUBJECT kp5_base Stackinbg Within-Subject Maps mri_concat /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5.long.kp5_base/surf/lh.thickness /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5b.long.kp5_base/surf/lh.thickness --o /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh ninputs = 2 Checking inputs nframestot = 2 Allocing output Done allocing nframes = 2 Writing to /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh =============================================================================== SUBJECT kp5_base Running Within-Subject GLM Writing ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat ... mri_glmfit --y /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh --X ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat --allow-zero-dof --no-contrasts-ok --surf kp5_base lh --label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label --glmdir ./tmp-kp5_base_lh_thickness_6PR2rH/glm Reading source surface /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.white Number of vertices 143525 Number of faces 287046 Total area 91438.851562 AvgVtxArea 0.637094 AvgVtxDist 0.873064 StdVtxDist 0.245806 $Id: mri_glmfit.c,v 1.196.2.6 2011/05/05 20:54:25 greve Exp $ cwd /data/keith/freesurferdata/subjects_longitudinal_5.1_old cmdline mri_glmfit --y /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh --X ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat --allow-zero-dof --no-contrasts-ok --surf kp5_base lh --label /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label --glmdir ./tmp-kp5_base_lh_thickness_6PR2rH/glm sysname Linux hostname davissvr1.uhnres.utoronto.ca <http://davissvr1.uhnres.utoronto.ca> machine x86_64 user qwu FixVertexAreaFlag = 1 UseMaskWithSmoothing 1 OneSampleGroupMean 0 y /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh logyflag 0 X ./tmp-kp5_base_lh_thickness_6PR2rH/X-long.mat usedti 0 labelmask /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/label/lh.long.cortex.label maskinv 0 glmdir ./tmp-kp5_base_lh_thickness_6PR2rH/glm IllCondOK 0 ReScaleX 1 DoFFx 0 Creating output directory ./tmp-kp5_base_lh_thickness_6PR2rH/glm Loading y from /data/keith/freesurferdata/subjects_longitudinal_5.1_old/kp5_base/surf/lh.long.thickness-stack.mgh Saving design matrix to ./tmp-kp5_base_lh_thickness_6PR2rH/glm/Xg.dat Normalized matrix condition is 1 Matrix condition is 10 Found 131455 points in label. ERROR: mri_reshape: number of elements cannot change nv1 = 143525, nv1 = 140942 Pruning voxels by thr: 0.000000 Found 134956 voxels in mask Saving mask to ./tmp-kp5_base_lh_thickness_6PR2rH/glm/mask.mgh Reshaping mriglm->mask... ERROR: mri_reshape: number of elements cannot change nv1 = 140942, nv1 = 143525 search space = 91439.090793 DOF = 0 Starting fit and test Fit completed in 0.0042 minutes Computing spatial AR1 on surface ERROR: MRISar1: Surf/Src dimension mismatch. ERROR -11 : mri_glmfit did not work? _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer-- Dr. Martin Reuter Assistant in Neuroscience - Massachusetts General Hospital Instructor in Neurology - Harvard Medical School MGH / HMS / MIT A.A.Martinos Center for Biomedical Imaging 149 Thirteenth Street, Suite 2301 Charlestown, MA 02129 Phone:+1-617-724-5652 <tel:%2B1-617-724-5652> Email: mreuter@nmr.mgh.harvard.edu <mailto:mreuter@nmr.mgh.harvard.edu> reuter@mit.edu <mailto:reuter@mit.edu> Web :http://reuter.mit.edu 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@nmr.mgh.harvard.edu