show_cluster_composition: Show brain cluster composition

View source: R/show_cluster_composition.R

show_cluster_compositionR Documentation

Show brain cluster composition

Description

Input a matrix of all MNI coordinates within a cluster, and output the cluster composition (i.e., percentage of each brain region within it).

Usage

show_cluster_composition(coordinate_matrix, template = c("aal", "ba"))

Arguments

coordinate_matrix

A matrix of the size 3 x N, which N is the number of coordinates with the cluster of interest. Three rows correspond to the x, y, z MNI values of each coordinate.

template

One character vector which indicates the templates to use ("aal" or "ba"). Use both of them by default.

Value

Return a list of frequency table and each of them corresponds to a template. Each table consists the brain region names and the corresponding percentage of the input brain cluster.

If there are coordinates which do not fall into any labeled brain region (e.g., white matter), it will be labeled as "NULL".

See Also

show_nii_clusters

Examples

# Assume there is a cluster of brain coordinates that you want to know
# its composition.
# The cluster has 10 coordinates which MNI coordinates fall in the cube with
# min corner [10, 10, -5] and max cormer [15, 15, 0]
set.seed(1)
brain_matrix <- matrix(cbind(
  x = runif(n = 10, min = 10, max = 15),
  y = runif(n = 10, min = 10, max = 15),
  z = runif(n = 10, min = -5, max = 0)
), nrow = 3, byrow = T)
show_cluster_composition(brain_matrix)

yunshiuan/label4MRI documentation built on Aug. 31, 2023, 3:24 p.m.