External Email - Use Caution
Hello,
I am trying to run a group analysis on cortical thickness (two groups, no covariates). I have been trying to follow the tutorial (FsTutorialGroupAnalysis) but I run into a problem with the mri_glmfit. My script looks like this:
fspath="/dat/freesurfer"
for hemi in lh rh; do echo $hemi cd $fspath
mri_glmfit \ --y ${hemi}.norm_${hemi}_thickness.mgh \ --fsgd /dat2/maria/scripts/final/group.fsgd dods \ --C /dat2/maria/scripts/final/group.diff.mtx \ --surf fsaverage ${hemi} \ --cortex \ --glmdir ${hemi}.group.diff.glmdir
done
I think the function is searching for " --y ${hemi}.norm_${hemi}_thickness.mgh" in the main freesurfer directory instead of going into each participant's folder. What am I missing? The first error that i get is:
" ... FSGD /dat2/maria/scripts/final/group.fsgd labelmask /dat/freesurfer/subjects/fsaverage/label/lh.cortex.label maskinv 0 glmdir lh.group.diff.glmdir IllCondOK 0 ReScaleX 1 DoFFx 0 Creating output directory lh.group.diff.glmdir Loading y from /dat/freesurfer/lh.norm_lh_thickness.mgh
*error: mghRead(/dat/freesurfer/lh.norm_lh_thickness.mgh, -1): could not open file ... done reading.ERROR: loading y /dat/freesurfer/lh.norm_lh_thickness.mgh* ..."
Does it mean that something is wrong with my group.fsgd file?
A sample of this file, just in case: " GroupDescriptorFile 1 Title ThickBlinds Class Class1 plus blue Class Class2 circle green Input sub-NW01W Class1 Input sub-NW02W Class1 ..."
I will be grateful for your help. Best, Maria Czarnecka
It looks like in the tutorial, mri_glmfit is invoked from the directory where ‘—y’ input file is located. Try to prepend the directory of your processed data to ‘—y’ input.
Yujing
From: freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu On Behalf Of Maria Czarnecka Sent: Sunday, March 2, 2025 7:43 PM To: freesurfer@nmr.mgh.harvard.edu Subject: [Freesurfer] cortical thickness group analysis
External Email - Use Caution Hello,
I am trying to run a group analysis on cortical thickness (two groups, no covariates). I have been trying to follow the tutorial (FsTutorialGroupAnalysis) but I run into a problem with the mri_glmfit. My script looks like this:
fspath="/dat/freesurfer"
for hemi in lh rh; do echo $hemi cd $fspath
mri_glmfit \ --y ${hemi}.norm_${hemi}_thickness.mgh \ --fsgd /dat2/maria/scripts/final/group.fsgd dods \ --C /dat2/maria/scripts/final/group.diff.mtx \ --surf fsaverage ${hemi} \ --cortex \ --glmdir ${hemi}.group.diff.glmdir
done
I think the function is searching for " --y ${hemi}.norm_${hemi}_thickness.mgh" in the main freesurfer directory instead of going into each participant's folder. What am I missing? The first error that i get is:
" ... FSGD /dat2/maria/scripts/final/group.fsgd labelmask /dat/freesurfer/subjects/fsaverage/label/lh.cortex.label maskinv 0 glmdir lh.group.diff.glmdir IllCondOK 0 ReScaleX 1 DoFFx 0 Creating output directory lh.group.diff.glmdir Loading y from /dat/freesurfer/lh.norm_lh_thickness.mgh error: mghRead(/dat/freesurfer/lh.norm_lh_thickness.mgh, -1): could not open file ... done reading. ERROR: loading y /dat/freesurfer/lh.norm_lh_thickness.mgh ..."
Does it mean that something is wrong with my group.fsgd file?
A sample of this file, just in case: " GroupDescriptorFile 1 Title ThickBlinds Class Class1 plus blue Class Class2 circle green Input sub-NW01W Class1 Input sub-NW02W Class1 ..."
I will be grateful for your help. Best, Maria Czarnecka
freesurfer@nmr.mgh.harvard.edu