[Paper Review] ciftiTools: A package for reading, writing, visualizing and manipulating CIFTI files in R
ciftiTools is an R package that enables reading, writing, visualizing, and manipulating CIFTI and GIFTI files for surface-based fMRI analysis, unifying access to cortical, subcortical, and cerebellar grayordinate data. It supports advanced statistical workflows in R, including nuisance regression and scrubbing, and enables end-to-end analysis of functional MRI data in grayordinate space with key results like successful seed correlation computation and data export in standard CIFTI formats.
There is significant interest in adopting surface- and grayordinate-based analysis of MR data for a number of reasons, including improved whole-cortex visualization, the ability to perform surface smoothing to avoid issues associated with volumetric smoothing, improved inter-subject alignment, and reduced dimensionality. The CIFTI grayordinate file format introduced by the Human Connectome Project further advances grayordinate-based analysis by combining gray matter data from the left and right cortical hemispheres with gray matter data from the subcortex and cerebellum into a single file. Analyses performed in grayordinate space are well-suited to leverage information shared across the brain and across subjects through both traditional analysis techniques and more advanced statistical methods, including Bayesian methods. The R statistical environment facilitates use of advanced statistical techniques, yet little support for grayordinates analysis has been previously available in R. Indeed, few comprehensive programmatic tools for working with CIFTI files have been available in any language. Here, we present the ciftiTools R package, which provides a unified environment for reading, writing, visualizing, and manipulating CIFTI files and related data formats. We illustrate ciftiTools' convenient and user-friendly suite of tools for working with grayordinates and surface geometry data in R, and we describe how ciftiTools is being utilized to advance the statistical analysis of grayordinate-based functional MRI data.
Motivation & Objective
- To address the lack of comprehensive R tools for working with CIFTI and GIFTI files in neuroimaging.
- To provide a unified, user-friendly interface for reading, writing, visualizing, and manipulating CIFTI and surface-based neuroimaging data.
- To support advanced statistical analysis of fMRI data in grayordinate space using R’s powerful statistical environment.
- To integrate with existing neuroimaging tools and workflows, including nuisance regression and artifact removal.
- To enable reproducible, end-to-end analysis of functional MRI data from preprocessing to visualization and file export.
Proposed method
- Introduces the 'xifti' S4 class to encapsulate metric/label data with associated surface geometry from GIFTI files.
- Provides functions like read_xifti and write_xifti to import and export CIFTI and GIFTI files, supporting 'dtseries', 'dscalar', and 'dlabel' intents.
- Implements data manipulation via functions such as select_xifti, newdata_xifti, and arithmetic operations for matrix-level transformations.
- Supports surface-based preprocessing through integration with the Connectome Workbench for resampling, smoothing, and transformation.
- Enables statistical processing using R packages like fMRIscrub for nuisance regression and DVARS-based scrubbing.
- Uses view_xifti and plot methods for automatic visualization with adaptive color scaling and 3D rendering of cortical and subcortical data.
Experimental results
Research questions
- RQ1How can CIFTI and GIFTI files be efficiently read, written, and manipulated within the R environment for neuroimaging analysis?
- RQ2To what extent can R support advanced statistical modeling of fMRI data in grayordinate space, including group-level analysis and Bayesian methods?
- RQ3Can a unified R package streamline preprocessing pipelines involving nuisance regression, artifact scrubbing, and seed-based correlation analysis?
- RQ4How does the integration of cortical, subcortical, and cerebellar grayordinate data in a single file format improve whole-brain analysis?
- RQ5What is the performance and usability of ciftiTools in comparison to existing tools in other languages or environments?
Key findings
- The ciftiTools package successfully enables reading and writing of CIFTI and GIFTI files in R, supporting 'dtseries', 'dscalar', and 'dlabel' intents.
- The package facilitates end-to-end preprocessing, including DCT-based nuisance regression and DVARS-based volume scrubbing, reducing artifact contamination in fMRI data.
- After preprocessing, 1,191 volumes remained after scrubbing 9 volumes flagged by DVARS thresholds, indicating effective artifact removal.
- Seed correlation analysis between the posterior cingulate cortex (PCC) and 419 brain regions was computed, revealing strong positive correlations with default mode network (DMN) components.
- The results were visualized using 3D surface rendering and saved as a 'dscalar' CIFTI file, confirming successful data export and reproducibility.
- The package enables seamless workflow integration, such as converting parcellation labels to numeric vectors and mapping seed correlations back to vertex-level data using newdata_xifti.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.