| read.nrrd.header | R Documentation |
Reads and parses the ASCII header of a NRRD file without touching the volume data. This is cheap, and it can be used to inspect a file, or to check its geometry, before deciding whether to read the data.
read.nrrd.header(filepath)
filepath |
character string, path to the NRRD file ( |
named list, the parsed header. The fields of the file are available under their
normalized names (e.g. space_directions for the field 'space directions'), and fields that
this function does not interpret are collected in the other_fields entry. The derived
entries are vox2ras_matrix (the 4x4 matrix that maps 0-based voxel indices to RAS+
coordinates, or NULL when the file states no geometry), vox2ras_source (how the matrix was
derived: 'space directions' or 'spacings'), data_files (the resolved paths of the data files
for a detached header, or NULL), data_offset (the byte offset of the data in the header
file), gzipped_file (whether the whole file is gzip-compressed), header_size (the size of
the header in bytes) and dwi (the parsed diffusion metadata, or NULL, see
read.fs.volume.nrrd).
nrrd_file <- system.file("extdata", "nrrd", "vol_u8_raw.nrrd",
package = "freesurferformats", mustWork = TRUE
)
hdr <- read.nrrd.header(nrrd_file)
hdr$sizes
hdr$vox2ras_matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.