oh, it wouldn't be strictly upside down (-z); whatever, it's -x for LR flipping on fslswapdim.

Am 01.02.14 18:56, schrieb Anderson M. Winkler:
[log in to unmask]" type="cite"> Hi Charlie,

I suspect you aren't doing it right.... If you are finding p-values so low (<0.03), you are probably using all 8 images (4 subjects, 2 timepoints) in randomise with the option -1. But this isn't right, because sign-flipping (this is what the -1 option does) each observation individually is invalid in your design, given the repeated measurements.

If you really want to put all 8 observations in the same design, you have to construct a design matrix, as you say, as a paired t-test, but also defining one exchangeability block per subject and entering this information with the option -e in randomise, and without the option -1. Note that this is not described in the manual, exactly because for these simpler repeated measurements designs, it's simpler and less error prone to do subtractions as I described in one of the previous emails.

Doing as above, with the exchangeability blocks, there will be 2 possible permutations per subject and so, with 4 subjects, 2^4=16, exactly the same number you'd get by subtracting as pointed out earlier. Then the smallest possible p-value will be 1/16=0.625.

The way as I believe you are doing, with -1 and all 8 observations, gives 2^8=256 sign-flips and 1/256=0.00391 as the smallest possible p-value. It may look good, but in fact, it's incorrect.

Regarding testing the opposite effect: you can flip each of the original images and run tbss_sym again, or you can flip the all_FA_symmetrised_skeletonised.nii.gz and subtract the original from it (R-L instead of L-R) and mask the opposite side. You can also edit the tbss_sym script and, in the last line, remove the option -roi and what comes after it except the very last argument. This will show the other hemisphere, where the differences won't be for L-R, but for R-L. See a quick figure attached on how to read the output if you "unmask" the other side.

All the best,

Anderson

PS: For flipping, use fslswapdim -x. The -y (as I had mistakenly written) would make the brain upside down.


Am 31.01.14 21:58, schrieb Charles Leger:
[log in to unmask]" type="cite">
Thank you Anderson for you meticulous guidance. I quickly ran the initial tbss_sym pilot project.

The corrected tbss_tfce_corrp_stat1 for L>R (standard tbss_syn script and randomise -1 option) shows several instances of tracts with significant (p <.03, or in fslview max: min .97:1) leftward asymmetry.

To test for R>L using the glu_gui, perhaps a paired t-test would be OK, but from the wizard (and contrasts) this looks like it would test for both L>R and R>L. The TBSS guide also says the data can be inverted and randomize could be rerun.  I know the given tbss_sym script is left-right flipped and  the inverted version would, I assume, be right-left fipped. I am uncertain about how to do the latter, though it seems preferable as the L>R is already done. Which would you recommend, and if is the inverted version what script alterations would be appropriate.

Finally, if the additional R>L asymmetry test is run, I imagine that it would create a tbss_tfce_corrp_stat2 file, and not overwrite the existing L>R tbss_tfce_corrp_stat1 file.

There is no urgency in responding. I need to allocate some time now  to loading the tbss data into R.

Thank for being so patient...

Best,
Charlie


On Thu, Jan 30, 2014 at 6:52 PM, Anderson M. Winkler <[log in to unmask]> wrote:
Hi Charlie,

Please, see below:

Am 30.01.14 18:51, schrieb Charles Leger:
Anderson,
I am hesitant to trouble you again, but with my minimal understanding of imaging and FSL I wanted to clarify a  few points. I apologize for the rudimentary nature of my questions. 

Prior to running tbss_1_preproc, participant FA images copied to a specified folder are renamed in a "logical order" so patients are distinguished from controls. 

However, if left vs right testing is planned (tbss_sym) in a single group of patients with no controls, a group differentiating prefix (e.g. Con_FA_c1.nii.gz, Pat_FA_p1.nii.gz) is not used; patient FA files should be distinguished by unique name only (e.g. AK_FA.nii.gz, JB_FA.nii.gz). Is this correct?

Yep, that's right. It's ok to have a single group, but it's a good idea to use names that are ordered in a predictable way, e.g. in alphabetical order, and avoiding mixing upper and lower-case letters, and aldo keeping constant the length of numberical fields (put trailing zeroes as needed). This prevents the TBSS scripts from using the files in a sequence that isn't the same as you'd use if looking the files as they are listed, e.g., in Finder in Mac, or Dolphin in Linux.

The order of the files is the same order as the scripts generate the 4D file -- the same file that you'll have to disassemple later. So you definitely need to know the order of the subjects and timepoints on that file, and the way as you name them at the beginning is crucial to avoid mixing them up later.


In the last correspondence you mentioned to first load all images directly into R (recall, I need to run additional stats such as histograms in R on the tbss_sym data). Subsequently I should then load the 4D and the mask, then mask the data inside R before making the histograms or any other plot. 

I know I am asking for a "paint by numbers response" but I don't want to misinterpret your instructions. -By "load all images", you are referring to...

-By "load the  4D and the  mask", you are referring to...

...to the 4D file that tbss_sym will generate (all_FA_symmetrised_skeletonised.nii.gz) and the mask, which is a 3D file (mean_FA_symmetrised_skeleton_mask.nii.gz). I don't use R so I can't offer any help with this, maybe others in the list could. But regardless on how the files are loaded, the all_FA_* file contains many zeros, and you'll want to get rid of them. Hence the need for the mask, that will help to select only the voxels that contain values of interest for the histograms.


My confusion stems in part from a meager grasp of file types and vernacular:  dtifit and tbss_syn files show  datatype 16 in fslinfo;, only  the originally dcm2nii files and eddy corrected files have the datatype 4.  I assumed that I would be able to run R stats on tbss_sym stats output files.

You can make histograms of images of any datatype. They just need to be read into R.

All the best,

Anderson




On Mon, Jan 27, 2014 at 5:39 PM, Anderson M. Winkler <[log in to unmask]> wrote:
Hi Charlie,

Your randomise call looks correct to me. You can drop the option -V, as it has no effect in recent version (it was to produce verbose outputs).

For the histograms, it depends. For a global histogram (all subjects and across space), probably the simplest is just to load the images directly into R. I don't use R myself so I can't help. In any case, you'd then load the 4D and the mask, then mask the data inside R before making the histograms or any other plot.
Using fslmeants will give too few data: for 10 subjects, just 10 values). I think I wouldn't use it for this purpose.

All the best,

Anderson


Am 27.01.14 21:56, schrieb Charles Leger:
Thank you Anderson for replying so promptly and in such detail. First, I will have access to additional diffusion-weighted data which will increase the number of participants to 10 (n=10) , still too low a number to have much statistical power but better than the previously planned  n=4.

At this stage , my understanding of TBSS and FSL is only elementary, and based on what you have conveyed, and in respect to tbss_sym, I would prefer to start with just a basic left-right ( or the reverse) test.

Following from the TBSS guide,  and after completing steps 1 to 4, would this be correct for a simple left-right test of asymmetry?

randomise -i all_FA_skeletonised_left_minus_right.nii.gz -o tbss -m mean_FA_symmetrised_skeleton_mask.nii.gz -1 -n 5000 --T2 -V

Also, if I want to complete a histographic analysis of the FA data in R statistics, would you recommend fslmeants and if so would an appropriate string be

fslmeants  -i all_FA_skeletonised_left_minus_right.nii.gz -o mean_values_file.txt

Thank you,
Charlie






On Mon, Jan 27, 2014 at 3:19 PM, Anderson M. Winkler <[log in to unmask]> wrote:
Hi Charlie,

To run this as a single design on its full generality, with the 3 contrasts (effect of side, effect of time, and interaction), and taking the repeated measures into account (something as a 2x2 ANOVA, with the repeated measures), it'd be necessary a certain permutation strategy that, as of today, isn't available in randomise. However, you can still investigate differences, but you'll need to tweak a bit the pipeline and run randomise 3 times:

- To test the effect of side regardless of time: average the two timepoints for each subject (or just sum t1+t2), then subtract L-R, and run randomise with the option -1.
- To test the effect of time regardless of side: average each image with itself after flipping (or just sum, L+R), then compute t2-t1, and run randomise with the option -1.
- To test the interaction of side and time, compute L-R, then t2-t1, then run randomise with the option -1.

To do this, you'll have to take the file all_FA_symmetrised_skeletonised.nii.gz, which is a 4D file, disassemble it (with fslsplit), rename the outputs with meaningful names, e.g. L_subj01_t1.nii.gz, etc, then flip each one (fslswapdim -y) to have the corresponding R_subj01_t1.nii.gz, etc, then compute the sums and differences as above (use fslmaths -add and -sub), then assemble back as 3 new 4D files (fslmerge), and only them run randomise. Note that the file all_FA_skeletonised_left_minus_right.nii.gz already contains the L-R differences, but it's probably simpler to begin and do all starting with the all_FA_symmetrised_skeletonised.nii.gz.

For each randomise run you'll have only 4 images in each 4D file, so only 2^4=16 possible sign-flips, which isn't much even for a pilot study. Replacing randomise with a parametric test wouldn't help much either, as you'd have only 3 degrees of freedom per run. I suggest that you try to have more images, even for a pilot.

Hope this helps.

All the best,

Anderson


Am 27.01.14 18:24, schrieb charlie Leger:

A few questions regarding tbss_sym FA (pilot project) with a repeated-measures design (within-subjects) 4 subjects (n=4), scanned at two time points; initially and 8 months later.

The tbss guide suggests using the option -1 for left-right testing in randomise. I don’t think this randomise setting can be used for this project which has two factors: left vs right and time which is a total of 4 levels. This could be set-up as a 2 factor, 2-level Anova (asymmetry: left vs right, time: before and after 8 months), though pairwise test are ultimately needed.

I did use the glm_gui to attempt make 2-factor, 2-level design (n=4) and can forward it.

Any suggestions in helping to set up the appropriate design and “randomise” call (e.g. randomise -i all_FA_skeletonised_left_minus_right.nii.gz -o tbss -m mean_FA_symmetrised_skeleton_mask.nii.gz -1 -n 5000 --T2 -V) would be much appreciated.

Charlie