powered by
This function creates a square region of interest (ROI) in a 3D volume, where the z-dimension is fixed at one voxel coordinate. The ROI is defined within a given NeuroVol or NeuroSpace instance.
square_roi(bvol, centroid, surround, fill = NULL, nonzero = FALSE, fixdim = 3)
An instance of class ROIVol representing the square ROI.
ROIVol
A NeuroVol or NeuroSpace instance representing the 3D volume or space.
NeuroVol
NeuroSpace
A numeric vector of length 3, representing the center of the square ROI in voxel coordinates.
A non-negative integer specifying the number of voxels on either side of the central voxel.
An optional value or values to assign to the data slot of the resulting ROI. If not provided, no data will be assigned.
A logical value indicating whether to keep only nonzero elements from bvol. If bvol is a NeuroSpace instance, this argument is ignored.
bvol
A logical value indicating whether the fixed dimension is the third, or z, dimension. Default is TRUE.
sp1 <- NeuroSpace(c(10, 10, 10), c(1, 1, 1)) square <- square_roi(sp1, c(5, 5, 5), 1) vox <- coords(square) ## a 3 X 3 X 1 grid nrow(vox) == 9
Run the code above in your browser using DataLab