cifti.file.looks.like.cifti2: Check whether a file is a CIFTI-2 file (internal helper).

View source: R/read_cifti_header.R

cifti.file.looks.like.cifti2R Documentation

Check whether a file is a CIFTI-2 file (internal helper).

Description

Cheap and silent check whether a file is a CIFTI-2 file, i.e. a NIFTI v2 file with a header extension of code 32, the extension that holds the CIFTI XML metadata. The format dispatchers (read.fs.morph(), read.fs.volume()) use it to give a helpful error: the payload of a CIFTI-2 file is a matrix whose dimensions the XML describes, not a volume or a per-vertex vector, so reading it with the NIFTI reader silently returns values in an order that means nothing.

Usage

cifti.file.looks.like.cifti2(filepath)

Arguments

filepath

character string, the path to a CIFTI-2 file (usually one of .dscalar.nii, .dtseries.nii, .dlabel.nii, .dconn.nii, .pscalar.nii, .ptseries.nii, .pconn.nii, .dpconn.nii or .pdconn.nii). Note that this is not a NIFTI file, despite the .nii part. Gzipped CIFTI files are not supported, because the CIFTI-2 format forbids compression.

Value

logical, whether the file is a CIFTI-2 file. A file that does not exist or cannot be parsed is reported as FALSE.


freesurferformats documentation built on Sept. 25, 2026, 1:07 a.m.