Re: [Freesurfer] Cluster-Defining Threshold of p=0.025

2017-09-14 Thread Douglas N Greve
Andy, please remember to post to the FS list, thanks. As for your 
question, this is a bug in mri_glmfit-sim that hard codes the allowable 
thresholds. I've attached a version that should work with 1.6.



On 09/14/2017 10:06 AM, Jahn, Andrew wrote:
Thanks again; I was able to create new simulation tables. However, 
when I run mri_glmfit-sim, I get the following error:


foreach dir (results_Directory)
mri_glmfit-sim \
--glmdir {$dir} \
--mczsim 1.6 abs \
--cwp 0.05  \
--2spaces
end

ERROR: thresh = 1.6, must be 1.3, 2.0, 2.3, 3.0, 3.3, 4.0


I get this error even though I have the tables located in 
$FREESURFER_HOME/average/mult-comp-cor/fsaverage/lh/cortex/fwhm10/abs. 
Is there something I'm missing?



Best,

-Andy



--
Douglas N. Greve, Ph.D.
MGH-NMR Center
gr...@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

#!/bin/tcsh -f
set VERSION = '$Id: mri_glmfit-sim,v 1.66 2016/11/16 20:52:22 greve Exp $';
setenv LANG en_US.UTF-8

set inputargs = ($argv);

set glmdir = ()
set nulltype = ();
set nsim = ()
set thresh = ()
set csdbase = ()
set simsign = ()
set cwpvalthresh = .05
set Overwrite = 0;
set DoSim = 1;
set LF = ();
set AllDoneFile = ();
set Seed = ();
set fwhmOverride = ();
set fwhmAdd = 0;
set UseUniformPDF = 0;
set UniformPDFMin = ();
set UniformPDFMax = ();
set DiagCluster = 0;
set PBNodeType = ();
set UseCache = 0;
set PermForce = 0;
set PermResid = 0; # use residual when running permutation, ter Braak method
set UseGRF = 0;
set volsubject = fsaverage;
set subjectOverride = ();
set Bonferroni = 0;
set ReportCentroid = 0;
set annot = aparc
set IsPVR = 0;
set DoClusterMean = 1
set OutputAnnot = 1
set DoGRFOCNAnat = 0;
set y = ()

set nJobs = 1;
set DoBackground = 0;
set DoPBSubmit = 0;
set DoPoll = 0;
set tSleepSec = 10;

set CacheDir = $FREESURFER_HOME/average/mult-comp-cor
set CacheLabel = cortex;

set tmpdir = ();
set CleanUp = 1;
set PrintHelp = 0;

if($#argv == 0) goto usage_exit;
set n = `echo $argv | grep -e --help | wc -l` 
if($n != 0) then
  set PrintHelp = 1;
  goto usage_exit;
endif
set n = `echo $argv | grep -e --version | wc -l` 
if($n != 0) then
  echo $VERSION
  exit 0;
endif

source $FREESURFER_HOME/sources.csh

goto parse_args;
parse_args_return:

goto check_params;
check_params_return:

if(! -e $glmdir) then
  echo "ERROR: cannot find $glmdir"
  exit 1;
endif

set glmfitlog = $glmdir/mri_glmfit.log
if(! -e $glmfitlog) then
  echo "ERROR: cannot find $glmfitlog"
  exit 1;
endif

if($nulltype != perm) then
  set fwhmfile = $glmdir/fwhm.dat
  if(! -e $fwhmfile) then
echo "ERROR: cannot find $fwhmfile"
exit 1;
  endif
  # This may be overridden
  set fwhm = `cat $fwhmfile`;
else
  set fwhm = 0;
endif

set glmfitcwd = `cat $glmfitlog | awk '{if($1 == "cwd") print $2}'`
if(0 && ! -e $glmfitcwd) then
  echo "ERROR: cannot find $glmfitcwd"
  exit 1;
endif
set glmfitcwd = `pwd`;

set anattype = volume;
set subject = ();
set hemi = ();
set surf = "white";
set wls = ();

set glmfitcwd = `cat $glmfitlog | awk '{if($1 == "cwd") print $2}'`

# Go through the original mri_glmfit command-line
set glmfitcmd0 = `cat $glmfitlog | awk '{if($1 == "cmdline") print $0}'`
set glmfitcmd = ($glmfitcmd0);
echo $glmfitcmd
set gd2mtx = dods
set UseTable = 0;
set label = ();
while($#glmfitcmd)
  set flag = $glmfitcmd[1]; shift glmfitcmd;
  #echo $flag
  switch($flag)
  case "--surf"
  case "--surface"
set subject = $glmfitcmd[1]; shift glmfitcmd;
set hemi= $glmfitcmd[1]; shift glmfitcmd;
set anattype = surface;
if($#glmfitcmd != 0) then
  set c = `echo $glmfitcmd[1] | cut -c 1-2`;
  if("$c" != "--") then
set surf = $glmfitcmd[1]; shift glmfitcmd;
  endif
endif
breaksw
  case "--fsgd"
shift glmfitcmd;
if($#glmfitcmd > 0) then
  if($glmfitcmd[1] == doss) set gd2mtx = doss
endif
breaksw
  case "--label"
set label = $glmfitcmd[1]; shift glmfitcmd;
breaksw
  case "--perm-force"
# Probably never gets here
set PermForce = 1;
breaksw
  case "--table"
  case "--y"
if($#y == 0) set y = $glmfitcmd[1]; 
shift glmfitcmd;
if($DoClusterMean) then
  if(! -e $y) then
set y = $glmfitcwd/$y
if(! -e $y) then
  set y = $glmdir/`basename $y`
  if(! -e $y) then
echo "ERROR: cannot find $y"
echo "If you do not have this file, run with --no-y as the first 
option"
exit 1;
  endif
endif
  endif
endif
if("$flag" == "--table") set UseTable = 1;
breaksw
  case "--wls"
set wls = $glmfitcwd/$glmfitcmd[1]; shift glmfitcmd;
if(! -e $wls) then
  set wls = $glmdir/`basename $wls`
  if(! -e $wls) then
echo "ERROR: cannot find $wls"
exit 1;
  endif

Re: [Freesurfer] Cluster-Defining Threshold of p=0.025

2017-09-13 Thread Douglas N Greve
There is actually an option called --thresh where you can give it a 
threshold to use. Somehow it did not make it onto the help docs


On 09/13/2017 11:39 AM, Jahn, Andrew wrote:
> Hi Doug,
>
> Thank you for the custom permutation script; it is very helpful.
>
> However, it is still not clear how to use mri_mcsim to create tables 
> with different thresholds. I understand how to use it to restrict the 
> search space and how to use it on different subjects, but I don't see 
> any option for specifying different thresholds. Is there a specific 
> option in mri_mcsim for doing this?
>
>
> Thank you,
>
> -Andy
>
> 
> *From:* freesurfer-boun...@nmr.mgh.harvard.edu 
> <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Douglas N Greve 
> <gr...@nmr.mgh.harvard.edu>
> *Sent:* Thursday, September 7, 2017 5:55:30 PM
> *To:* freesurfer@nmr.mgh.harvard.edu
> *Subject:* Re: [Freesurfer] Cluster-Defining Threshold of p=0.025
> If you want to use that threshold, you will have to create tables for
> that threshold using mri_mcsim. See
>
> https://surfer.nmr.mgh.harvard.edu/fswiki/BuildYourOwnMonteCarlo
>
>
> Alternatively, I have a version of mri_glmfit-sim that will run
> permutation with non-orthogonal designs.
>
> https://gate.nmr.mgh.harvard.edu/safelinks/greve/mri_glmfit-sim
>
>
> This is the direction I'm pushing people in. To run it, use the normal
> permutation options and add --perm-resid
>
> This uses the ter Braak method. Run mri_glmfit-sim --help to get more info
>
>
>
>
>
> On 09/07/2017 11:05 AM, Jahn, Andrew wrote:
> > Hello,
> >
> > Is it possible to use cluster-defining thresholds such as p = 0.025
> > with mri_glmfit-sim? (This would roughly correspond to a negative log
> > value of 1.6.) My design doesn't allow the use of permutations for
> > simulating cluster sizes, so I have to use the mczsim option; however,
> > from what I can tell it doesn't allow using any non-cached options.
> >
> >
> > Thanks,
> >
> > -Andy
> >
> >
> >
> > ___
> > Freesurfer mailing list
> > Freesurfer@nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>
> -- 
> Douglas N. Greve, Ph.D.
> MGH-NMR Center
> gr...@nmr.mgh.harvard.edu
> Phone Number: 617-724-2358
> Fax: 617-726-7422
>
> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
> FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
> www.nmr.mgh.harvard.edu/facility/filedrop/index.html 
> <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>
> Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/
>
> ___
> 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
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.partners.org_complianceline=DwIBAg=cjytLXgP8ixuoHflwc-poQ=h-S9eBUOU6jgx_fyX6Af8TeTt7dGNPjG7qjp2Qe-zMs=7dwQJDogv4w-2-MgP5exf4vmnDjsQooz0tQsUyZRkFk=8S0l8EjW9GU0a0bo8j1jLq0yijKG3KYh7lr-RArddLQ=
>  
> . 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

-- 
Douglas N. Greve, Ph.D.
MGH-NMR Center
gr...@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

___
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.



Re: [Freesurfer] Cluster-Defining Threshold of p=0.025

2017-09-13 Thread Jahn, Andrew
Hi Doug,

Thank you for the custom permutation script; it is very helpful.

However, it is still not clear how to use mri_mcsim to create tables with 
different thresholds. I understand how to use it to restrict the search space 
and how to use it on different subjects, but I don't see any option for 
specifying different thresholds. Is there a specific option in mri_mcsim for 
doing this?


Thank you,

-Andy



From: freesurfer-boun...@nmr.mgh.harvard.edu 
<freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Douglas N Greve 
<gr...@nmr.mgh.harvard.edu>
Sent: Thursday, September 7, 2017 5:55:30 PM
To: freesurfer@nmr.mgh.harvard.edu
Subject: Re: [Freesurfer] Cluster-Defining Threshold of p=0.025

If you want to use that threshold, you will have to create tables for
that threshold using mri_mcsim. See

https://surfer.nmr.mgh.harvard.edu/fswiki/BuildYourOwnMonteCarlo


Alternatively, I have a version of mri_glmfit-sim that will run
permutation with non-orthogonal designs.

https://gate.nmr.mgh.harvard.edu/safelinks/greve/mri_glmfit-sim


This is the direction I'm pushing people in. To run it, use the normal
permutation options and add --perm-resid

This uses the ter Braak method. Run mri_glmfit-sim --help to get more info





On 09/07/2017 11:05 AM, Jahn, Andrew wrote:
> Hello,
>
> Is it possible to use cluster-defining thresholds such as p = 0.025
> with mri_glmfit-sim? (This would roughly correspond to a negative log
> value of 1.6.) My design doesn't allow the use of permutations for
> simulating cluster sizes, so I have to use the mczsim option; however,
> from what I can tell it doesn't allow using any non-cached options.
>
>
> Thanks,
>
> -Andy
>
>
>
> ___
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

--
Douglas N. Greve, Ph.D.
MGH-NMR Center
gr...@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html<http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

___
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
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.partners.org_complianceline=DwIBAg=cjytLXgP8ixuoHflwc-poQ=h-S9eBUOU6jgx_fyX6Af8TeTt7dGNPjG7qjp2Qe-zMs=7dwQJDogv4w-2-MgP5exf4vmnDjsQooz0tQsUyZRkFk=8S0l8EjW9GU0a0bo8j1jLq0yijKG3KYh7lr-RArddLQ=
  . 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.


Re: [Freesurfer] Cluster-Defining Threshold of p=0.025

2017-09-07 Thread Douglas N Greve
If you want to use that threshold, you will have to create tables for 
that threshold using mri_mcsim. See

https://surfer.nmr.mgh.harvard.edu/fswiki/BuildYourOwnMonteCarlo


Alternatively, I have a version of mri_glmfit-sim that will run 
permutation with non-orthogonal designs.

https://gate.nmr.mgh.harvard.edu/safelinks/greve/mri_glmfit-sim


This is the direction I'm pushing people in. To run it, use the normal 
permutation options and add --perm-resid

This uses the ter Braak method. Run mri_glmfit-sim --help to get more info





On 09/07/2017 11:05 AM, Jahn, Andrew wrote:
> Hello,
>
> Is it possible to use cluster-defining thresholds such as p = 0.025 
> with mri_glmfit-sim? (This would roughly correspond to a negative log 
> value of 1.6.) My design doesn't allow the use of permutations for 
> simulating cluster sizes, so I have to use the mczsim option; however, 
> from what I can tell it doesn't allow using any non-cached options.
>
>
> Thanks,
>
> -Andy
>
>
>
> ___
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

-- 
Douglas N. Greve, Ph.D.
MGH-NMR Center
gr...@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

___
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.