# Create a standard 3D space (64x64x40 voxels, 2mm isotropic)
space_3d <- NeuroSpace(
dim = c(64L, 64L, 40L),
spacing = c(2, 2, 2),
origin = c(-90, -126, -72)
)
# Check properties
dim(space_3d) # Image dimensions
spacing(space_3d) # Voxel sizes
origin(space_3d) # World-space origin
# Create a 2D slice space
space_2d <- NeuroSpace(
dim = c(128L, 128L),
spacing = c(1.5, 1.5),
origin = c(-96, -96)
)
# Convert between coordinate systems
world_coords <- c(0, 0, 0)
vox_idx <- coord_to_index(space_3d, world_coords)
back_to_world <- index_to_coord(space_3d, vox_idx)
Run the code above in your browser using DataLab