Yes, that contrast is correct.

On 8/5/2019 3:11 PM, miracle ozzoude wrote:

        External Email - Use Caution        

Hello Doug, 

Thanks very much for your help. Your assumption was right in that i want to run a group comparison (i.e. test for a difference in amyloid-thickness slopes between the two groups). However, I am having a hard time creating the correct mri_glmfit and contrasts in this case. Based on your advice and searching through the forum (https://mail.nmr.mgh.harvard.edu/pipermail/freesurfer/2019-January/060029.html), i need 2 PVRs for each hemisphere in the mri_glmfit command. I gave it another shot below. Please let me know if i am correct. 

Thank you. 
Paul. 

## group1 comes first in my fsgd file. removing the effects of age and education
##amyloid-thickness. first pet pvr = 1 for group1 and 0 for group 2. 
mri_glmfit --y lh_pvr_grp1_thickness.mgh --fsgd project.fsgd dods --c pvr1.mtx --pvr  lh.pvr_grp1_pet.nii.gz \
--pvr allgrp2.lhmgxctx.fsaverage.sm05.zero.nii.gz  -surf fsaverage lh --cortex --glmdir lh.pet.thickness.glmdir
mri_glmfit --y rh_pvr_grp1_thickness.mgh --fsgd project.fsgd dods --c pvr1.mtx --pvr rh.pvr_grp1_pet.nii.gz \
--pvr allgrp2.rhmgxctx.fsaverage.sm05.zero.nii.gz -surf fsaverage lh --cortex --glmdir rh.pet.thickness.glmdir

contrast =  0 0 0 0 0 0 1 -1

##group 2 is second in my fsgd file. removing the effects of age and education
##amyloid-thickness. first pet pvr = 0 for group1 and 1 for group2
 mri_glmfit --y lh_pvr_grp2_thickness.mgh --fsgd project.fsgd dods --c pvr2.mtx --pvr  allgrp1.lhmgxctx.fsaverage.sm05.zero.nii.gz \
--pvr lh.pvr_grp2_pet.nii.gz -surf fsaverage lh --cortex --glmdir rh.pet.thickness.glmdir
mri_glmfit --y rh_pvr_grp2_thickness.mgh --fsgd project.fsgd dods --c pvr2.mtx --pvr allgrp1.rhmgxctx.fsaverage.sm05.zero.nii.gz \
--pvr rh.pvr_grp2_pet.nii.gz -surf fsaverage lh --cortex --glmdir rh.pet.thickness.glmdir

contrast = 0 0 0 0 0 0 -1 1


On Mon, Aug 5, 2019 at 12:26 PM Greve, Douglas N.,Ph.D. <DGREVE@mgh.harvard.edu> wrote:
That  mostly looks good.

I would suggest is to change your smoothing command to something like
mris_fwhm --smooth-only --s fsaverage --hemi lh --fwhm 5 --cortex --prune --i allgrp1.rlhmgxctx.fsaverage.sm00.nii.gz allgrp1.lhmgxctx.fsaverage.sm05.nii.gz
The only difference will be that any vertices that are 0 in the input will be excluded (pruned) from the smoothing mask.

The mri_glmfit command is not right. That command looks like it is for analyzing each group separately and independently. If that is what you want to do, then you don't need to go through all the extra stuff of creating zero files, etc. I had assumed that you wanted to do some kind of comparison between groups. If so, then you would use a single file with all your data in it (probably what you were using before), and your fsgd file would have both groups.

1) will my fsgd file contain both groups?
yes, see above
2) If the answer from question is yes, i should have 2 contrasts (pvr1.mtx for group1 and pvr2.mtx for group2). yes/no?
Again, if all you want to do is to test the pvr for each group separately, then you don't need to go through the processes of creating zero files, etc. In any event, if you want to test a pvr, then you need a contrast for it.
3) below is a sample of my fsgd file. are the constrasts correct?
hard to say without resolving the questions above. You will need to have a value in the contrast for each pvr.



On 8/2/2019 3:56 PM, miracle ozzoude wrote:

        External Email - Use Caution        

Hello Doug, 

Thanks for answering. Based on your explanation, i wrote out a series of command needed to execute this. Please let me know if i made any mistakes/correct. 
##step1 concatenating the 10 amyloid pet volumes files projected to surface using mri_vol2surf for group1
mri_concat --f grp1.lhmgxctx --o allgrp1.lhmgxctx.fsaverage.sm00.nii.gz --prune
mri_concat --f grp2.rhmgxctx --o allgrp1.rhmgxctx.fsaverage.sm00.nii.gz --prune 

##step2 concatenating the 20 amyloid pet volumes files projected to surface using mri_vol2surf for group2
mri_concat --f grp2.lhmgxctx --o allgrp2.lhmgxctx.fsaverage.sm00.nii.gz --prune
mri_concat --f grp2.rhmgxctx --o allgrp2.rhmgxctx.fsaverage.sm00.nii.gz --prune

##step3 smooth on the surface for each hemisphere for group1 
mri_surf2surf --hemi lh --s fsaverage --sval allgrp1.lhmgxctx.fsaverage.sm00.nii.gz --fwhm 5 --cortex --tval allgrp1.lhmgxctx.fsaverage.sm05.nii.gz
mri_surf2surf --hemi rh --s fsaverage --sval allgrp1.rlhmgxctx.fsaverage.sm00.nii.gz --fwhm 5 --cortex --tval allgrp1.rhmgxctx.fsaverage.sm05.nii.gz  

##step4 smooth on the surface for each hemisphere for group2
mri_surf2surf --hemi lh --s fsaverage --sval allgrp2.lhmgxctx.fsaverage.sm00.nii.gz --fwhm 5 --cortex --tval allgrp2.lhmgxctx.fsaverage.sm05.nii.gz
mri_surf2surf --hemi rh --s fsaverage --sval allgrp2.rlhmgxctx.fsaverage.sm00.nii.gz --fwhm 5 --cortex --tval allgrp2.rhmgxctx.fsaverage.sm05.nii.gz

##step5 create files of zeros for group1 for each hemisphere
fscalc allgrp1.lhmgxctx.fsaverage.sm05.nii.gz mul 0 -o allgrp1.lhmgxctx.fsaverage.sm05.zero.nii.gz
fscalc allgrp1.rhmgxctx.fsaverage.sm05.nii.gz mul 0 -o allgrp1.rhmgxctx.fsaverage.sm05.zero.nii.gz 

 ##step6 create files of zeros for group2 for each hemisphere
fscalc allgrp2.lhmgxctx.fsaverage.sm05.nii.gz mul 0 -o allgrp2.lhmgxctx.fsaverage.sm05.zero.nii.gz
fscalc allgrp2.rhmgxctx.fsaverage.sm05.nii.gz mul 0 -o allgrp2.rhmgxctx.fsaverage.sm05.zero.nii.gz

##step7 create pvr files for group1 for each hemisphere
mri_concat  allgrp1.lhmgxctx.fsaverage.sm05.nii.gz allgrp2.lhmgxctx.fsaverage.sm05.zero.nii.gz --o lh.pvr_grp1_pet.nii.gz
mri_concat  allgrp1.rhmgxctx.fsaverage.sm05.nii.gz allgrp2.rhmgxctx.fsaverage.sm05.zero.nii.gz --o rh.pvr_grp1_pet.nii.gz 

##step8 create pvr files for group2 for each hemisphere
mri_concat  allgrp1.lhmgxctx.fsaverage.sm05.zero.nii.gz allgrp2.lhmgxctx.fsaverage.sm05.nii.gz --o lh.pvr_grp2_pet.nii.gz
mri_concat  allgrp1.rhmgxctx.fsaverage.sm05.zero.nii.gz allgrp2.rhmgxctx.fsaverage.sm05.nii.gz --o rh.pvr_grp2_pet.nii.gz

###-----repeat steps 1-8  for cortical thickness-------

###run glm-fit for group1 
mri_glmfit --y lh.pvr_grp1_pet.nii.gz --fsgd project.fsgd dods --c pvr1.mtx --pvr lh_pvr_grp1_thickness.mgh --surf fsaverage lh --cortex --glmdir lh.grp1.pet.thickness.glmdir
mri_glmfit --y rh.pvr_grp1_pet.nii.gz --fsgd project.fsgd dods --c pvr1.mtx --pvr rh_pvr_grp1_thickness.mgh --surf fsaverage lh --cortex --glmdir rh.grp1.pet.thickness.glmdir 
 
###run glm-fit for group2
mri_glmfit --y lh.pvr_grp2_pet.nii.gz --fsgd project.fsgd dods --c pvr2.mtx --pvr lh_pvr_grp2_thickness.mgh --surf fsaverage lh --cortex --glmdir lh.grp2.pet.thickness.glmdir
mri_glmfit --y rh.pvr_grp2_pet.nii.gz --fsgd project.fsgd dods --c pvr2.mtx --pvr rh_pvr_grp2_thickness.mgh --surf fsaverage lh --cortex --glmdir rh.grp2.pet.thickness.glmdir 

 
My questions. 
1) will my fsgd file contain both groups? 
2) If the answer from question is yes, i should have 2 contrasts (pvr1.mtx for group1 and pvr2.mtx for group2). yes/no?
3) below is a sample of my fsgd file. are the constrasts correct? 

Thank you very much. 
Paul. 
The fsgd file lists:
-------------------------------------------------------------
GroupDescriptorFile 1
Title Relationship Amy-thick reg out age and education
Class g1
Class g2
Variable Age Education
Input XX1 g1 60 16
Input YY1 g2 62 20
-------------------------------------------------------------
matrix for group1:
pvr1.mtx= 1 0 0 0 0 0 0 
is there a relationship between amyloid-thickness in group1 regressing out age
and education? 
matrix for group2:
pvr2.mtx= 0 1 0 0 0 0 0
is there a relationship between amyloid-thickness in group2 regressing out age
and education?

On Thu, Aug 1, 2019 at 9:44 PM Greve, Douglas N.,Ph.D. <DGREVE@mgh.harvard.edu> wrote:
Each PVR adds a single column to the design matrix. In a two group design, this can make it tricky to set up. Let's say you have 10 of group1 and 20 of group2. You will need to create two PVR files, each with 30=10+20 frames. In the first one, the first 10 frames will be cortical thickness (or amyloid sampled on the surface) of group1; the next 20 frames will be all zeros. For the 2nd PVR, the first 10 frames will be 0s and the next 20 frames will be the cortical thickness (or amyloid) for group2. I would start by running mris_preproc for the two groups separate (so 2 files, one with 10 frames the other 20 frames). Then create the file of zeros using
fscalc group2.mgz mul 0 -o group2.zeros.mgz
Then
mri_concat group1.mgz group2.zeros.mgz --o pvr1.mgz
Then create the contrast based on the FSGD, but then add two more numbers, one for PVR1 (which tests for the within group correlation), and one for PVR2


On 8/1/2019 3:14 PM, miracle ozzoude wrote:

        External Email - Use Caution        

Please, can anyone help me with this. 
Thank you

Paul

---------- Forwarded message ---------
From: miracle ozzoude <miracooloz@gmail.com>
Date: Wed, Jul 31, 2019 at 2:11 PM
Subject: multimodal analysis (pet and cortical thickness relationship) using --pvr
To: Douglas N Greve <freesurfer@nmr.mgh.harvard.edu>


Hello Experts, 

I am performing an analysis looking at the relationship between amyloid uptake and cortical thickness using --pvr flag in mri_glmfit. I've 2 groups and 2 variables (age and education). I want to run a within group analysis while regressing out age and education (i.e. Within group 1, is there a negative relationship between amyloid uptake and cortical thickness  regressing out the effects of age and education). 

However, i'm not sure how my pvr contrasts will look like. Below are my fsgd and an attempt at creating contrasts. Please, can you let me know if my contrasts are correct based on my questions. 

Thank you. 

Best, 
Paul

The fsgd file lists:
-------------------------------------------------------------
GroupDescriptorFile 1
Title Relationship Amy-thick reg out age and education
Class g1
Class g2
Variable Age Education
Input XX1 g1 60 16
Input XX2 g1 58 14
Input YY1 g2 62 20
Input YY1 g2 62 20
-------------------------------------------------------------
matrix for group1:
pvrgroup1= 1 0 0 0 0 0 0 
is there a relationship between amyloid-thickness in group1 regressing out age
and education? 
matrix for group2:
pvrgroup2= 0 1 0 0 0 0 0
is there a relationship between amyloid-thickness in group2 regressing out age
and education?

_______________________________________________
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

_______________________________________________
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

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer