index_to_grid | R Documentation |
Converts linear indices to 2D grid coordinates for a NeuroSlice
object.
index_to_grid(x, idx)
## S4 method for signature 'NeuroSlice,numeric'
index_to_grid(x, idx)
## S4 method for signature 'NeuroSpace,numeric'
index_to_grid(x, idx)
## S4 method for signature 'NeuroVec,index'
index_to_grid(x, idx)
## S4 method for signature 'NeuroVec,integer'
index_to_grid(x, idx)
## S4 method for signature 'NeuroVol,index'
index_to_grid(x, idx)
## S4 method for signature 'NeuroVol,integer'
index_to_grid(x, idx)
x |
A |
idx |
Integer vector of linear indices to convert |
Convert Linear Indices to Grid Coordinates
a matrix of grid coordinates
A matrix with 2 columns representing the (x,y) coordinates corresponding to the input indices
grid_to_index
for the inverse operation
bvol <- NeuroVol(array(0, c(10,10,10)), NeuroSpace(c(10,10,10), c(1,1,1)))
idx <- 1:10
g <- index_to_grid(bvol, idx)
bvol[g]
slice_space <- NeuroSpace(c(10, 10))
slice_data <- matrix(1:100, 10, 10)
slice <- NeuroSlice(slice_data, slice_space)
# Convert single index
coords <- index_to_grid(slice, 55)
# Convert multiple indices
indices <- c(1, 25, 50, 75, 100)
coords_mat <- index_to_grid(slice, indices)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.