ptfce: pTFCE main function.

View source: R/ptfce.r

ptfceR Documentation

pTFCE main function.

Description

The threshold-free cluster enhancement (TFCE) approach integrates cluster information into voxel-wise statistical inference to enhance detectability of neuroimaging signal. Despite the significantly increased sensitivity, the application of TFCE is limited by several factors: (i) generalization to data structures, like brain network connectivity data is not trivial, (ii) TFCE values are in an arbitrary unit, therefore, P-values can only be obtained by a computationally demanding permutation-test. Here, we introduce a probabilistic approach for TFCE (pTFCE), that gives a simple general framework for topology-based belief boosting. The core of pTFCE is a conditional probability, calculated based on Bayes' rule, from the probability of voxel intensity and the threshold-wise likelihood function of the measured cluster size. We provide an estimation of these distributions based on Gaussian Random Field (GRF) theory. The conditional probabilities are then aggregated across cluster-forming thresholds by a novel incremental aggregation method. Our approach is validated on simulated and real fMRI data. pTFCE is shown to be more robust to various ground truth shapes and provides a stricter control over cluster "leaking" than TFCE and, in the most realistic cases, further improves its sensitivity. Correction for multiple comparison can be trivially performed on the enhanced P-values, without the need for permutation testing, thus pTFCE is well-suitable for the improvement of statistical inference in any neuroimaging workflow.

Usage

ptfce(
  img,
  mask,
  Rd = NA,
  V = NA,
  resels = NA,
  residual = NA,
  dof = NA,
  logpmin = 0,
  logpmax = -log(stats::pnorm(max(img), lower.tail = F)),
  ZestThr = 1.3,
  Nh = 100,
  verbose = T
)

Arguments

img

Nifti Z-score image to enhance ("nifti" class from "oro.nifti" package)

mask

Mask

Rd

Resel count (FSL smoothest: VOLUME*DHL)

V

Number of voxels in mask (FSL smoothest: VOLUME)

resels

Resel size (FSL smoothest: RESELS)

residual

4D residual data for a better estimate of image smoothness (optional)

dof

Degrees of freedom (optional, but obligatory if residual is specified)

logpmin

min threshold (not safe to change the default)

logpmax

max threshold (not safe to change the default)

ZestThr

Cluster-forming Z threshold below which P(h|c) is estimated as P(h), due to limitation of GRF theory. (default: 1.3, not safe to change)

Nh

Number of thresholds (not safe to change the default)

verbose

boolean: print progress bar and diagnostic messages if true (default)

Details

The function takes a Z-score image and a mask image (both "nifti" object of the oro.nifti package) as obligatory inputs. Mask can be either binary or continous, in the latter case it will be thresholded at 0.5. Parameters V (number of voxels) and Rd (voxels per RESEL, computed as V*RESELS from the smoothest outpout) are optional and are to be interpreted as in FSL "smoothest". If you want pTFCE to compute FWER-based Z-threshold for correction of multiple comparisons, specify the parameter resels (resels field of smoothest), together with Rd and V. If not specified, these values are estimated from the data, internally via the smoothest() function of this package, which is a direct port of the corresponding FSL function. If Rd and/or V is not specified, and residual and dof is specified, image smoothness will be determined basedd on teh 4D residual data (more accurate, see ?smoothest()). For more details on smoothness estimation, see https://github.com/spisakt/pTFCE/wiki/Some-important-notes-on-smoothness-estimation. The default value of the parameter Nh should work with images having usual ranges of Z-scores. At low values, although the processing becomes faster, the estimation of the enhanced values might become inaccurate and the enhanced p-value distribution becomes increasingly non-uniform. It is not recommended to set it lower than 30. The parameters logpmin and logpmax define the range of values the incremental thresholding procedure covers. By default, these are based on the input data and it is not recommended to cahnge them.

Value

An object of class "ptfce" is a list containing at least the following components:

  • p (uncorrected) pTFCE enhanced p-values

  • logp negative logarithm of pTFCE enhanced p-values

  • Z pTFCE enhanced p-values converted to Z-scores

  • number_of_resels number of resels (input for e.g. ptoz)

  • fwer0.05.Z Z-score threshold corresponding to the corrected p<0.05 threshold, controlled for FWER

References

T. Spisák, Z. Spisák, M. Zunhammer, U. Bingel, S. Smith, T. Nichols, T. Kincses, Probabilistic TFCE: a generalized combination of cluster size and voxel intensity to increase statistical power, Neuroimage.

https://github.com/spisakt/pTFCE

Examples

## Not run: Z=readNIfTI("Zmap.nii.gz");

MASK=readNIfTI("mask.nii.gz");

# OPTION 1: use standalone with Z-map-based smoothness estimation
pTFCE=ptfce(Z, MASK); # estimate smoothness based on the Z-score map
# (might be inaccurate, but still guarantees FWER)

#OPTION 2: use smoothness estimation based oj residual data (more accurate)
RES4D=readNIfTI("res4D.nii.gz");
pTFCE=ptfce(Z, MASK, residual=RES4D) # a bit slow, currently...

#OPTION 2: equivalent to option2, but faster (uses FSL)
# run FSL smoothest in the command line:
# smoothest -r res4d.nii.gz -d DOF -m mask.nii.gz > smoothness.txt

smooth=read.table("smoothness.txt"); # output by FSL smoothest
pTFCE=ptfce(Z, V=smooth[2,2], Rd = smooth[1,2]*smooth[2,2], mask = MASK);

# plot if you want
orthographic(pTFCE$Z)

# save NIfTI image
writeNIfTI(pTFCE$Z, "pTFCE_Z")

#See https://github.com/spisakt/pTFCE fro more examples

## End(Not run)

spisakt/pTFCE documentation built on Aug. 22, 2023, 7:42 p.m.