mni_to_region_name: MRI-labeling: label the brain MNI coordinate by AAL/BA system

View source: R/mni_to_region_name.R

mni_to_region_nameR Documentation

MRI-labeling: label the brain MNI coordinate by AAL/BA system

Description

Input an MNI coordinate, output the corresponding AAL/BA brain region name.

Usage

mni_to_region_name(x, y, z, distance = T, template = c("aal", "ba"))

Arguments

x

The numeric x value of the MNI coordinate.

y

The numeric y value of the MNI coordinate.

z

The numeric z value of the MNI coordinate.

distance

A logical value which indicates whether the closest region should be shown when there is no exact match (default = T). This could be turned off to speed up the labeling process.

template

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

Value

If distance mode is on (distance = T), output a list of brain region names along with the corresponding distances (mm).

Please set distance = T if you want the closest region name even when there is no exact matching brain region. If distance mode is off (distance = F), output a string of region names only when available, otherwise output 'NULL'.

See Also

region_name_to_mni show_cluster_composition

Examples

# Exact matching brain region with distance mode on
mni_to_region_name(26, 0, 0, distance = TRUE)
# Exact matching brain region with distance mode off (much faster)
mni_to_region_name(26, 0, 0, distance = FALSE)

# No exact matching brain region with distance mode on (output the nearest brain region name)
mni_to_region_name(0, 0, 0, distance = TRUE)
# No exact matching brain region  with distance mode off (output nothing)
mni_to_region_name(0, 0, 0, distance = FALSE)

# Only acquire AAL region name
mni_to_region_name(26, 0, 0, distance = TRUE, template = "aal")

# Label multiple MNI coordinates at once
# Three cooridnates: [1, 1, 4], [10, 2, 55] and [-1, 3, -6]
mapply(mni_to_region_name,
  x = c(1, 10, -1),
  y = c(1, 2, 3),
  z = c(4, 55, -6)
)

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