parse_afni_extension: Parse AFNI Extension

View source: R/nifti_extensions.R

parse_afni_extensionR Documentation

Parse AFNI Extension

Description

Parses an AFNI extension (ecode = 4) containing XML-formatted attributes.

Usage

parse_afni_extension(ext, as_xml = TRUE)

Arguments

ext

A NiftiExtension-class object with ecode = 4.

as_xml

Logical; if TRUE (default) and xml2 is available, returns an xml_document object. Otherwise returns the raw XML string.

Details

AFNI stores dataset attributes in an XML format within the NIfTI extension. The XML contains elements like HISTORY_NOTE, volume labels, tagged points, and other AFNI-specific metadata.

Value

If as_xml = TRUE and xml2 is available, returns an xml_document. Otherwise returns a character string containing the XML.

See Also

get_afni_attribute for extracting specific AFNI attributes.

Examples

## Not run: 
# Read a NIfTI file with AFNI extension
hdr <- read_nifti_header("afni_file.nii")
afni_ext <- hdr$extensions[[1]]
parsed <- parse_afni_extension(afni_ext)

## End(Not run)


neuroim2 documentation built on April 16, 2026, 5:07 p.m.