Skip to contents

Convert 1d indices to n-dimensional grid coordinates

Usage

index_to_grid(x, idx)

# S4 method for NeuroSlice,numeric
index_to_grid(x, idx)

# S4 method for NeuroSpace,numeric
index_to_grid(x, idx)

# S4 method for NeuroVec,index
index_to_grid(x, idx)

# S4 method for NeuroVec,integer
index_to_grid(x, idx)

# S4 method for NeuroVol,index
index_to_grid(x, idx)

# S4 method for NeuroVol,integer
index_to_grid(x, idx)

Arguments

x

the object

idx

the 1d vector of indices

Value

a matrix of grid coordinates

Examples


 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]
#>  [1] 0 0 0 0 0 0 0 0 0 0