| meta_info | R Documentation |
'meta_info()' provides a simple, CRAN-friendly way to retrieve essential image metadata without teaching S4 details up front. It accepts a file path or a 'FileMetaInfo' object and returns a normalized list containing common fields like dimensions, spacing, origin, and transform.
The function does not read image data; it only parses header information.
meta_info(x)
## S4 method for signature 'FileMetaInfo'
meta_info(x)
## S4 method for signature 'character'
meta_info(x)
x |
A character file path (e.g., '"image.nii.gz"') or an object of
class |
Summarize Image Metadata
A named list with the following elements:
'dim' Integer vector of image dimensions.
'spacing' Numeric voxel spacing (mm).
'origin' Numeric coordinate origin.
'trans' 4x4 transformation matrix mapping grid to world (mm).
'path' Data file path.
'filename' Basename of 'path'.
'format' File format label (e.g., "NIFTI", "AFNI").
'dtype' Storage data type label.
'bytes_per_element' Bytes per element.
'nvox' Number of voxels in the spatial volume (prod of first 3 dims).
'nvol' Number of volumes (4th dim if present, else 1).
'size_bytes' Approximate uncompressed size in bytes ('nvox * nvol * bytes_per_element').
'time_step' Time step (TR in seconds) if available for NIfTI, else 'NA_real_'.
read_header, trans,
FileMetaInfo, NIFTIMetaInfo
f <- system.file("extdata", "global_mask_v4.nii", package = "neuroim2")
mi <- meta_info(f)
mi$dim
mi$spacing
mi$origin
mi$filename
# 4x4 transform
mi$trans
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.