MixfMRI (version 0.1-0)

Generalized Cluster-Based Analysis (CBA) Method: Generalized Cluster-Based Analysis (CBA) Method

Description

Find clusters in 2D or 3D based on a generalized CBA method. The CBA method is originally proposed by Heller, et.al. (2006) using the correlation of two time series as the similarity of two spatial locations.

Usage

cba.cor(da.ts, da.m = NULL, adj.dist = TRUE, fun.sim = stats::cor)
  cba.cor.2d(da.ts, da.m = NULL, adj.dist = TRUE, fun.sim = stats::cor)
  cba.cor.3d(da.ts, da.m = NULL, adj.dist = TRUE, fun.sim = stats::cor)

Arguments

da.ts

a time series array of dimensions x * y * z * t.

da.m

a mask determining inside of brain or not.

adj.dist

if adjust correlations by distance.

fun.sim

a function computing simility of two locations.

Value

Return the cluster ids for each voxel. NA for outside of brain if da.m is provided.

Details

These functions implement the 2D and 3D versions of CBA proposed by Heller, et.al. (2006).

da.ts should have dimensions x * y * z * t for 3D data and x * y * time for 2D data. Similarly, da.m would have x * y * z and x * y correspondingly.

da.m has values 0 or 1 indicating outside or inside a brain, respectively.

fun.sim(a, B) is a function return similarity between a location a and N neighboring locations B where a is of dimension t * 1 and B is of dimensiont * N. Ideally, fun.sim() should return values of similarity which take values between 0 and 1 where 0 means totally different and 1 means completely identical of two spatial locations. By default, stats::cor is used. See the example section next for user defined functions for fun.sim().

References

Heller, et.al. (2006) ``Cluster-based analysis of FMRI data'', NeuroImage, 33(2), 599-608.

http://maitra.public.iastate.edu/

See Also

fdr.bh.p1(), fdr.bh.p2().

Examples

Run this code
# NOT RUN {
### Simulated data
library(MixfMRI, quietly = TRUE)
dim <- c(4, 5, 4, 10)
set.seed(123)
da.ts <- array(rnorm(prod(dim)), dim = dim)
id.class <- suppressWarnings(cba.cor(da.ts))
table(id.class)

fun.tanh <- function(a, B){
  d <- 1 / apply(B, 2, function(b){ dist(rbind(as.vector(a), b)) })
  tanh(d)
}
id.class.tanh <- suppressWarnings(cba.cor(da.ts, fun.sim = fun.tanh))
table(id.class.tanh)

fun.logit <- function(a, B){
  d <- dist(t(cbind(a, B)))[1:ncol(B)]
  (1 / (1 + exp(-d))) * 2 - 1
}
id.class.logit <- suppressWarnings(cba.cor(da.ts, fun.sim = fun.logit))
table(id.class.logit)

# }
# NOT RUN {
  ### Real data
  library(AnalyzeFMRI, quietly = TRUE)
  library(oro.nifti, quietly = TRUE)

  fn <- "pb02_volreg_tlrc.nii"
  da <- readNIfTI(fn)
  da.ts <- da@.Data

  fn <- "mask_anat.nii"
  da <- readNIfTI(fn)
  da.m <- da@.Data

  id.class <- suppressWarnings(cba.cor(da.ts, da.m))
  dim(id.class) <- dim(da.m)
  length(table(id.class))
# }

Run the code above in your browser using DataLab