splitChannels: split a multichannel antsImage

View source: R/splitChannels.R

splitChannelsR Documentation

split a multichannel antsImage

Description

split a multichannel antsImage into a list of scalar antsImages

Usage

splitChannels(image)

Arguments

image

a multichannel antsImage to split

Value

list of scalar antsImages

Author(s)

Duda, JT

Examples

r <- floor(seq(1:(64 * 64)) / (64 * 64) * 255)
dim(r) <- c(64, 64)
r <- as.antsImage(r)
g <- r * 0
b <- r * 0
testthat::expect_error(splitChannels(r))
rgbImage <- mergeChannels(list(r, g, b))
imgList <- splitChannels(rgbImage)
testthat::expect_length(imgList, 3)
sapply(imgList, function(x) {
  testthat::expect_s4_class(x, class = "antsImage")
})
testthat::expect_error(splitChannels("hey"))


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.