read_meta_info {neuroim2} | R Documentation |
Generic function to read image meta info given a file
Description
Reads meta information from image files based on their format (NIFTI or AFNI).
Usage
read_meta_info(x, file_name)
## S4 method for signature 'NIFTIFormat'
read_meta_info(x, file_name)
## S4 method for signature 'AFNIFormat'
read_meta_info(x, file_name)
Arguments
x |
A FileFormat object (either NIFTIFormat or AFNIFormat) |
file_name |
A character string specifying the file name to read meta information from |
Details
These methods use format-specific functions to read the header information and create the appropriate meta information object. The '.read_meta_info' helper function is used internally to streamline the process for both formats.
Value
A list
containing the meta information read from the file.
An object of class NIFTIMetaInfo or AFNIMetaInfo, depending on the input format
Examples
# Create a NIFTI format descriptor
fmt <- new("NIFTIFormat",
file_format = "NIFTI",
header_encoding = "raw",
header_extension = "nii",
data_encoding = "raw",
data_extension = "nii")
# Read metadata from a NIFTI file
fname <- system.file("extdata", "global_mask_v4.nii", package="neuroim2")
meta <- read_meta_info(fmt, fname)
# Access metadata properties
dim(meta) # Image dimensions
trans(meta) # Transformation matrix
[Package neuroim2 version 0.8.1 Index]