Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 23.3.0
hooks:
- id: black
5 changes: 5 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,11 @@
"affiliation": "MIT, HMS",
"name": "Ghosh, Satrajit",
"orcid": "0000-0002-5312-6729"
},
{
"affiliation": "University of Tübingen and MPI for Biological Cybernertics",
"name": "Bannert, Michael M.",
"orcid": "0000-0003-1010-7517"
}
],
"keywords": [
Expand Down
25 changes: 24 additions & 1 deletion nipype/interfaces/spm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,16 @@ class ThresholdInputSpec(SPMCommandInputSpec):
"set to p-value)"
),
)
use_vox_fdr_correction = traits.Bool(
False,
usedefault=True,
desc=(
"whether to use voxel-based FDR "
"correction for initial threshold "
"(height_threshold_type has to be "
"set to q-value)"
),
)
use_topo_fdr = traits.Bool(
True,
usedefault=True,
Expand Down Expand Up @@ -661,8 +671,16 @@ def _gen_pre_topo_map_filename(self):
def _make_matlab_command(self, _):
script = "con_index = %d;\n" % self.inputs.contrast_index
script += "cluster_forming_thr = %f;\n" % self.inputs.height_threshold
if self.inputs.use_fwe_correction:

if self.inputs.use_fwe_correction and self.inputs.use_vox_fdr_correction:
raise ValueError(
"'use_fwe_correction' and 'use_vox_fdr_correction' can't both be True"
)

if self.inputs.use_fwe_correction and not self.inputs.use_vox_fdr_correction:
script += "thresDesc = 'FWE';\n"
elif self.inputs.use_vox_fdr_correction and not self.inputs.use_fwe_correction:
script += "thresDesc = 'FDR';\n"
else:
script += "thresDesc = 'none';\n"

Expand All @@ -687,6 +705,8 @@ def _make_matlab_command(self, _):
FWHM = SPM.xVol.FWHM;
df = [SPM.xCon(con_index).eidf SPM.xX.erdf];
STAT = SPM.xCon(con_index).STAT;
VspmSv = cat(1,SPM.xCon(con_index).Vspm);

R = SPM.xVol.R;
S = SPM.xVol.S;
n = 1;
Expand All @@ -695,6 +715,9 @@ def _make_matlab_command(self, _):
case 'FWE'
cluster_forming_thr = spm_uc(cluster_forming_thr,df,STAT,R,n,S);

case 'FDR'
cluster_forming_thr = spm_uc_FDR(cluster_forming_thr,df,STAT,n,VspmSv,0);

case 'none'
if strcmp(height_threshold_type, 'p-value')
cluster_forming_thr = spm_u(cluster_forming_thr^(1/n),df,STAT);
Expand Down