Skip to contents

Load an image volume from a file

Usage

read_vol(file_name, index = 1)

Arguments

file_name

the name of the file to load

index

the index of the volume (e.g. if the file is 4-dimensional)

Value

an instance of the class DenseNeuroVol

Examples

fname <- system.file("extdata", "global_mask_v4.nii", package="neuroim2")
x <- read_vol(fname)
print(dim(x))
#> [1] 64 64 25
space(x)
#> 
#>  NeuroSpace Object 
#> 
#>  >> Dimensions 
#>   Grid Size: 64 x 64 x 25
#>   Memory:   5.9 KB
#> 
#>  >> Spatial Properties 
#>   Spacing:   3.50 x 3.50 x 3.70 mm
#>   Origin:    112.00 x -108.00 x -46.20 mm
#> 
#>  >> Anatomical Orientation 
#>   X: Right-to-Left  |  Y: Posterior-to-Anterior  |  Z: Inferior-to-Superior 
#> 
#>  >> World Transformation 
#>   Forward (Voxel to World): 
#>     -3.500  0.000  -0.000   112.000
#>  0.000  3.500  -0.000  -108.000
#>  0.000  0.000   3.700   -46.200
#>  0.000  0.000   0.000     1.000 
#>   Inverse (World to Voxel): 
#>     -0.286  -0.000  -0.000  32.000
#>  0.000   0.286   0.000  30.857
#>  0.000   0.000   0.270  12.486
#>  0.000   0.000   0.000   1.000 
#> 
#>  >> Bounding Box 
#>   Min Corner: -108.5, -108.0, -46.2 mm
#>   Max Corner: 112.0, 112.5, 42.6 mm
#> 
#> ==================================================