Represents a single NIfTI header extension block. NIfTI extensions allow additional metadata to be stored with the image file.
Details
NIfTI-1.1 extensions follow this structure:
Bytes 0-3: esize (int32) - total extension size, must be multiple of 16
Bytes 4-7: ecode (int32) - extension code identifying format
Bytes 8-(esize-1): edata - the actual extension data
Extensions are chained sequentially after the NIfTI header (byte 352) until the vox_offset is reached.
Slots
ecodeAn
integerextension code identifying the type of extension. SeeNiftiExtensionCodesfor known codes.esizeAn
integergiving the total size of the extension in bytes, including the 8-byte header (esize + ecode). Must be a multiple of 16.edataA
rawvector containing the extension data (length = esize - 8).
See also
NiftiExtensionCodes for registered extension codes.
NiftiExtensionList-class for a collection of extensions.
parse_extension for parsing extension data.
Examples
# Create a simple comment extension
comment_text <- "This is a test comment"
ext <- NiftiExtension(ecode = 6L, data = comment_text)
# Access the extension code
ext@ecode
#> [1] 6