Hi Antonin and Anderson,

That's wonderful ! I am able to run PALM now, without any problem.

Thank you so much for your help and time, I really appreciate that.

Best,
MJ



On Wed, Mar 8, 2017 at 6:30 AM, Anderson M. Winkler <winkler@fmrib.ox.ac.uk> wrote:
Hi all,

That's exactly as Antonin says -- I have very little to add :-)

Only a few suggestions:

- With surfaces, both cluster and TFCE statistics tend to be slow. Consider using the tail approximation ("-approx tail -n 500 -nouncorrected")

- Include -logp, so that the p-values are in log-10 scale. Significant p-values are then those above 1.3 (i.e., -log10(0.05). This will help to make the figures nicer later.

All the best,

Anderson



On 8 March 2017 at 00:19, Antonin Skoch <ansk@ikem.cz> wrote:
Dear Sahil,

I suppose, for qcache 1.3 the equivalent cluster-forming threshold z-value is

two-tailed test:
qnorm(1-10^-1.3/2)=1.958949

for one-tailed test:
qnorm(1-10^-1.3)=1.643704

(qnorm is R function call for quantile function of normal distribution, you can compute this by using other methods or use statistical z-tables)

And, the directionality of the hypothesis is I suppose specified by the sign of your contrast vector, as I wrote in my previous mail.

As for the output files, you can look at the documentation:

https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM/UserGuide#Output_files

For example, if you are looking for the p-values, used cluster extent inference and used t-contrast, the file with FWER-corrected p-values would be something like

output_basename_clustere_tstat_fwep.mgz

Antonin




Hello Martin and Antonin,

I was following this conversation very closely to understand how to use
PALM in FreeSurfer.
Can any of you please confirm in case I am interested in checking
correlation between gyrification index (LGI) and behavioral measure using
two tailed, p < 0.05:
Step 1: I used --cache 1.3
Step 2: Because (1-10^-1.3)= 0.95, so I will have to use -C 0.95 in palm
command

Could you please confirm if thats correct and the output *_tstat.mgz is the
final two-tailed corrected significant correlation map between LGI and
behavioral data?

Thanks a lot for this wonderful discussion.
Sahil

PS: For one-tailed: it will be -C -0.95 in palm command, correct?



On Tue, Mar 7, 2017 at 3:48 PM, Antonin Skoch <a...@ikem.cz> wrote:

> Dear Martin,
>
> after -s option, there have to be 2 arguments, as I specified in my previous 
> mail:
>
> -s fsaverage/surf/lh.white fsaverage/surf/lh.white.avg.area.mgh
>
> And beware that -C has to have negative sign, if your hypothesis is 
> one-tailed negative.
>
> Antonin
>
>
>
> Hi Antonin,
>
> Thank you so much for this detailed explanation, that's really useful.
>
> Following your instructions, I ran:
>
> palm -i lh.MEQ_LGI.10.mgh -s fsaverage/surf/lh.white.avg.area.mgh -d
> check.csv -t Contrast_MEQ.csv -n 5000 -m lh.MEQ_LGI.glmdir/mask.mgh -o
> myresults -Cstat extent -C 3.719016
>
> but I am getting following error:
>
> Running PALM alpha104 using MATLAB 9.0.0.341360 (R2016a) with the following
> options:
> -i lh.MEQ_LGI.10.mgh
> -s fsaverage/surf/lh.white.avg.area.mgh
> -d check.csv
> -t Contrast_MEQ.csv
> -n 5000
> -m lh.MEQ_LGI.glmdir/mask.mgh
> -o myresults
> -Cstat extent
> -C 3.719016
> Loading surface 1/1: fsaverage/surf/lh.white.avg.area.mgh
> Reading input 1/1: lh.MEQ_LGI.10.mgh
>
> Struct contents reference from a non-struct array object.
>
> Error in palm_takeargs (line 1632)
>             if any(size(plm.srf{s}.data.vtx,
> 1) == ...
>
> Error in palm_core (line 33)
> [opts,plm] = palm_takeargs(varargin{:});
>
> Error in palm (line 81)
> palm_core(varargin{:});
>
> Could you please help me in resolving this error?
>
> Thanks much.
>
> On Tue, Mar 7, 2017 at 2:55 PM, Antonin Skoch <a...@ikem.cz> wrote:
>
> > Dear Martin,
> >
> > input -i input file is
> >
> > lh.MEQ_LGI.10.mgh file in your glmdir directory (for left hemisphere).
> >
> > As you could read in following messages in the referenced thread in FSL
> > discussion forum, cluster-forming threshold need to be specified in z, not
> > in t.
> >
> > Therefore, you would have to select cluster forming threshold and specify
> > it as a z score.
> >
> > I think that your z-score for your original mri_glmfit-sim commandline
> > argument
> >
> > --cache 4 neg
> >
> > will be  -qnorm(1-10^-4)=-3.719016. (I am not perfectly sure since I never
> > tried negative one-side hypothesis testing in PALM).
> >
> > You could also use other statistics, such as cluster mass, or TFCE. See
> > PALM user guide.
> >
> > Do not include -pmethodp none and -pmethodr none, since you would need the
> > partitioning due your non-orthogonal design matrix.
> >
> > ?h.white.avg.area.mgh file (which you will find under fsaverage directory)
> > goes as second argument after -s option.
> >
> > Therefore I suppose the commandline for cluster extent inference with
> > cluster forming threshold p=0.0001, negative one-sided hypothesis, left
> > hemisphere, will be hopefully something like
> >
> > palm
> > -i y.mgh
> > -s fsaverage/surf/lh.white fsaverage/surf/lh.white.avg.area.mgh
> > -d Xg.csv
> > -t your_contrasts.csv
> > -n number_of_permutations
> > -m mask.mgh
> > -o output_basename
> > -Cstat extent
> > -C -3.719016
> > -saveglm
> > -savedof
> > -savemetrics
> >
> > The last 3 commandline options are only for diagnostical purposes.
> >
> > The output is surface overlay you can visualize in freeview.
> >
> > I use following code snippet for the reporting significant clusters in MNI
> > coordinates:
> >
> > # PALM output cluster extent p maps have 1 outside cluster - problem with
> > mri_surfcluster and also for display in freeView
> > #here we set values 1 to 0 in pmaps.
> > #done by binarizing and subtracting
> > if [[ $# -ne 2 ]]; then
> > echo "get cluster summary of PALM statistics. Expecting 2 arguments: 1-
> > input p-map, 2- hemisphere (lh/rh)"
> > exit
> > fi
> > mri_binarize --i $1 --min 1 --o p_bin.mgz
> > mris_calc --output ${1%%.mgz}_filtered.mgz $1 sub p_bin.mgz
> > mri_surfcluster --in ${1%%.mgz}_filtered.mgz --subject fsaverage --hemi $2
> > --surf white --annot aparc --thmin 0.000000001 --thmax 0.05 --mask mask.mgh
> > --sum ${1%%.mgz}_cluster.summary --nofixmni
> > rm p_bin.mgz
> >
> > They are not Bonferroni-corrected for 2 hemispheres (--2spaces).
> >
> > Regarding your design and contrast:
> >
> > Design has to be matrix of values. You can use qdec to produce Xg.dat file
> > with design matrix, then rename it to Xg.csv to be correctly readable by
> > PALM.
> >
> > Regards,
> >
> > Antonin
> >
> >
> >
> >
> >
> > Hi Antonin,
> >
> > As you suggested in discussion forum, I tried to run following command
> > after mri_glmfit:
> >
> > palm -s fsaverage/surf/lh.white -n 10000 -m mask.mgh -Cstat extent -C
> > 1.974975 -pmethodp none -pmethodr none -twotail -d Design_MEQ.txt -t
> > Contrast_MEQ.txt
> >
> > Running PALM alpha104 using MATLAB 9.0.0.341360 (R2016a) with the following
> > options:
> >
> > -s fsaverage/surf/lh.white
> >
> > -n 10000
> >
> > -m mask.mgh
> >
> > -Cstat extent
> >
> > -C 1.974975
> >
> > -pmethodp none
> >
> > -pmethodr none
> >
> > -twotail
> >
> > -d Design.txt
> >
> > -t Contrast.txt
> >
> > Found FSL in /usr/share/fsl/5.0
> >
> > Found FreeSurfer in /usr/local/freesurfer
> >
> > Found SPM in /usr/local/spm12
> >
> > Error using palm_takeargs (line 1141)
> >
> > Missing input data (missing "-i").
> >
> > Error in palm_core (line 33)
> >
> > [opts,plm] = palm_takeargs(varargin{:});
> >
> > Error in palm (line 81)
> >
> > palm_core(varargin{:});
> >
> > Looks like error is because its missing -i input here, I am not sure what's
> > input file here?
> >
> > Also, I am trying to correlate LGI versus behavioral score, regressing out
> > the effect of sex and age. So I just wanted to confirm if my design.txt and
> > contrast.txt files are correct here. Please find both following:
> >
> > Design file (Variables Behav, Age) as following:
> >
> > S001 Male 60 36
> >
> > S003 Female 73 29
> >
> > S004 Male 48 39
> >
> > .......so on......
> >
> > Contrast file as following:
> > 0 0 0.5 0.5 0 0 (same as *.mtx file used for glm_fit)
> >
> > Thank you so much for your help and time.
> >
> > On Tue, Mar 7, 2017 at 10:49 AM, Martin Juneja <mj70...@gmail.com> wrote:
> >
> > > Hi Antonin,
> > >
> > > Thanks a lot for your reply.
> > >
> > > Somehow, in the link you sent, I could not find any response to your
> > > email. But I can see your email to Anderson and command line parameters.
> > >
> > > As I am not an expert in using FreeSurfer, so would it be possible for you
> > > to share detailed step-by-step guide and PALM command after I run 
> > > mri_glmfit
> > > command and how and where to include '?h.white.avg.area.mgh' file?
> > >
> > > I would really appreciate any help.
> > >
> > > On Mon, Mar 6, 2017 at 4:28 PM, Antonin Skoch <a...@ikem.cz> wrote:
> > >
> > >> Dear Martin,
> > >>
> > >> I think yes, you can use PALM with FreeSurfer surfaces, see my
> > >> conversation with Anderson on FSL list:
> > >>
> > >> https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1604&L=FSL
> > > > > >> &D=0&1=FSL&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4&P=239088 > > >> > > >> but beware not to forget to include average the vertex area > > >> (?h.white.avg.area.mgh) file. > > >> > > >> Antonin > > >> > > >> > > >> If you don't have an orthogonal design, then you can't use > > >> mri_glmfit-sim. I think you can use PALM: > > >> > > >> https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM > > >> > > >> I have not tried it yet. > > >> > > >> Anderson, can you use PALM with surfaces? > > >> > > >> > > >> > > >> > > >> > > >> > > >> On 03/06/2017 05:23 PM, Martin Juneja wrote: > > >> > Hi Dr. Greve, > > >> > > > >> > I tried to run: mri_glmfit-sim --glmdir lh.MEQ_LGI.glmdir --sim perm > > >> > 1000 3 permcsd --sim-sign abs --cwpvalthresh .05 > > >> > It gives error that ERROR: design matrix is not orthogonal, cannot be > > >> > used with permutation. > > >> > > > >> > But when I run: mri_glmfit-sim --glmdir lh.MEQ_LGI.glmdir --sim perm > > >> > 1000 3 permcsd --sim-sign abs --cwpvalthresh .05 --perm-force, it > > >> > works. > > >> > > > >> > I am not sure whether I will have to make the design matrix > > >> > orthogonal. If so, could you please tell me how that can be done? > > >> > > > >> > Or using --perm-force should be fine? > > >> > > > >> > Thanks. > > >> > > > >> > On Mon, Mar 6, 2017 at 1:58 PM, Douglas N Greve > > >> > <gr...@nmr.mgh.harvard.edu <mailto:gr...@nmr.mgh.harvard.edu > > >> > <gr...@nmr.mgh.harvard.edu> > > >> > <gr...@nmr.mgh.harvard.edu> > > >> > <gr...@nmr.mgh.harvard.edu>>> wrote: > > >> > > > >> > This is a problem with using LGI in that it is already extremely > > >> > smooth > > >> > that the smoothness exceeds the limit of the look up table that we > > >> > supply. I recommend that you not use a gaussian-based correction > > >> > for > > >> > LGI. Instead, use permutation (see mri_glmfit-sim --help). > > >> > > > >> > > > >> > > > >> > On 03/06/2017 01:36 PM, Martin Juneja wrote: > > >> > > Hello everyone, > > >> > > > > >> > > I am trying to extract clusters showing significant correlation > > >> > > between LGI and a behavioral measure. I am able to extract PCC > > >> > and > > >> > > sig.mgh but at the last step when I try to run simulation command > > >> > to > > >> > > view corrected results and I run: > > >> > > > > >> > > mri_glmfit-sim --glmdir lh.MEQ_LGI.glmdir --cache 4 neg --cwp > > >> > 0.05 > > >> > > --2spaces > > >> > > > > >> > > I get following error: > > >> > > > > >> > > ERROR: cannot find > > >> > > > > >> > > > >> > /usr/local/freesurfer/average/mult-comp-cor/fsaverage/lh/cortex/fwhm35/neg/th40/mc-z.csd > > >> > > > > >> > > But I can see mc-z.csd file in fwhm30 etc. > > >> > > > > >> > > Full message on terminal window is attached following. > > >> > > > > >> > > Any help would be really appreciated. > > >> > > > > >> > > ----- Full message ---- > > >> > > > > >> > > cmdline mri_glmfit.bin --y lh.MEQ_LGI.10.mgh --fsgd MEQ.fsgd > > >> > dods --C > > >> > > Corr-MEQ-cor.mtx --surf fsaverage lh --cortex --glmdir > > >> > lh.MEQ_LGI.glmdir > > >> > > > > >> > > WARNING: unrecognized mri_glmfit cmd option mri_glmfit.bin > > >> > > > > >> > > SURFACE: fsaverage lh > > >> > > > > >> > > log file is lh.MEQ_LGI.glmdir/cache.mri_glmfit-sim.log > > >> > > > > >> > > /usr/local/freesurfer/bin/mri_glmfit-sim > > >> > > > > >> > > --glmdir lh.MEQ_LGI.glmdir --cache 4 neg --cwp 0.05 --2spaces > > >> > > > > >> > > $Id: mri_glmfit-sim,v 1.60 2016/04/30 15:13:36 greve Exp $ > > >> > > > > >> > > Mon Mar 6 11:11:13 MST 2017 > > >> > > > > >> > > setenv SUBJECTS_DIR > > >> > > /data/emot/Freesurfer/FreeSurferSegmentation/SB_AgingAll > > >> > > > > >> > > FREESURFER_HOME /usr/local/freesurfer > > >> > > > > >> > > Original mri_glmfit command line: > > >> > > > > >> > > cmdline mri_glmfit.bin --y lh.MEQ_LGI.10.mgh --fsgd MEQ.fsgd > > >> > dods --C > > >> > > Corr-MEQ-cor.mtx --surf fsaverage lh --cortex --glmdir > > >> > lh.MEQ_LGI.glmdir > > >> > > > > >> > > DoSim = 0 > > >> > > > > >> > > UseCache = 1 > > >> > > > > >> > > DoPoll = 0 > > >> > > > > >> > > DoPBSubmit = 0 > > >> > > > > >> > > DoBackground = 0 > > >> > > > > >> > > DiagCluster = 0 > > >> > > > > >> > > gd2mtx = dods > > >> > > > > >> > > fwhm = 35.073391 > > >> > > > > >> > > ERROR: cannot find > > >> > > > > >> > > > >> > /usr/local/freesurfer/average/mult-comp-cor/fsaverage/lh/cortex/fwhm35/neg/th40/mc-z.csd > > >> > > > > >> > > > > > >


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


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.



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


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.