Learn R Programming

freesurferformats (version 1.1.0)

Read and Write 'FreeSurfer' Neuroimaging File Formats

Description

Provides functions to read and write neuroimaging data in various file formats, with a focus on 'FreeSurfer' formats. This includes, but is not limited to, the following file formats: 1) MGH/MGZ/NIFTI format files, which can contain multi-dimensional images or other data. Typically they contain time-series of three-dimensional brain scans acquired by magnetic resonance imaging (MRI). They can also contain vertex-wise measures of surface morphometry data. The MGH format is named after the Massachusetts General Hospital, and the MGZ format is a compressed version of the same format. 2) 'FreeSurfer' morphometry data files in binary 'curv' format. These contain vertex-wise surface measures, i.e., one scalar value for each vertex of a brain surface mesh. These are typically values like the cortical thickness or brain surface area at each vertex. 3) Annotation file format. This contains a brain surface parcellation derived from a cortical atlas. 4) Surface file format. Contains a brain surface mesh, given by a list of vertices and a list of faces.

Copy Link

Version

Install

install.packages('freesurferformats')

Monthly Downloads

1,307

Version

1.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Tim Schc3<a4>fer

Last Published

September 24th, 2026

Functions in freesurferformats (1.1.0)

analyze.read.header.internal

Read ANALYZE 7.5 header from file.
analyze.read.magic

Read the 4 magic bytes of an ANALYZE 7.5 or NIFTI v1 header.
analyze.mat.sidecar.to.vox2ras

Compute the voxel-to-RAS matrix from the MATLAB sidecar file of an ANALYZE image.
CIFTI_EXTENSION_CODE

The NIFTI v2 extension code that holds the CIFTI-2 XML metadata.
analyze.header.check

Check whether an ANALYZE 7.5 header is suitable for writing.
adjust.face.indices.to

Adjust integer matrix to target min value.
analyze.dtype.info

Compute the R data type and the number of bytes per value for an ANALYZE data type.
analyze.header.to.vox2ras

Compute a transformation matrix from the fields of an ANALYZE 7.5 header.
analyzeheader.for.data

Create ANALYZE 7.5 header suitable for given data.
analyze.pair.files

Determine the header and data file of an ANALYZE 7.5 or NIFTI v1 pair file.
annot.unique

Make the region names and indices unique across hemispheres for a parcellation.
analyze.read.char.field

Read a fixed length character field of an ANALYZE 7.5 header.
apply.affine.to.coords

Apply an affine to a set of coordinates.
analyze.write.data.internal

Write the voxel data of an ANALYZE 7.5 image to a connection.
as.tsf.scalars

Convert scalar values for streamlines to a list of vectors.
as.list.fs.tracts

Convert an fs.tracts instance to a plain list of tracts.
as.fs.tracts

Convert a collection of tracts to an fs.tracts instance.
analyzeheader.template

Create a template ANALYZE 7.5 header. You will have to adapt it for your use case.
annot.max.region.idx

Get max region index of an fs.annot instance.
assert.surface

Stop unless surf is an fs.surface
bvsmp

Create new bvsmp instance encoding morph data for Brainvoyager.
cdata

Create CDATA element string from string.
axcodes2ornt

Convert axis codes to an orientation array.
atlas.from.lut.and.csv

Construct a brain atlas from a colortable (LUT) file and a per-vertex label file.
check_file_size

Check that a file is large enough to contain the expected data payload.
build.mrtrix.header

Build the text header of an MRtrix streamlines file.
build.mrtrix.header.stable

Determine the length of an MRtrix streamlines header.
check_data_and_settings_consistency

Warn about common errors in combining data and datatype.
check_all_finite

Check that a numeric vector or matrix contains only finite values.
check.dtype.for.data

Check whether the dtype is suitable for the data.
cifti.axis.labels

Create a CIFTI-2 axis for label maps.
cifti.axis.from.template

Create a CIFTI-2 axis from a template file.
cifti.axis.brain.models

Create a CIFTI-2 axis for brain models.
cifti.annot.list

Accept the input forms of a set of annotations.
cifti.axis.for.maps

Build the axis for a set of maps.
cifti.array.with.new.first.dim

Create an array like the input, with a different first dimension.
cifti.axis.named.maps

Create a CIFTI-2 axis for named maps (internal helper).
cifti.annot.parcels

Collect the vertices of each region of an annotation.
cifti.assign.rows

Assign rows of an array, reordered or repeated.
cifti.axes.to.maps

Group axes into MatrixIndicesMap elements.
cifti.axis.parcels

Create a CIFTI-2 axis for parcels.
cifti.axis.series

Create a CIFTI-2 axis for a series.
cifti.axis.parcels.from.annot

Create a CIFTI-2 parcels axis from brain surface annotations.
cifti.axis.surface.sizes

Get the surface sizes of an axis as a named vector.
cifti.brain.model.surface

Create a CIFTI-2 brain model entry for a surface.
cifti.axis.scalars

Create a CIFTI-2 axis for scalar or label maps.
cifti.brain.model.volume

Create a CIFTI-2 brain model entry for volume voxels.
cifti.axis.surfaces

Create the Surface elements of an axis.
cifti.brainordinate.dim

Get the brainordinate dimension of a CIFTI-2 file.
cifti.axis.size

The number of matrix entries an axis covers.
cifti.compute.index.ranges

Compute the index ranges of brain model entries.
cifti.connectome.axes

Determine the two axes of a connectome file.
cifti.check.label.table

Check a label table for writing.
cifti.check.data.for.axes

Check and prepare the data for a set of axes.
cifti.check.index.list

Check a vector of 0-based indices.
cifti.data.for.connectome

Accept the input forms of a CIFTI-2 connectome.
cifti.file.looks.like.cifti1

Check whether a file looks like a CIFTI-1 file.
cifti.data.for.grayordinates

Select the data values of the grayordinates of a file.
cifti.data.object

Accept the input forms of a CIFTI-2 data object.
cifti.check.index.selection

Check a matrix index selection.
cifti.data.surface.size

The number of vertices of the surface of one structure.
cifti.check.object

Check that an object is an fs.cifti instance.
cifti.data.for.all.vertices

Assemble the data values of all vertices for a file without a template.
cifti.check.axes

Check a list of axes and name the dimensions.
cifti.brainordinate.dims

Get all matrix dimensions of a CIFTI-2 file that hold brain models.
cifti.dim.labels

Get axis labels for a matrix dimension of a CIFTI-2 file.
cifti.data.structures

Determine the structures of per-vertex data.
cifti.data.per.structure

Get the per-structure data of one structure.
cifti.dim.to.front

Move one dimension of an array to the front.
cifti.dense.structure.matrix

Get the dense data matrix of one structure for the user-facing readers.
cifti.grayordinates

Get the brainordinate table of a CIFTI-2 file.
cifti.file.types

The standard CIFTI-2 file types.
cifti.index.type.short

The short name of a CIFTI-2 matrix index type.
cifti.grayordinates.for.axes

Build the brainordinate table of an axis.
cifti.grayordinates.for.model

Expand one brain model entry into a brainordinate table.
cifti.header.of

Accept the input forms of a CIFTI-2 header.
cifti.file.type.for.extension

The CIFTI-2 file type a file name names.
cifti.file.looks.like.cifti2

Check whether a file is a CIFTI-2 file (internal helper).
cifti.header.from.axes

Create the CIFTI-2 XML metadata for a set of axes.
cifti.label.table

Get a label table from a CIFTI-2 label file.
cifti.file.type.for.axes

Get the standard CIFTI-2 file type for a set of axes.
cifti.map.for.dim

Get the CIFTI indices map for a matrix dimension.
cifti.map.name

Get the name of one named map of a CIFTI-2 file.
cifti.index.types

The CIFTI-2 index types (mapping types).
cifti.label.table.for.writing

Convert a label table to the format the writer expects.
cifti.is.connectome.axis

Check whether an axis describes a connectome dimension.
cifti.map.type.description

Describe a CIFTI-2 index type for humans.
cifti.model.types

The CIFTI-2 brain model types.
cifti.matrix.dim.sizes

Determine the sizes of the CIFTI matrix dimensions.
cifti.merge.axes

Merge explicitly given axes with the axes of a template.
cifti.parse.brain.models

Parse the BrainModel elements of a MatrixIndicesMap element.
cifti.parse.child.voxel.indices

Parse the optionally present VoxelIndicesIJK child element as a matrix.
cifti.parcels.axis.of

Get the parcels axis of a template file.
cifti.nifti.header.for.axes

Build the NIFTI-2 header of a CIFTI-2 file.
cifti.parse.attr

Read and validate an attribute value of an XML node.
cifti.parse.indices.map

Parse one MatrixIndicesMap element.
cifti.other.dim

Get the other matrix dimension of a 2-dimensional CIFTI-2 matrix.
cifti.parse.child.int.vector

Parse a required or optional child element holding integer values.
cifti.parcel

Create a CIFTI-2 parcel.
cifti.parcels

Get the parcel table of a CIFTI-2 file.
cifti.parse.label.table

Parse a CIFTI LabelTable element.
cifti.parse.numeric.vector

Parse a whitespace-separated list of numbers from XML text content.
cifti.parse.int.vector

Parse a whitespace-separated list of integers from XML text content.
cifti.parse.series

Parse the series attributes of a MatrixIndicesMap element.
cifti.parse.named.maps

Parse the NamedMap elements of a MatrixIndicesMap element.
cifti.parse.surfaces

Parse the Surface elements of a MatrixIndicesMap element.
cifti.parse.xml

Parse the CIFTI XML metadata.
cifti.parse.volumes

Parse the Volume elements of a MatrixIndicesMap element.
cifti.parse.parcels

Parse the Parcel elements of a MatrixIndicesMap element.
cifti.parse.metadata

Parse the MetaData element of a CIFTI XML node.
cifti.series.info

Get the series information of a CIFTI-2 file.
cifti.region.name.without.hemisphere

Remove hemisphere markers from region names of a parcellation.
cifti.structure.data

Extract the data of one brain structure from a CIFTI-2 file.
cifti.read.rows

Read the requested matrix rows of a CIFTI-2 file.
cifti.read.matrix

Read the data matrix of a CIFTI-2 file.
cifti.read.values

Read raw values from the data section of a CIFTI-2 file.
cifti.stop.if.cifti

Refuse to read a CIFTI file as a volume or morphometry file.
cifti.stop.if.cifti.name

Refuse a CIFTI-2 file name for a file that is not a CIFTI-2 file.
cifti.structure.canonical

Normalize a CIFTI brain structure name.
cifti.prepare.surface.data

Prepare per-vertex data for writing to a CIFTI-2 file.
cifti.structures

Get the brain model table of a CIFTI-2 file.
cifti.surface.vertex.counts

Get the number of vertices of the surfaces declared in a CIFTI mapping.
cifti.validate.brain.models

Validate the brain model entries of a CIFTI mapping.
cifti.surface.vertex.count

Get the number of vertices of one surface of a CIFTI-2 mapping.
cifti.structure.from.specifier

Resolve a user-supplied structure specifier to a canonical name.
cifti.volume

Create a CIFTI-2 axis for a volume.
cifti.subset.dim

Subset one dimension of an array.
cifti.structure.data.one

Extract the data of one brain structure (internal).
cifti.xml.add.indices.map

Add a MatrixIndicesMap element to the Matrix element.
cifti.xml.add.metadata

Add a MetaData element to an XML node.
cifti.validate.dims.coverage

Check that all matrix dimensions are described exactly once.
cifti.validate.index.range

Check that all indices are within a valid range.
cifti.validate.file.extension

Check the file extension against the axes of the data.
cifti.validate.read.size

Check the safety limit for reading a CIFTI-2 data matrix.
cifti.xml.int.vector

Format an integer vector for an XML text node.
cifti.validate.indices.map

Validate a parsed CIFTI MatrixIndicesMap.
cifti.validate.axes

Validate the axes of a CIFTI-2 file.
cifti.xml.version

The CIFTI version this package writes.
closest.vert.to.point

Find vertex index closest to given query coordinate using Euclidean distance.
cifti.structure.short

Get the short name of a CIFTI brain structure.
cifti.structure.data.dim

Get the matrix dimension a brain structure lives in.
delete_all_opt_data

Delete all data in the package cache.
colortable.from.annot

Extract color lookup table (LUT) from annotation.
coord.to.key

Turn coordinate vector into string.
coord.bbox

Compute the bounding box of a set of coordinates.
cifti.xml.num.vector

Format a numeric vector for an XML text node.
cifti.xml.num

Format a number like the reference implementations do.
cifti.validate.parcels

Validate the parcels of a CIFTI mapping.
.dti.bzero.threshold

Get the b-value threshold below which a volume counts as a b=0 volume.
.read.numeric.table

Read a whitespace-separated numeric table from a text file.
.read.dti.tcktsf

Read DTI tracking data from MRtrix TCK and TSF files.
.write.numeric.table

Write a numeric table to a text file, one matrix row per line.
.find.bval.file

Find the b-value file that belongs to a b-vector file.
.name.gradient.table.columns

Name the columns of an MRtrix gradient table.
.cifti.label.table.for.users

Convert a label table to the format the package has always returned.
.canonicalize.gradient.table

Bring a gradient table into the canonical 'one row per volume' layout.
dti.track.iterator

Create an iterator over the tracts of a DTI tract file.
dti.track.count

Count the tracts in a DTI tract file.
faces.quad.to.tris

Convert quadrangular faces or polygons to triangular ones.
download_opt_data

Download optional data for the freesurferformats package.
dti.track.bbox

Compute the bounding box of all tract coordinates in a file.
doapply.transform.mtx

Apply a spatial transformation matrix to the given coordinates.
flip2D

Flip a 2D matrix.
.format.header.size

Format a possibly missing TRK header size for an error message.
.format.gradient.values

Format numeric values for a gradient table text file.
detect.dti.tract.format

Detect the format of a DTI tract file.
euclidian.dist

Compute Euclidean distance.
filepath.ends.with

Check whether filepath ends with extension.
fileopen.write.gz.or.not

Open a connection for writing, with gzip support based on the file name.
fixed.vec.format.int

Write fixed width integers to one or several lines.
finite.rows

Check which rows of a matrix consist of finite values only.
fs.surface.to.tmesh3d

Get an rgl tmesh3d instance from a brain surface mesh.
fs.get.morph.file.format.from.filename

Determine morphometry file format from filename
fs.patch

Constructor for fs.patch
fs.get.morph.file.ext.for.format

Determine morphometry file extension from format
flip3D

Flip a 3D array along an axis.
faces.tris.to.quad

Convert tris faces to quad faces by simple merging.
fs.tracts

Create an fs.tracts instance from a compact tract representation.
fileopen.gz.or.not

Get connection to a binary file, gz or not.
fs.tracts.point.count

Get the total number of points of all tracts.
format_bytes_human

Format a number of bytes for human consumption.
fs.tracts.lengths

Get the number of points of each tract.
fs.transform

Create an fs.transform instance.
fread3

Read 3-byte integer.
fs.tracts.count

Get the number of tracts.
get.dti.trk.endianness

Determine endianness of TRK file.
get.slice.orientation

Compute MGH orientation string and direction
get_max_alloc_bytes

Get the configured maximum allocation size in bytes.
fwrite3

Write 3-byte integer.
fsl.scaled.voxel.matrix

Compute the matrix that maps FSL voxel coordinates of a volume to FSL world coordinates.
get_opt_data_filepath

Access a single file from the package cache by its file name.
giftixml_add_labeltable_from_annot

Add a label tabel from an annotation to a GIFTI XML tree.
giftixml_add_labeltable_posneg

Add a standard label tabel for to a GIFTI XML tree.
gifti_xml_add_global_metadata

Add metadata to GIFTI XML tree.
gifti_xml_write

Write XML tree to a gifti file.
fs.tracts.coords

Get the concatenated coordinates of fs.tracts instances.
gifti_xml

Get GIFTI XML representation of data.
gifti_writer

Write data to a gifti file.
invert.fs.transform

Invert a transformation.
inv.ornt.aff

Build the affine that undoes an orientation transform.
is.analyze.file

Check whether a file is an ANALYZE 7.5 file.
is.fs.surface

Check whether object is an fs.surface
is.fs.label

Check whether object is an fs.label
is.mghheader

Check whether object is an mghheader
is.fs.tracts

Check whether an object is an fs.tracts instance.
is.fs.volume

Check whether object is an fs.volume
guess.writable.transform.format

Determine the format of a transformation file to write.
is.fs.annot

Check whether object is an fs.annot
is.fs.transform

Check whether an object is an fs.transform instance.
is.bvsmp

Check whether object is a bvsmp instance.
has_pandoc

Check for pandoc availability on system.
guess.transform.format

Determine the format of a transformation file.
int.to.col.brainvoyager

Convert 32 bit integer to RGB color as described in Brainvoyager SRF file spec.
infinite.rows

Check which rows of a matrix consist of infinite values only.
is.identity.matrix

Check whether a matrix is (close to) the identity.
io.orientation

Determine the orientation of an affine's input axes.
groups.in.bbox

Check which groups have at least one point inside a box.
group.start.rows

Compute the first row of every group in a concatenated matrix.
list_opt_data

Get file names available in package cache.
linesplit.fixed

Split a string into fixed-length parts.
is.gzip.file

Check whether a file is gzip-compressed, based on its magic bytes.
guess.filename.is.gzipped

Guess whether a file is gzipped.
length.fs.tracts

Number of tracts in an fs.tracts instance.
itk.numeric.value

Read a numerical entry of an ITK transform file.
mghheader.ras2vox.tkreg

Compute ras2vox-tkreg matrix from basic MGH header fields.
mghheader.is.conformed

Determine whether an MGH volume is conformed.
mghheader.ras2vox

Compute ras2vox matrix from basic MGH header fields.
mghheader.primary.slice.direction

Compute MGH primary slice direction
mghheader.centervoxelRAS.from.firstvoxelRAS

Compute RAS coords of center voxel.
is.mrtrix.end.line

Check whether a header line terminates the MRtrix header.
mghheader.crs.orientation

Compute MGH volume orientation string.
mgh.is.conformed

Determine whether an MGH volume is conformed.
mghheader

Constructor to init MGH header instance.
m44_to_quaternion

Compute quaternion representation of a rotation from a 4x4 rotation matrix.
lta.volume.info.lines

Write the volume info section of an LTA file.
mghheader.is.ras.valid

Check whether header contains valid ras information
mesh.face.normals

Compute the normals of the triangles of a mesh.
itk.key.value

Read the value of a key of an ITK transform file.
mghheader.scanner2tkreg

Compute scanner-RAS 2 tkreg-RAS matrix from basic MGH header fields.
mghheader.vox2ras

Compute vox2ras matrix from basic MGH header fields.
mghheader.tkreg2scanner

Compute tkreg-RAS to scanner-RAS matrix from basic MGH header fields.
mghheader.update.from.vox2ras

Update mghheader fields from vox2ras matrix.
ni1header.for.data

Create NIFTI v1 header suitable for given data.
mghheader.vox2vox

Compute vox2vox matrix between two volumes.
mni152reg

Get fsaverage (MNI305) to MNI152 transformation matrix.
nifti.file.uses.fshack

Determine whether a NIFTI file uses the FreeSurfer hack.
mghheader.vox2ras.tkreg

Compute vox2ras-tkreg matrix from basic MGH header fields.
mrtrix.track.iterator

Create an iterator over the tracts of an MRtrix TCK or TSF file.
mri_dtype_numbytes

Get size of MRI dtype in bytes.
ni1header.template

Create a template NIFTI v1 header. You will have to adapt it for your use case.
nifti.field.check.length

Check whether vector has expected length.
merge.bbox

Merge two bounding boxes.
nifti.field.check.nchar.max

Check whether character string fields have less than or equal to expected length.
next.buffer.capacity

Compute the next capacity for a growing result buffer.
nifti.datadim.to.dimfield

Compute NIFTI dim field for data dimension.
ni2header.template

Create a template NIFTI v2 header. You will have to adapt it for your use case.
nifti.datadim.from.dimfield

Compute data dimensions from the 'dim' field of the NIFTI (v1 or v2) header.
ni2header.for.data

Create NIFTI v2 header suitable for given data.
nifti.dtype.info

Compute NIFTI v1 data type info from datatype and bitpix header field.
nifti.dtypebitpix.info.from.mgh.dtype

Compute the 'datatype' and 'bitpix' fields used in the NIFTI1 header from an MGH/MGZ datatype code.
nifti.time.info

Compute NIFTI time unit info from xyzt_units header field.
nifti.file.version

Determine NIFTI file version information and whether file is a NIFTI file.
nifti.transform.type.name

Get the name of the transform type from a form code.
nifti.header.check

Perform basic sanity checks on NIFTI header data. These are in no way meant to be exhaustive.
nifti2.extension

Create a NIFTI v2 header extension.
nifti.info.from.file

Read the header information and the data of a NIFTI file into a plain list.
nifti.header.to.vox2ras

Compute the voxel-to-RAS matrix from the geometry fields of a NIFTI v1 header.
nifti.resolve.filepath

Resolve the path of a NIFTI file which is given without a file extension.
nifti.info.from.oro.instance

Extract the header information and the data of an oro.nifti instance into a plain list.
nifti.space.info

Compute NIFTI space unit info from xyzt_units header field.
nii1header.for.mgh

Create a NIFTI v1 header from the header information contained in an fs.volume instance.
nifti2.extension.text

Get the payload of a NIFTI v2 header extension as text.
nifti2.read.extensions

Read the header extensions of a NIFTI v2 file.
nifti2.get.extension

Get a NIFTI v2 header extension by code.
nifti2.trailing.nul.removed

Remove trailing NUL bytes from a raw vector.
nifti2.extension.size

Compute the size of a NIFTI v2 header extension in a file.
nifti2.strip.nul

Remove NUL bytes from a raw vector.
nifti2.extension.content

Get the payload of a NIFTI v2 header extension as raw bytes.
nifti2.write.extensions

Write the header extensions of a NIFTI v2 file.
nrrd.dwi.info

Parse the diffusion metadata of a NRRD header.
nrrd.raw.to.numeric

Convert raw bytes of wide integer types into numbers.
nrrd.field.key

Parse a NRRD header field name into a lookup key.
nrrd.read.data

Read the data section of a NRRD file.
nrrd.parse.vector.list

Parse a NRRD vector list value like '(1,0,0) (0,1,0) (0,0,1)'.
open.mrtrix.payload

Open the payload of an MRtrix TCK/TSF file for reading.
nrrd.parse.header

Parse the header lines of a NRRD file.
nrrd.parse.vector

Parse a NRRD vector value like '(1,2,3)'.
nrrd.parse.field.value

Parse a NRRD header field value.
nrrd.skip.lines

Skip whole lines of a connection.
nrrd.parse.quoted.list

Parse a quoted NRRD string list.
nrrd.field

Look up a field in a parsed NRRD header.
nrrd.read.values

Read NRRD values from a connection or a file.
nrrd.parse.matrix

Parse a NRRD matrix value like '(1,0,0) (0,1,0) (0,0,1)'.
ornt.transform

Determine the orientation transform between two orientations.
polygon.soup.to.indexed.mesh

Turn polygon soup into indexed mesh.
nrrd.type.info

Convert the NRRD type name of a volume into R data type information.
parse.mrtrix.file.entry

Parse the 'file' entry of an MRtrix TCK/TSF header.
nrrd.vox2ras

Compute the voxel-to-RAS matrix of a NRRD volume.
parse.mrtrix.write.datatype

Parse and validate the datatype of an MRtrix streamlines file.
nrrd.resolve.data.files

Resolve the data location of a NRRD file.
ply.header.lines

Generate PLY format header lines
open.maybe.gzip

Open a connection that transparently handles gzip compression.
parse.stl.ascii.face

Parse a single ASCII STL face.
parse.mrtrix.datatype

Validate and describe the datatype entry of an MRtrix TCK/TSF header.
parse.mrtrix.header

Parse the key-value pairs of an MRtrix TCK/TSF header.
parse.transform.matrix.lines

Parse matrix from text file lines.
nrrd.read.header.lines

Read the ASCII header of a NRRD file.
ornt2axcodes

Convert an orientation array to axis codes.
print.fs.surface

Print description of a brain surface.
print.fs.annot

Print description of a brain atlas or annotation.
print.fs.connectome

Print an fs.connectome instance.
print.fs.cifti

Print an fs.cifti instance.
print.fs.cifti.data

Print an fs.cifti.data instance.
print.fs.tracts

Print an fs.tracts instance.
parse.mrtrix.count

Parse the 'count' entry of an MRtrix TCK/TSF header.
print.fs.label

Print description of a brain surface label.
print.fs.patch

Print description of a brain surface patch.
print.dti.track.iterator

Print a tract file iterator.
print.fs.transform

Print an fs.transform instance.
nrrd.read.remainder

Read the remaining bytes of a connection.
read.cifti.rows

Read selected matrix rows of a CIFTI-2 file without loading the whole matrix.
read.cifti.header

Read CIFTI-2 header (XML metadata).
read.analyze.header

Read ANALYZE 7.5 header from file.
read.cifti

Read a CIFTI-2 file.
ras.to.talairachras

Compute MNI talairach coordinates from RAS coords.
read.analyze.data

Read ANALYZE 7.5 data from file.
read.dti.bvec

Read b-vectors from a FSL-style bvecs file.
print.fs.volume

Print description of a brain volume.
ras.to.surfaceras

Translate RAS coordinates, as used in volumes by applying vox2ras, to surface RAS.
read.dti.bval

Read b-values from a FSL-style bvals file.
read.dti.tck.header

Read the header of a file in MRtrix 'TCK' or 'TSF' format.
read.dti.gradients

Read and validate a diffusion MRI gradient table.
read.dti.trk

Read fiber tracks from Diffusion Toolkit in trk format.
read.dti.trk.header

Read the header of a TrackVis TRK file.
read.fixed.char.binary

Read fixed length char, possibly containing embedded zeroes, from binary file.
read.element.counts.ply.header

Determine element counts from PLY file header.
read.dti.tsf.header

Read the header of a file in MRtrix 'TSF' format.
read.dti.grad

Read a gradient table in MRtrix3 format.
read.dti.tsf

Read DTI tracking per-coord data from file in MRtrix 'TSF' format.
read.dti.tck

Read DTI tracking data from file in MRtrix 'TCK' format.
read.fs.annot

Read file in FreeSurfer annotation format
read.fs.label.gii

Read a label from a GIFTI label/annotation file.
read.fs.mgh

Read file in FreeSurfer MGH or MGZ format
read.fs.label.native

Read file in FreeSurfer label format
read.fs.gca

Read FreeSurfer GCA file.
read.fs.annot.gii

Read an annotation or label in GIFTI format.
read.fs.connectome.cifti

Read a CIFTI-2 connectome file.
read.fs.curv

Read file in FreeSurfer curv format
read.fs.colortable

Read colortable file in FreeSurfer ASCII LUT format.
read.fs.label

Read a label file.
read.fs.morph.asc

Read morphometry data from ASCII curv format file
read.fs.morph.ni1

Read morphometry data from FreeSurfer NIFTI v1 format files.
read.fs.morph.gii

Read morphometry data file in GIFTI format.
read.fs.morph.bvsmp

Read Brainvoyager vertex-wise statistical surface data from SMP file.
read.fs.morph.txt

Read morphometry data from plain text file
read.fs.morph.cifti

Read surface morphometry data from CIFTI dscalar files.
read.fs.morph.ni2

Read morphometry data from FreeSurfer NIFTI v2 format files.
read.fs.morph.nii

Read morphometry data from FreeSurfer NIFTI format files, determine NIFTI version automatically.
read.fs.parcellation.cifti

Read surface parcellation data from CIFTI dlabel files.
read.fs.morph

Read morphometry data file in any FreeSurfer format.
read.fs.patch

Read FreeSurfer binary or ASCII patch file.
read.fs.patch.asc

Read FreeSurfer ASCII format patch.
read.fs.surface.ico

Read ICO format mesh as surface.
read.fs.surface

Read file in FreeSurfer surface format or various mesh formats.
read.fs.surface.gii

Read GIFTI format mesh as surface.
read.fs.surface.byu

Read mesh in BYU format.
read.fs.surface.geo

Read GEO format mesh as surface.
read.fs.surface.bvsrf

Read Brainvoyager srf format (.srf) mesh as surface.
read.fs.surface.asc

Read FreeSurfer ASCII format surface.
read.fs.series.cifti

Read surface time series data from CIFTI dtseries files.
read.fs.surface.stl.ascii

Read surface mesh in STL ASCII format.
read.fs.surface.mz3

Read surface mesh in mz3 format, used by Surf-Ice.
read.fs.surface.off

Read Object File Format (OFF) mesh as surface.
read.fs.surface.ply

Read Stanford PLY format mesh as surface.
read.fs.tracts.vtk

Read VTK legacy format streamlines as tracts.
read.fs.surface.vtk

Read VTK legacy format mesh as surface.
read.fs.surface.stl

Read mesh in STL format, auto-detecting ASCII versus binary format version.
read.fs.surface.obj

Read OBJ format mesh as surface.
read.fs.transform

Load transformation matrix from a file.
read.fs.surface.stl.bin

Read surface mesh in STL binary format.
read.fs.volume.nrrd

Read volume data from a file in NRRD format.
read.fs.transform.fslmat

Read a transformation matrix from an FSL matrix file.
read.fs.transform.lta

Load transformation matrix from a FreeSurfer linear transform array (LTA) file.
read.fs.volume

Read volume file in MGH, MGZ or NIFTI format
read.fs.transform.itk

Read a transformation matrix from an ITK text transform file.
read.fs.transform.dat

Load transformation matrix from a tkregister dat file.
read.fs.volume.analyze

Read an ANALYZE 7.5 or NIFTI v1 pair file as an fs.volume.
read.fs.weight

Read file in FreeSurfer weight or w format
read.fs.transform.xfm

Load transformation matrix from an XFM file.
read.mrtrix.stream

Read the data payload of an MRtrix TCK/TSF file.
read.nifti1.header

Read NIFTI v1 header from file (which may contain the FreeSurfer hack).
read.fs.volume.nii

Read a 3D or 4D NIFTI file into an fs.volume instance with complete header.
read.nifti.values

Read raw voxel values of a NIFTI v1/v2 or ANALYZE file from a connection.
read.nifti2.data

Read raw data from NIFTI v2 file.
read.mesh.brainvoyager

Read Brainvoyager srf format (.srf) mesh.
read.nifti1.data

Read raw NIFTI v1 data from file (which may contain the FreeSurfer hack).
read.fs.weight.asc

Read ASCII version of FreeSurfer weight file.
read.matlab.v4.matrix

Read the matrices of a MATLAB v4 data file.
read.nifti1.header.internal

Read NIFTI v1 header from file (which may contain the FreeSurfer hack).
read.mrtrix.header

Read the ASCII header of an MRtrix TCK/TSF file.
read.nifti2.header

Read NIFTI v2 header from file.
read.smp.brainvoyager.v3

Read Brainvoyager statistical surface results from v3 SMP file.
read.smp.brainvoyager

Read Brainvoyager statistical surface results from SMP file.
read.nrrd.header

Read the header of a file in NRRD format.
read_nisurface

Read a surface, based on the file path without extension.
read.nifti2.header.internal

Read NIFTI v2 header from file.
read.smp.brainvoyager.v4or5

Read Brainvoyager statistical surface results from v4 or v5 SMP file.
read.smp.brainvoyager.v1or2

Read Brainvoyager statistical surface results from v1 or v2 SMP file.
read.vtk.legacy.polydata

Read a VTK legacy file with a POLYDATA dataset.
read.trk.records

Read the track records of a TRK file.
rotate3D

Rotate a 3D array in 90 degree steps.
read_nisurfacefile.fsascii

Read a FreeSurfer ASCII surface file.
read_nisurfacefile.gifti

Read a gifti file as a surface.
readcolortable_oldformat

Read binary colortable in old format.
read_nisurfacefile

S3 method to read a neuroimaging surface file.
read_safe_bin

Safe wrapper around readBin that verifies the number of elements read.
readable.files

Find files with the given base name and extensions that exist.
rotate2D

Rotate a 2D matrix in 90 degree steps.
read_nisurfacefile.fsnative

Read a FreeSurfer ASCII surface file.
readcolortable

Read binary colortable in v2 format.
scann

Scan exactly n values from source string.
split.mrtrix.chunk

Split one chunk of MRtrix payload values into streamlines.
rotate90

Rotate 2D matrix clockwise in 90 degree steps.
sm1to0

Adapt spatial transformation matrix for 0-based indices.
sm0to1

Adapt spatial transformation matrix for 1-based indices.
skip.connection.bytes

Skip over bytes of a connection, transparently handling gzip.
stl.format.file.is.ascii

Guess whether a mesh file in STL format is the ASCII or the binary version.
scan.trk.file

Scan a TRK file.
scan.dti.tract.file

Scan a tract file without holding its data in memory.
scan.mrtrix.file

Scan an MRtrix TCK or TSF file.
talairachras.to.ras

Compute MNI talairach coordinates from RAS coords.
[.fs.tracts

Subset an fs.tracts instance.
[[.fs.tracts

Access a single tract of an fs.tracts instance.
summary.fs.transform

Summarize an fs.transform instance.
subset.groups

Extract selected groups from a concatenated matrix.
trackvis.affine.to.rasmm

Compute the affine that maps TrackVis coordinates to RAS+ mm.
transform.bbox

Transform a bounding box with an affine.
text.line.is.numeric

Check whether a text line holds a fixed number of numerical values.
surfaceras.to.ras

Translate surface RAS coordinates, as used in surface vertices and surface labels, to volume RAS.
surfaceras.to.talairach

Compute Talairach RAS for surface RAS (e.g., vertex coordinates).
transform2ras

Convert a transformation to RAS world coordinates.
transform.descriptor.path

Get the file path recorded in a volume descriptor.
transform2lps

Convert a transformation to LPS world coordinates.
transform.value.text

Format a single numerical value for a transformation text file.
transform.geometry.for.side

Determine the volume geometry of one side of a transformation.
transform.file.sniff.text

Extract the text of a file for format sniffing.
transform.flip.handedness

Convert a transformation between the LPS and the RAS convention.
transform.matrix.row.lines

Format the rows of a transformation matrix for a text file.
transform.values.text

Format numerical values for a transformation text file.
transform.world.frame

Determine the frame of the world space of a transformation.
vertexdists.to.point

Compute Euclidean distance from all mesh vertices to given point.
translate.mri.dtype

Translate between code and name of MRI data types.
transform2world

Convert a transformation to the world (RAS) coordinate space.
vertex.euclid.dist

Compute Euclidean distance between two vertices v1 and v2.
transform2voxel

Convert a transformation to voxel coordinates.
trk.track.iterator

Create an iterator over the tracts of a TRK file.
validate.dti.gradients

Validate and normalize a diffusion MRI gradient table.
validate_allocation_size

Validate that a requested allocation does not exceed the safety limit.
validate.fs.transform

Check whether an object is a valid fs.transform instance.
validate.bbox

Validate a bounding box argument.
vtk.check.triangles

Check that all cells of the requested type are triangles.
volume.descriptor

Describe a volume for an fs.transform.
vtk.next.line

Read the next line of an ASCII VTK legacy file.
volume.geometry

Get the geometry of a volume.
vtk.next.section

Read the next section header line of a VTK legacy file.
vtk.parse.cell.section

Read the cell array of a VTK legacy section.
vtk.data.type.info

Get the on-disk properties of a VTK legacy data type.
vtk.cell.section.layout

Determine how the cell array of a section is stored.
vtk.as.indices

Convert values that are used as indices to integers.
vtk.reader.numbers

Read numeric values from a binary VTK legacy file.
vtk.parse.count

Read a non-negative integer from a VTK section header.
vtk.peek.line

Look at the next line of an ASCII VTK legacy file.
vtk.reader.close

Close the connection of a VTK legacy reader.
vtk.reader.peek

Read bytes from a VTK legacy reader without consuming them.
vtk.reader.bytes

Consume bytes from a VTK legacy reader.
vtk.section.values

Read numeric values from a VTK legacy section.
vtk.section.values.ascii

Read numeric values from an ASCII VTK legacy section.
vtk.reader.fill

Fill the lookahead buffer of a VTK legacy reader.
vtk.read.header

Read the header of a VTK legacy file and set up the reader.
vtk.reader.new

Create the low-level state used while reading a VTK legacy file.
vtk.split.line

Split a line of a VTK legacy file into whitespace separated tokens.
write.dti.bval

Write b-values to a FSL-style bvals file.
write.analyze.header.internal

Write the 348 byte ANALYZE 7.5 header to a connection.
vtk.write.surface.ascii

Write the sections of a triangular mesh in VTK ASCII format.
write.cifti

Write a CIFTI-2 file.
write.atlas.to.lut.and.csv

Write a brain atlas to a colortable (LUT) file and a per-vertex label file.
write.dti.bvec

Write b-vectors to a FSL-style bvecs file.
write.analyze

Write data to a file in ANALYZE 7.5 format.
write.analyze.char.field

Write a fixed length character field of an ANALYZE 7.5 header.
vtk.write.surface.binary

Write the sections of a triangular mesh in binary VTK format.
write.dti.trk

Write tracks to a file in TrackVis TRK format.
write.dti.grad

Write a gradient table in MRtrix3 format.
write.dti.tck

Write tracks to a file in MRtrix TCK format.
write.fs.annot.gii

Write annotation to GIFTI file.
write.dti.tsf

Write per-point track values to a file in MRtrix TSF format.
write.fs.curv

Write file in FreeSurfer curv format
write.fs.connectome.cifti

Write a CIFTI-2 connectome file.
write.fs.colortable

Write colortable file in FreeSurfer ASCII LUT format.
write.fs.label

Write vertex indices to file in FreeSurfer label format
write.fs.annot

Write annotation to binary file.
write.fs.morph.txt

Write curv data to file in simple text format
write.fs.morph

Write morphometry data in a format derived from the given file name.
write.fs.morph.ni1

Write morphometry data in NIFTI v1 format.
write.fs.morph.cifti

Write morphometry data to a CIFTI-2 .dscalar file.
write.fs.morph.smp

Write morphometry data in Brainvoyager SMP format.
write.fs.mgh

Write file in FreeSurfer MGH or MGZ format
write.fs.label.gii

Write a binary surface label in GIFTI format.
write.fs.morph.asc

Write file in FreeSurfer ASCII curv format
write.fs.morph.ni2

Write morphometry data in NIFTI v2 format.
write.fs.morph.gii

Write morphometry data in GIFTI format.
write.fs.series.cifti

Write time series data to a CIFTI-2 .dtseries file.
write.fs.patch

Write a surface patch
write.fs.surface.asc

Write mesh to file in FreeSurfer ASCII surface format
write.fs.surface.gii

Write mesh to file in GIFTI surface format
write.fs.surface.mz3

Write mesh to file in mz3 binary format.
write.fs.parcellated.cifti

Write a CIFTI-2 parcellated map or series file.
write.fs.parcellation.cifti

Write a parcellation to a CIFTI-2 .dlabel file.
write.fs.surface.bvsrf

Write surface to Brainvoyager SRF file.
write.fs.surface.byu

Write mesh to file in BYU ASCII format.
write.fs.surface

Write mesh to file in FreeSurfer binary surface format
write.fs.surface.ply2

Write mesh to file in PLY2 File Format (.ply2)
write.fs.surface.vtk

Write mesh to file in VTK legacy format
write.fs.transform.dat

Write a tkregister dat file.
write.fs.surface.stl

Write mesh to file in STL format (ASCII or binary).
write.fs.transform

Write a transformation matrix to a file.
write.fs.surface.off

Write mesh to file in Object File Format (.off)
write.fs.surface.off.ply2

Write mesh to file in Object File Format (.off) or PLY2 format.
write.fs.surface.obj

Write mesh to file in Wavefront object (.obj) format
write.fs.surface.ply

Write mesh to file in PLY format (.ply)
write.fs.transform.fslmat

Write a transformation matrix in FSL format.
write.fs.volume

Write an fs.volume instance to a file in MGH, MGZ or NIFTI v1 format.
write.nifti1

Write header and data to a file in NIFTI v1 format.
write.nifti1.data.internal

Write the voxel data of a NIFTI v1 file to a connection.
write.fs.transform.lta

Write a FreeSurfer linear transform array (LTA) file.
write.fs.weight.asc

Write file in FreeSurfer weight ASCII format
write.fs.weight

Write file in FreeSurfer weight format
write.fs.transform.itk

Write an ITK text transform file.
write.fs.transform.xfm

Write an MNI transform (xfm) file.
write.nifti1.header.internal

Write the 348 byte NIFTI v1 header (and the padding up to the data offset) to a connection.
write.mrtrix.streamlines

Write the payload of an MRtrix streamlines file.
write.smp.brainvoyager.v2

Write a brainvoyager v2 SMP file.
write.trk.header

Write the 1000 byte header of a TRK file.
xml_node_gifti_coordtransform

Create XML GIFTI CoordinateSystemTransformMatrix node.
write.nifti2

Write header and data to a file in NIFTI v2 format.
write.smp.brainvoyager

Write a brainvoyager SMP file.
xml_node_gifti_MD

Create XML GIFTI metadata node.
write.stl.binary

Write the sections of a triangular mesh in binary STL format.
write.stl.ascii

Write the sections of a triangular mesh in ASCII STL format.
write.smp.brainvoyager.v3or4or5

Write a brainvoyager v3, v4 or v5 SMP file.
xml_node_gifti_label

Create XML GIFTI Label node.
xml_node_gifti_label_table_from_annot

Compute LabelTable node from annotation.
xml_node_gifti_label_table

Create XML GIFTI LabelTable node.