Learn R Programming

neuroim2 (version 0.8.5)

meta_info: Lightweight metadata for neuroimaging files

Description

`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.

Usage

meta_info(x)

# S4 method for FileMetaInfo meta_info(x)

# S4 method for character meta_info(x)

Value

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_`.

Arguments

x

A character file path (e.g., `"image.nii.gz"`) or an object of class FileMetaInfo.

Details

Summarize Image Metadata

See Also

read_header, trans, FileMetaInfo, NIFTIMetaInfo

Examples

Run this code
# \donttest{
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
# }

Run the code above in your browser using DataLab