powered by
Get neighborhoods for voxels within mask
getNeighborhoodInMask(image, mask, radius, physical.coordinates = FALSE, boundary.condition = "NA", spatial.info = FALSE, get.gradient = FALSE)
image object of S4 class antsImage to get values from.
antsImage
image object of S4 class antsImage indicating which voxels to examine. Each voxel > 0 will be used as the center of a neighborhood
array of values for neighborhood radius (in voxels)
logical indicating if voxel indices and offsets should be in voxel or physical coordinates
string indicating how to handle voxels in a neighborhood, but not in the mask. See Details.
Details
a boolean indicating of voxel locations and neighborhood offsets should be returned along with pixel values.
a boolean indicating if a matrix of gradients (at the center voxel) should be returned in addition to the value matrix (WIP)
if spatial.info is false: a matrix of pixel values where the number of rows is the size of the neighborhood and there is a column for each voxel
spatial.info
if spatial.info is true, a list containing three matrices:
values: matrix of pixel values where the number of rows is the size of the neighborhood and there is a column for each voxel.
indices: matrix providing the center coordinates for each neighborhood
offsets: matrix providing the offsets from center for each voxel in a neighborhood
boundary.condition should be one of:
boundary.condition
NA: Fill values with NA.
NA
image: Use image value, even if not in mask.
image
mean: Use man of all non-NA values for that neighborhood.
mean
# NOT RUN { r16 <- getANTsRData("r16") r16 <- antsImageRead(r16,2) mask <- getMask(r16,lowThresh=mean(r16),cleanup=1) radius <- rep(2,2) mat <- getNeighborhoodInMask(r16,mask,radius) # }
Run the code above in your browser using DataLab