Learn R Programming

neuroim2 (version 0.8.5)

index_to_coord: convert 1d indices to n-dimensional real world coordinates

Description

convert 1d indices to n-dimensional real world coordinates

Usage

index_to_coord(x, idx)

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

# S4 method for NeuroSpace,integer index_to_coord(x, idx)

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

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

Value

A numeric matrix of real-world coordinates.

Arguments

x

the object

idx

the 1D indices

Examples

Run this code
bvol <- NeuroVol(array(0, c(10,10,10)), NeuroSpace(c(10,10,10), c(1,1,1)))
idx <- 1:10
g <- index_to_coord(bvol, idx)
idx2 <- coord_to_index(bvol, g)
all.equal(idx, idx2)

Run the code above in your browser using DataLab