Dear Leonardo,

Let's call the maximum of the 10 maximum (produced with the -N option) the "global maximum distribution", or simply GMD, so that the description below is easier to follow.

To find the 95-th percentile of the GMD for 20k permutations, identify which is the 19000-th largest value (20000*0.95 = 19000). If you produced the GMD from the 10 .txt files generated for voxelwise p-values, i.e. *_vox_corrp_tstat*.txt, then this is the threshold to be applied to each of the 10 t-statistic images for each TBSS run.

The same applies for TFCE if you used the 10 files generated for it, i.e. *_tfce_corrp_tstat*.txt. However, the images to be thresholded aren't normally produced, so you need to take the t-statistic images and generate the corresponding TFCE images with fslmaths (pay attention to the parameters E, H and conn), then threshold them with the value you'll find at the 95-th percentile of the GMD for TFCE.

If instead of simply thresholding, you want a corrected p-value for each voxel using the tstat or TFCE, then things are different. Save the GMD you found as a text file in a similar format as those created by randomise, i.e, one value per line, with the as many lines as permutations (20k in this example). Put the attached 2 functions in some place where Matlab or Octave can find, and use the "cdftool.m" to convert each of the t-statistic or TFCE images to images of p-values, having the respective GMD as the empirical distribution (use the option "data" of cdftool; the option "custom" will work too, but "data" is simpler to interact).

For cluster extent as it seems you are using, save the GMD generated for the 10 *_clustere_corrp_tstat*.txt files. The images with the cluster sizes to be converted to p-values you need to generate with the command "cluster" (use the option --osize). Then use the cdftool, just as above.

Finally, for cluster mass, it's slightly more involved, as it's necessary to create an image where the voxels for each cluster contain the value of the respective cluster mass. This can be done starting with the command cluster (option --oindex), then some calls to fslmaths and fslstats inside a for-loop. Feel free to ask if you need help with this.

All the best,

Anderson



2013/1/20 leonardo cerliani <[log in to unmask]>
dear Anderson,
thanks again for your help. Just a small thing, I will not bother you
too much, I promise :O)
For the matlab implementation, it's clear, I use matlab routinely, so
that is not a problem.
I am trying with some sample data to look at the output of randomise
with the -N option. I have values like

909791.625000
46123.113281
36556.835938

which, if I remember correctly, should represent the distribution of
maximum cluster size (or mass) across relabelings.

You adviced me to take the 95 prctile value of the max across analyses
(so for 10 analyses and 20k relabelings, take the max for each row,
corresponding to one relabeling, and then use the final 20k MAX values
to get the 95 prctile) and to use that as the final threshold in
fslmaths to threshold the map corresponding to the unpermuted
statistics.

I cannot understand how to perform this last step. Can I please ask
you a hand on that?


all the best,
leonardo




On Fri, Jan 18, 2013 at 7:22 PM, Anderson M. Winkler
<[log in to unmask]> wrote:
> oops, just a correction: for Matlab/Octave, it has to be max(X,[],2), not
> simply max(X,2). The dimension is the 3rd argument, not the second.
> Anderson
>
>
> 2013/1/18 Anderson M. Winkler <[log in to unmask]>
>
>> Dear Leonardo,
>>
>> I assume this is all the same data (the same 4D file used as input for
>> randomise), and that for each of the 10 instances of TBSS, you use a similar
>> design, changing only the single EV that you have in the design, which is
>> the data derived from the ROIs from a different modality, is this correct?
>> If yes, then the following should work:
>>
>> 1) Run randomise for all the 10 different instances of TBSS, making sure
>> to use the same seed and the same number of permutations for all. Use the -N
>> option to save the maximum statistic for each run. At the end you'll have 10
>> different text files, each one containing, on each line, the largest
>> statistic observed for the respective permutation. If you run, say, 20k
>> permutations, each of these files will contain a column of 20k values (one
>> per line).
>>
>> 2) Use Matlab, Octave, R, Python, Excel, LibreOffice Calc, or your
>> favourite tool to load these 10 files all at once, and assemble them as an
>> array/table/spreadsheet, putting side-by-side the 10 files, i.e., the table
>> should contain 10 columns (one per TBSS run) and 20k rows (one per
>> permutation).
>>
>> 3) Once the table is assembled, take the maximum across rows. If you are
>> using Matlab or Octave, use max(X,2), where X is the table. If you are using
>> Excel or LibreOffice, in the 11th column (letter K), use a formula such as
>> =MAX(A1:J1) and expand it until the last, =MAX(A20000:J20000).
>>
>> 4) Sort the values of this column with the maximum values. If there are no
>> ties, locate the value that is in the 95 percentile. Write down this value:
>> this is the threshold that you can apply (with fslmaths) to the unpermuted
>> statistical images (all the 10 from the 10 separate TBSS runs) to correct
>> for family-wise error rate (FWER).
>>
>> From your description, TBSS data with EV derived from another modality, I
>> believe these are all quantitative variables, with no ties, such that it is
>> very unlikely to find ties in the permutation distribution. However, if you
>> observe ties in the column with the maximum values, let me know and I send
>> you a small Matlab function that deals with these cases.
>>
>> Hope this helps!
>>
>> All the best,
>>
>> Anderson
>>
>>
>> 2013/1/18 Leonardo Cerliani <[log in to unmask]>
>>>
>>> dear FSL people,
>>> I have a question related to how to correct the final threshold in case
>>> of performing several TBSS (actually randomise). It may sound strange, so
>>> let me explain:
>>>
>>> Suppose you have some measures acquired from a different modality (not
>>> DWI) in 10 regions of interest, and you want to perform a correlation with
>>> FA values voxelwise, using randomise and then correcting with TFCE.
>>> The question is: what is your best guess about how to correct the final
>>> significance threshold for the fact of having done 10 TBSS instead of
>>> one...?
>>> I hope the question does make sense to you (it does to some reviewers...)
>>>
>>> Thank you very much for your help!
>>>
>>> leonardo
>>>
>>>
>>> --
>>> http://about.me/leonardo.cerliani
>>>
>>> http://www.nin.knaw.nl/research_groups/keysers_group/team/leonardo_cerliani/
>>>
>>> Leonardo Cerliani, PhD
>>> BCN Neuro-Imaging Center
>>> University Medical Center Groningen
>>> Antonius Deusinglaan 2 (room 131)
>>> tel. +31.363.8805
>>> 9713 AW Groningen - The Netherlands
>>>
>>> Social Brain Lab
>>> Netherlands Institute for Neuroscience
>>> Royal Netherlands Academy of Arts and Sciences
>>> Meibergdreef 47, 1105 BA Amsterdam, NL
>>>
>>>   ___
>>>  {o,o}
>>>  |)__)
>>> --"-"--
>>> http://openlibrary.org/people/leonardocerliani/lists
>>
>>
>



--
http://about.me/leonardo.cerliani
http://www.nin.knaw.nl/research_groups/keysers_group/team/leonardo_cerliani/

Leonardo Cerliani, PhD
BCN Neuro-Imaging Center
University Medical Center Groningen
Antonius Deusinglaan 2 (room 131)
tel. +31.363.8805
9713 AW Groningen - The Netherlands

Social Brain Lab
Netherlands Institute for Neuroscience
Royal Netherlands Academy of Arts and Sciences
Meibergdreef 47, 1105 BA Amsterdam, NL

  ___
 {o,o}
 |)__)
--"-"--
http://openlibrary.org/people/leonardocerliani/lists