The design you showed has 40 rows...

On 30 April 2018 at 11:17, Tudor Popescu <[log in to unmask]> wrote:
Thanks Anderson for your kind reply! Indeed, I had in the meantime figured that the .con problem was in the header incongruency. But am now still stuck with the "number of rows" error pasted in my earlier email! Using fslinfo on my diff_s2 image, as you suggest, confirms that indeed the number of volumes ("dim4") is 20 - the same as the number of rows that I have in (one of the) designs that I tried.

Cheers,
Tudor

On 30 April 2018 at 15:45, Anderson M. Winkler <[log in to unmask]> wrote:
Hi Tudor,

Please see below:

On 23 April 2018 at 08:11, Tudor Popescu <[log in to unmask]> wrote:
Hi Anderson,

Thanks for getting back to me.  Let me reply to your points below.

I think so, although for the voxelwise you might want to start with the smoothed one.
In the commands above, I had first computed the difference 4D image, then smoothed this image and taken it randomise. Do I understand well that I need to reverse this order, i.e. smooth the starting images (*_struc_GM_to_template_GM_mod), compute the difference 4D image from these, and take that to randomise?

Sorry, I thought you meant you started randomise with the non-smoothed. Computing the difference before or after smoothing doesn't make any difference.

 

I'm a bit worried with the use of FNIRT above. So the masks aren't in standard space yet?
The masks were initially created in standard space, but with the FNIRT, I was trying to align them to the study-specific (VBM) template space. Is that wrong? To me the masks look fine, although I am not sure how I can check which space they are really in!..

For FNIRT, you need to align a brain to another brain, not a mask to a brain. You can apply previously computed transformations to a mask, though (with applywarp).
 

Also, having run randomise as
randomise -i diff_s2.nii.gz -m GM_mask -o diffs -d diffs.mat -t diffs.con -T -n 5000
I get the error
Loading Data: ERROR: Program failed. An exception has been thrown: diffs.con has insufficient data points
even though my .con and my .mat files (attached) both have the same number of columns. As instructed here, I defined my design with one EV as FFX (pre-to-post difference) and the remaining EVs as RFX coding for subject identity; and accounted for each EV in the contrast vector.

At top, you .con file says there are 40 lines, but inside you use only 2.

All the best,

Anderson

 

Cheers,
Tudor


On 23 April 2018 at 05:18, Anderson M. Winkler <[log in to unmask]> wrote:
Hi Tudor,

Please see below:

On 16 April 2018 at 11:09, Tudor Popescu <[log in to unmask]> wrote:
Dear FSL experts,

I have pre and post-intervention data for a single group of subjects, and I'd like to use VBM to compare the post-pre difference against zero, at the whole-brain & ROI-level. To that end, I've merged all "pre" files into a single 4D image; same for "post"; defined their difference as a new 4D image; and smoothed it:

fslmerge -t all_pre_struc_GM_to_template_GM_mod.nii.gz ./struc/??_1_struc_GM_to_template_GM_mod.nii.gz
fslmerge -t all_post_struc_GM_to_template_GM_mod.nii.gz ./struc/??_2_struc_GM_to_template_GM_mod.nii.gz
fslmaths all_post_struc_GM_to_template_GM_mod.nii.gz -sub all_pre_struc_GM_to_template_GM_mod.nii.gz all_diff_struc_GM_to_template_GM_mod.nii.gz
fslmaths all_diff_struc_GM_to_template_GM_mod.nii.gz -kernel gauss 2 -fmean all_diff_s2_struc_GM_to_template_GM_mod.nii.gz

For whole-brain, I then typed:
randomise -i all_diff_s2_struc_GM_to_template_GM_mod.nii.gz -m GM_mask -o analysis1 -d design.mat -t design.con -T -n 5000  

For the ROI analysis, I know that randomise can also be used together with the relevant ROI mask, but for now I extracted the average values of grey matter volume from my ROI across all subjects:
fslmaths /masks/F3 -mul /FAST/MNI_2mm_GM /masks_2mm/masks/F3_GM -odt float
fnirt --ref=/stats/template_GM.nii.gz --in=/masks_2mm/masks/F3_GM.nii.gz --iout=/masks/F3_GM_template.nii.gz
fslmaths all_diff_s2_struc_GM_to_template_GM_mod.nii.gz -mul /masks_2mm/masks/F3_GM_template finalImage -odt float
fslstats -t finalImage -M

I have the following doubts:
1) Have I started from the correct files (*_struc_GM_to_template_GM_mod) to compute my difference image? 

I think so, although for the voxelwise you might want to start with the smoothed one.
 
2) Should mean GMV values really be extracted from the *smoothed* difference image, since no voxel-wise stats are actually being done? It might be that smoothing averages values in a similar way anyway, but even so, do we not need to extract values from the maximum-resolution (unsmoothed) image?

I would use the non-smoothed, otherwise voxels from outside the mask contribute to what you find inside. Having said that I'm a bit worried with the use of FNIRT above. So the masks aren't in standard space yet? To align them, need to have a GM image in that same space as the mask, then in a second stage, use "applywarp" to align the mask. I think your /masks/F3_GM_template.nii.gz file may not be as correct as expected.

All the best,

Anderson
 

Thanks in advance for any help!

Cheers,
Tudor