antsImageHeaderInfo.Rd
Read file info from image header
antsImageHeaderInfo(filename)
outputs a list containing:
Type of pixel (scalar, vector, etc).
Type of pixel values (int, float, etc).
Number of image dimensions.
Number of pixel dimensions.
Size of image dimensions.
Pixel resolution.
Spatial origin of image
Spatial directions of image axes.
antsImageHeaderInfo(getANTsRData("r16"))
#> $pixelclass
#> [1] "scalar"
#>
#> $pixeltype
#> [1] "unsigned char"
#>
#> $nDimensions
#> [1] 2
#>
#> $nComponents
#> [1] 1
#>
#> $dimensions
#> [1] 256 256
#>
#> $spacing
#> [1] 1 1
#>
#> $origin
#> [1] 0 0
#>
#> $direction
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
img <- antsImageRead(getANTsRData("r16"))
antsImageHeaderInfo(img)
#> $pixelclass
#> [1] "scalar"
#>
#> $pixeltype
#> [1] "float"
#>
#> $nDimensions
#> [1] 2
#>
#> $nComponents
#> [1] 1
#>
#> $dimensions
#> [1] 256 256
#>
#> $spacing
#> [1] 1 1
#>
#> $origin
#> [1] 0 0
#>
#> $direction
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
antsImageHeaderInfo(getANTsRData("r16"))
#> $pixelclass
#> [1] "scalar"
#>
#> $pixeltype
#> [1] "unsigned char"
#>
#> $nDimensions
#> [1] 2
#>
#> $nComponents
#> [1] 1
#>
#> $dimensions
#> [1] 256 256
#>
#> $spacing
#> [1] 1 1
#>
#> $origin
#> [1] 0 0
#>
#> $direction
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
testthat::expect_error(antsImageHeaderInfo(""))