grid_to_coord-methods: Generic function to convert N-dimensional grid coordinates to...

grid_to_coordR Documentation

Generic function to convert N-dimensional grid coordinates to real world coordinates

Description

Generic function to convert N-dimensional grid coordinates to real world coordinates

Usage

grid_to_coord(x, coords)

## S4 method for signature 'NeuroSpace,matrix'
grid_to_coord(x, coords)

## S4 method for signature 'NeuroSpace,matrix'
grid_to_coord(x, coords)

## S4 method for signature 'NeuroSpace,numeric'
grid_to_coord(x, coords)

## S4 method for signature 'NeuroVol,matrix'
grid_to_coord(x, coords)

Arguments

x

the object

coords

a matrix of grid coordinates

Value

A numeric matrix of real-world coordinates.

Examples

# Create a simple 3D volume
bvol <- NeuroVol(array(0, c(10,10,10)), NeuroSpace(c(10,10,10), c(1,1,1)))
grid_coords <- matrix(c(1.5,1.5,1.5, 5.5,5.5,5.5), ncol=3, byrow=TRUE)
world <- grid_to_coord(bvol, grid_coords)
grid <- coord_to_grid(bvol, world)
all.equal(grid_coords, grid)

bbuchsbaum/neuroim2 documentation built on Feb. 26, 2025, 3:49 p.m.