y5_cluster.threshold: Cluster threshold an array.

cluster.thresholdR Documentation

Cluster threshold an array.

Description

Calculate contiguous clusters of locations in a 3D array that are above some threshold and with some minimum size.

Usage

cluster.threshold(x, nmat = NULL, level.thr = 0.5, size.thr)

Arguments

x

A 3D array

nmat

A matrix with 3 columns specifying the neighbourhood system. Default is 6 nearest neighbours in 3D.

level.thr

The level at which to threshold the array values. Default is 0.5 and is designed to cluster 0-1 arrays.

size.thr

The cluster size threshold.

Details

Note: This function is directly copied from "AnalyzeFMRI".

Value

Returns an array of the same size as x with a 1 at all locations which have a value above level.thr and are in a cluster of similiar locations with size greater than size.thr.

Author(s)

J. L. Marchini

Examples


x <- array(0, dim = c(64, 64, 21))
x[10:20, 10:20, 1:5] <- 1
x[30:40, 30:40, 6:7] <- 1
x[50, 50, 8:9] <- 1

a <- cluster.threshold(x, size.thr = 400)
sum(x) ## should be 849
sum(a) ## should be 605


MixfMRI documentation built on Sept. 8, 2023, 5:06 p.m.