index_to_coord-methods: Generic function to convert 1D indices to N-dimensional real...

Description Usage Arguments Value Examples

Description

Generic function to convert 1D indices to N-dimensional real world coordinates

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
index_to_coord(x, idx)

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

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

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

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

Arguments

x

the object

idx

the 1D indices

Value

a matrix of real coordinates

Examples

1
2
3
4
5
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)

bbuchsbaum/neuroim2 documentation built on Oct. 15, 2019, 2:55 p.m.