Learn R Programming

ANTsR (version 0.3.3)

getNeighborhoodAtVoxel: Get a hypercube neighborhood at a voxel

Description

Get the values in a local neighborhood of an antsImage.

Usage

getNeighborhoodAtVoxel(image, center, kernel, physical.coordinates = FALSE)

Arguments

image
Image object of S4 class antsImage to get values from.
center
array of indices for neighborhood center
kernel
either an array of values for neighborhood radius (in voxels) or a binary array of the same dimension as the image, specifying the shape of the neighborhood to extract
physical.coordinates
a logical indicating if voxel indices and offsets should be in voxel or physical coordinates

Value

a list
  • valuesnumeric vector of values
  • indicesmatrix providing the coordinates for each value

Examples

Run this code

img<-makeImage(c(10,10),rnorm(100))
center <- dim(img)/2
radius <- rep(3,2)
nhlist <- getNeighborhoodAtVoxel(img,center,radius)
kernel <- 1*(rnorm(49)>0)
dim(kernel) <- c(7,7)
randlist <- getNeighborhoodAtVoxel(img,center,kernel)

Run the code above in your browser using DataLab