labelStats: labelStats

View source: R/labelStats.R

labelStatsR Documentation

labelStats

Description

Get label statistics from image.

Usage

labelStats(image, labelImage)

Arguments

image

Image to calculate statistics from.

labelImage

Label image.

Value

Data frame with one row per label (including zero) and columns : LabelValues, Mean, Min, Max, Variance, Count, Volume

Examples


img <- antsImageRead(getANTsRData("r16"), 2)
img <- resampleImage(img, c(64, 64), 1, 0)
mask <- getMask(img)
segs1 <- kmeansSegmentation(img, 3)
labelStats(img, segs1$segmentation)
testthat::expect_error(labelStats(img, as.array(segs1$segmentation)))
testthat::expect_error(labelStats(img, as.array(segs1$segmentation)))
sub_seg <- segs1$segmentation
sub_seg <- as.antsImage(sub_seg[1:62, 1:62], reference = sub_seg)
testthat::expect_error(labelStats(img, sub_seg))


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