Title: | Tools for Reading, Writing, Viewing and Manipulating CIFTI Files |
---|---|
Description: | CIFTI files contain brain imaging data in "grayordinates," which represent the gray matter as cortical surface vertices (left and right) and subcortical voxels (cerebellum, basal ganglia, and other deep gray matter). 'ciftiTools' provides a unified environment for reading, writing, visualizing and manipulating CIFTI-format data. It supports the "dscalar," "dlabel," and "dtseries" intents. Grayordinate data is read in as a "xifti" object, which is structured for convenient access to the data and metadata, and includes support for surface geometry files to enable spatially-dependent functionality such as static or interactive visualizations and smoothing. |
Authors: | Amanda Mejia [aut, cre], Damon Pham [aut] , John Muschelli [ctb] |
Maintainer: | Amanda Mejia <[email protected]> |
License: | GPL-3 |
Version: | 0.16.1 |
Built: | 2024-10-31 20:18:45 UTC |
Source: | https://github.com/mandymejia/ciftitools |
"xifti"
Add left or right cortical surface geometry to a "xifti"
object.
add_surf(xifti, surfL = NULL, surfR = NULL)
add_surf(xifti, surfL = NULL, surfR = NULL)
xifti |
A |
surfL |
(Optional) Left brain surface model. Can be a file
path to a GIFTI surface geometry file (ends in "*.surf.gii"), a
|
surfR |
(Optional) Right brain surface model. Can be a file
path to a GIFTI surface geometry file (ends in "*.surf.gii"), a
|
surfL
will be added to xifti$surf$cortex_left
and surfR
will be added to xifti$surf$cortex_right
. Any existing surfaces will
be overwritten.
If the resolutions of the data and surfaces do not match, the surfaces will be resampled to match the resolution of the data. The barycentric resampling method, which is recommended for anatomical surfaces, will be used.
the "xifti"
object with added surface geometry components.
Other manipulating xifti:
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Other surface-related:
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
Apply a function across all locations in each parcel, for a pair of data and
parcellation "xifti"
objects that are in registration with one
another. By default, the mean value in each parcel is calculated.
apply_parc( xii, parc, FUN = mean, mwall_value = NA, return_as = c("matrix", "xifti"), ... )
apply_parc( xii, parc, FUN = mean, mwall_value = NA, return_as = c("matrix", "xifti"), ... )
xii |
The |
parc |
The |
FUN |
A function that takes as input an Use |
mwall_value |
If there is a medial wall in |
return_as |
|
... |
Additional arguments to |
A matrix, where
is the number of parcels and
is the length of the output of
FUN
. (For mean
,
).
Other parcellation-related:
load_parc()
,
load_sub_parc()
,
parc_add_subcortex()
,
parc_borders()
,
parc_vals_to_xifti()
Other manipulating xifti:
add_surf()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
"xifti"
Apply a many-to-N function (e.g. mean) to the rows or columns of a
"xifti"
. If applied row-wise, a "xifti"
with N data column(s)
is returned. (If the "xifti"
had the dlabel intent, and values that
are not labels are created, then it is converted to dscalar.) If applied
column-wise, a numeric matrix with N rows is returned.
For univariate functions, use transform_xifti
instead.
apply_xifti(xifti, margin = c(1, 2), FUN, ...)
apply_xifti(xifti, margin = c(1, 2), FUN, ...)
xifti |
A |
margin |
The dimension along which to apply |
FUN |
The function. It should take in a numeric vector and return a length-N numeric vector. |
... |
Additional arguments to |
A "xifti"
if margin == 1
, or a numeric matrix if
margin == 2
Other manipulating xifti:
add_surf()
,
apply_parc()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
"xifti"
to a matrixConverts a "xifti"
to a matrix by concatenating the data from each
brainstructure along the rows. Surfaces and metadata are discarded.
## S3 method for class 'xifti' as.matrix(x, ...)
## S3 method for class 'xifti' as.matrix(x, ...)
x |
A |
... |
Unused |
The input as a matrix. Each brainstructure's data is concatenated.
"xifti"
from dataAssembles cortical data, subcortical data, and/or surface geometry to form a
"xifti"
. The inputs must be data objects (vectors, matrices or
arrays, depending on the argument).
as.xifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL, col_names = NULL, HCP_32k_auto_mwall = TRUE, validate = TRUE ) as_xifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL ) as.cifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL ) as_cifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL )
as.xifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL, col_names = NULL, HCP_32k_auto_mwall = TRUE, validate = TRUE ) as_xifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL ) as.cifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL ) as_cifti( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), subcortVol = NULL, subcortLabs = NULL, subcortMask = NULL, surfL = NULL, surfR = NULL )
cortexL , cortexL_mwall
|
Left cortex data and ROI. Each must be a data matrix or vector. If If Since the unmasked cortices must have the same number of vertices,
|
cortexR , cortexR_mwall
|
Right cortex data and ROI. Each must be a data matrix or vector. If If Since the unmasked cortices must have the same number of vertices,
|
mwall_values |
If |
subcortVol , subcortLabs , subcortMask
|
|
surfL , surfR
|
(Optional) Surface geometries for the left or right cortex.
Can be a surface GIFTI file path or |
col_names |
Names of each measurement/column in the data. |
HCP_32k_auto_mwall |
If left and/or right cortex data is provided, and
the number of vertices matches that of the HCP 32k mesh (29696 on left, and
29716 on right), should the medial wall masks be added to the |
validate |
Validate that the result is a |
Each data or surface component is optional. Metadata components
(cortex[L/R]_mwall
, subcortLabs
, and subcortMask
) will
be ignored if its corresponding data component is not provided. If no data or
surface components are provided, then the template_xifti
will
be returned.
If cortical data are provided without a corresponding medial wall mask, or
if the provided mask is invalid or empty, then the medial wall will be
inferred from data rows that are constantly a value in mwall_values
.
But if mwall_values
is NULL
, no attempt to infer the medial
wall will be made and the medial wall metadata entry will be NULL
.
The total number of grayordinates will be
:
left
vertices,
right vertices and
subcortical
voxels.
, the total number of measurements (columns of data), must be
the same for each brainstructure.
A "xifti"
Other reading:
info_cifti()
,
load_parc()
,
load_surf()
,
read_cifti()
,
read_surf()
,
read_xifti2()
Identify the vertices within boundary_width
edges of a vertex in the
input mask on a triangular mesh. Returns a logical indicating if a vertex
is within boundary_width
edges of the mask.
boundary_mask_surf(faces, mask, boundary_width = 10)
boundary_mask_surf(faces, mask, boundary_width = 10)
faces |
An |
mask |
A length |
boundary_width |
A positive integer representing the width of the
boundary to compute. The furthest vertices from the input mask will be this
number of edges away from the closest vertex in the input mask. Default:
|
A length-V logical vector. Each entry corresponds to the vertex
with the same index. The value is true if a vertex is within
boundary_width
edges of a vertex in the mesh, but is not within the
mesh itself.
Other surface-related:
add_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
Here are groups of commonly-used functions in ciftiTools
:
Functions for reading in CIFTI or GIFTI data:
read_xifti
: Read in a CIFTI file as a "xifti"
read_xifti2
: Read in GIFTI files as a "xifti"
as.xifti
: Combine numeric data to form a "xifti"
read_surf
: Read in a surface GIFTI file as a "surf"
info_cifti
:Read the metadata in a CIFTI file
load_surf
: Read in a surface included in ciftiTools
load_parc
: Read in a parcellation included in ciftiTools
Functions for writing CIFTI or GIFTI data:
write_cifti
: Write a "xifti"
to a CIFTI file
write_xifti2
: Write a "xifti"
to GIFTI and NIFTI files
write_metric_gifti
:Write a numeric data matrix to a metric GIFTI file
write_surf_gifti
: Write a "surf"
to a surface GIFTI file
write_subcort_nifti
:Write subcortical data to NIFTI files
separate_cifti
:Separate a CIFTI file into GIFTI and NIFTI files
Functions for manipulating "xifti"
s:
apply_xifti
: Apply a function along the rows or columns of the "xifti"
data matrix
combine_xifti
: Combine multiple "xifti"
s with non-overlapping brain structures
convert_xifti
: Convert the intent of a "xifti"
merge_xifti
: Concatenate data matrices from multiple "xifti"
s
newdata_xifti
: Replace the data matrix in a "xifti"
remove_xifti
: Remove a brain structure or surface from a "xifti"
select_xifti
: Select data matrix columns of a "xifti"
transform_xifti
: Apply a univariate transformation to a "xifti"
or pair of "xifti"
s
add_surf
: Add surfaces to a "xifti"
move_from_mwall
: Move medial wall vertices back into the "xifti"
data matrix
move_to_mwall
: Move rows with a certain value into the "xifti"
medial wall mask
S3 methods for "xifti"
s:
summary
and print
:Summarize the contents.
as.matrix
:Convert data to a locations by measurements numeric matrix.
dim
:Obtain number of locations and number of measurements.
plot
:Visualize the cortical surface and/or subcortical data.
+
, -
, *
, /
, ^
, %%
, %/%
: Operation between a "xifti"
and a scalar, or between two "xifti"
s.
abs
, ceiling
, exp
, floor
, log
, round
, sign
, and sqrt
: Univariate transformation of "xifti"
data.
Functions for working with surfaces:
read_surf
: Read in a surface GIFTI file as a "surf"
is.surf
: Verify a "surf"
write_surf_gifti
: Write a "surf"
to a surface GIFTI file
view_surf
: Visualize a "surf"
resample_surf
: Resample a "surf"
rotate_surf
: Rotate the geometry of a "surf"
Maintainer: Amanda Mejia [email protected]
Authors:
Damon Pham [email protected] (ORCID)
Other contributors:
John Muschelli [email protected] (ORCID) [contributor]
Useful links:
Report bugs at https://github.com/mandymejia/ciftiTools/issues
ciftiTools
filesCIFTI and surface GIFTI files included in the ciftiTools
package
ciftiTools.files()
ciftiTools.files()
The CIFTI files are from NITRC: cifti-2_test_data-1.2.zip at https://www.nitrc.org/frs/?group_id=454
The surfaces are from the HCP and are included according to these data use terms: Data were provided [in part] by the Human Connectome Project, WU-Minn Consortium (Principal Investigators: David Van Essen and Kamil Ugurbil; 1U54MH091657) funded by the 16 NIH Institutes and Centers that support the NIH Blueprint for Neuroscience Research; and by the McDonnell Center for Systems Neuroscience at Washington University.
Only the inflated surfaces are available as GIFTI files. To access the other
surfaces included in the package (very inflated and midthickness), see
load_surf
.
a list of file paths
ciftiTools
optionGets an R option (with prefix "ciftiTools_") value.
See ciftiTools.listOptions
.
ciftiTools.getOption(opt)
ciftiTools.getOption(opt)
opt |
The option. |
The value, val
ciftiTools
optionsList ciftiTools
options
ciftiTools.listOptions()
ciftiTools.listOptions()
data.frame
describing the options
ciftiTools
optionSets an R option (with prefix "ciftiTools_").
See ciftiTools.listOptions
.
ciftiTools.setOption(opt, val)
ciftiTools.setOption(opt, val)
opt |
The option. |
val |
The value to set the option as. |
The new value, val
"xifti"
s with non-overlapping brain structuresCombine two to three "xifti"
s with non-overlapping brain structures into
a single "xifti"
. The names, intent, and surfaces of the first will be used,
if present. To add more surfaces to the result, use add_surf
.
combine_xifti(..., xii_list = NULL, meta = c("first", "all"))
combine_xifti(..., xii_list = NULL, meta = c("first", "all"))
... |
The |
xii_list |
Alternatively, a list of |
meta |
|
A "xifti"
with data from the inputs
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
"xifti"
objectConvert the intent of a CIFTI file or "xifti"
object
convert_to_dlabel( x, cifti_target_fname = NULL, levels_old = NULL, levels = NULL, labels = NULL, nsig = Inf, colors = "Set2", add_white = TRUE, return_conversion_table = FALSE ) convert_to_dscalar(x, cifti_target_fname = NULL, names = NULL) convert_to_dtseries( x, cifti_target_fname = NULL, time_start = 0, time_step = 1, time_unit = c("second", "hertz", "meter", "radian") ) convert_xifti( x, to = c("dscalar", "dtseries", "dlabel"), cifti_target_fname = NULL, ... )
convert_to_dlabel( x, cifti_target_fname = NULL, levels_old = NULL, levels = NULL, labels = NULL, nsig = Inf, colors = "Set2", add_white = TRUE, return_conversion_table = FALSE ) convert_to_dscalar(x, cifti_target_fname = NULL, names = NULL) convert_to_dtseries( x, cifti_target_fname = NULL, time_start = 0, time_step = 1, time_unit = c("second", "hertz", "meter", "radian") ) convert_xifti( x, to = c("dscalar", "dtseries", "dlabel"), cifti_target_fname = NULL, ... )
x |
The CIFTI file name or |
cifti_target_fname |
File name for the converted CIFTI. Only used if
|
levels_old , levels , labels
|
(Optional) If New label names can be set with Note: |
nsig |
Take this many significant digits for the data values. If
|
colors |
(Optional) "ROY_BIG_BL", the name of a ColorBrewer palette
(see |
add_white |
Append white to the beginning of the colors? Default: |
return_conversion_table |
Return the conversion table along with the
converted |
names |
The column names. If |
time_start , time_step , time_unit
|
(Optional) metadata for the new dtseries |
to |
The desired intent: |
... |
Only used if |
If x
is a CIFTI, the target is a "dlabel"
and
return_conversion_table
, a length-2 list with the first entry being
the ".dlabel" "xifti"
and the second being the conversion table.
Otherwise, the "xifti"
or the output CIFTI file name is directly
returned.
convert_to_dlabel()
: Give the ".dlabel" intent (code 3007/ConnDenseLabel) to an input
"xifti"
. Will use the same label table for each data column. Can also
be used to re-assign values in the label table, or to change label names.
convert_to_dscalar()
: Give the ".dscalar" intent (code 3006/ConnDenseScalar) to an input
CIFTI file or "xifti"
object. Can also be used to set the names for
each column with names
.
convert_to_dtseries()
: Give the ".dtseries" intent (code 3002/ConnDenseSeries) to an input
"xifti"
object. Can also be used to set the time metadata.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
## Not run: # Example: change label names levels_old <- xii$meta$cifti$labels[[1]]$Key newLabels <- paste0("New Label #", seq(length(levels_old))) xii <- convert_to_dlabel(xii, levels_old=levels_old, levels=levels_old, labels=newLabels) # Example: add an empty level levels_old <- xii$meta$cifti$labels[[1]]$Key levels_old <- c(levels_old, max(levels_old)+1) labels <- c(rownames(xii$meta$cifti$labels[[1]]), "Empty") xii <- convert_to_dlabel(xii, levels_old=levels_old, levels=levels_old, labels=labels) # Example: set all but the lowest value to the same value & re-label levels_old <- xii$meta$cifti$labels[[1]]$Key levels <- ifelse(levels_old==min(levels_old), min(levels_old), min(levels_old)+1) labels <- ifelse(levels_old==min(levels_old), "Minimum", "Not minimum") xii <- convert_to_dlabel(xii, levels_old=levels_old, levels=levels, labels=labels) ## End(Not run)
## Not run: # Example: change label names levels_old <- xii$meta$cifti$labels[[1]]$Key newLabels <- paste0("New Label #", seq(length(levels_old))) xii <- convert_to_dlabel(xii, levels_old=levels_old, levels=levels_old, labels=newLabels) # Example: add an empty level levels_old <- xii$meta$cifti$labels[[1]]$Key levels_old <- c(levels_old, max(levels_old)+1) labels <- c(rownames(xii$meta$cifti$labels[[1]]), "Empty") xii <- convert_to_dlabel(xii, levels_old=levels_old, levels=levels_old, labels=labels) # Example: set all but the lowest value to the same value & re-label levels_old <- xii$meta$cifti$labels[[1]]$Key levels <- ifelse(levels_old==min(levels_old), min(levels_old), min(levels_old)+1) labels <- ifelse(levels_old==min(levels_old), "Minimum", "Not minimum") xii <- convert_to_dlabel(xii, levels_old=levels_old, levels=levels, labels=labels) ## End(Not run)
"xifti"
Returns the number of rows (vertices + voxels) and columns (measurements) in
the "xifti"
data.
## S3 method for class 'xifti' dim(x)
## S3 method for class 'xifti' dim(x)
x |
A |
The number of rows and columns in the "xifti"
data.
Erode, dilate, or get the borders of a mask along the cortical surface
edit_mask_surf( x, mwall = NULL, surf = NULL, hemisphere = c("left", "right"), do = c("erode", "dilate", "borders"), depth = 1 ) erode_mask_surf( x, mwall = NULL, surf = NULL, hemisphere = c("left", "right"), depth = 1 ) dilate_mask_surf( x, mwall = NULL, surf = NULL, hemisphere = c("left", "right"), depth = 1 )
edit_mask_surf( x, mwall = NULL, surf = NULL, hemisphere = c("left", "right"), do = c("erode", "dilate", "borders"), depth = 1 ) erode_mask_surf( x, mwall = NULL, surf = NULL, hemisphere = c("left", "right"), depth = 1 ) dilate_mask_surf( x, mwall = NULL, surf = NULL, hemisphere = c("left", "right"), depth = 1 )
x , mwall
|
Vector of the data mask to edit, and the medial wall mask.
These can be specified in two ways. First, Second, In either case, |
surf , hemisphere
|
Provide one: the surface in the same resolution as the data, or the name of the hemisphere of the surface to resample and use (default: resample the left surface). |
do |
|
depth |
How many iterations of the edit? Default: |
The depth of the edit is determined by the number of edges between the
vertices. To erode or dilate based on spatial distance (mm), see
-cifti-dilate
and -cifti-erode
.
x
after erosion or dilation.
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
Get a subset of the mesh vertices that are spatially evenly-sampled, by resampling the mesh and choosing the original vertices closest (Euclidian distance) to the new vertices.
even_vert_samp(surf, n_vert)
even_vert_samp(surf, n_vert)
surf |
A |
n_vert |
The desired number of vertices in the evenly-spaced sample.
Note that the actual size of the subset will likely be close to but not
exactly |
An integer vector giving the indices of the vertices in the subset.
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
Interpolates between entries in the input palette to make a larger palette with COLOR_RES entries.
expand_color_pal(pal, COLOR_RES = 255)
expand_color_pal(pal, COLOR_RES = 255)
pal |
The color palette to expand, as a data.frame with two columns:
|
COLOR_RES |
The number of entries to have in the output palette. |
A data.frame with two columns: "color"
(character: color hex
codes) and "value"
(numeric)
Other coloring:
ROY_BIG_BL()
,
make_color_pal()
,
use_color_pal()
faces
faces |
An |
"xifti"
Make adjustments to a putative "xifti"
so that it is valid. Each
adjustment is reported.
fix_xifti(xifti, verbose = TRUE)
fix_xifti(xifti, verbose = TRUE)
xifti |
A |
verbose |
Report each adjustment? Default: |
Right now it: coerces the data to numeric matrices; adds the "Other" level to the subcortex labels.
The fixed "xifti"
Retrieves the path to the Connectome Workbench executable from a file path that may point to the executable itself, or to the Workbench folder which contains it (i.e., "path/to/workbench/bin_linux64/wb_command" or "path/to/workbench".)
get_wb_cmd_path(wb_path)
get_wb_cmd_path(wb_path)
wb_path |
(Optional) Path to the Connectome Workbench folder or executable. |
The path to the Connectome Workbench executable
"xifti"
and surfacesInfer the numbers of vertices on each cortex of a "xifti"
object.
Also supports the result of info_cifti
.
infer_resolution(xifti, surfL = NULL, surfR = NULL)
infer_resolution(xifti, surfL = NULL, surfR = NULL)
xifti |
A |
surfL |
Left surface |
surfR |
Right surface |
The inferred resolutions for the left and right cortex.
Get CIFTI metadata from the NIFTI header and XML using the Connectome
Workbench command -nifti-information
. The information is formatted as
the meta
component in a "xifti"
object
(see template_xifti
), and includes:
medial wall masks for the left and right cortex
the subcortical labels (ordered spatially)
the subcortical mask
other NIFTI intent-specific metadata
info_cifti(cifti_fname) infoCIfTI(cifti_fname) infocii(cifti_fname)
info_cifti(cifti_fname) infoCIfTI(cifti_fname) infocii(cifti_fname)
cifti_fname |
File path to a CIFTI file (ending in ".d*.nii"). |
Additional metadata depends on the type of CIFTI file:
Start time
The TR
Unit of time
Name of each data column
( Names of each data column.)
( List of data.frames. Row names are the label names. Column names are Key, Red, Green, Blue, and Alpha. List entry names are the names of each data column.)
The metadata component of a "xifti"
for the input CIFTI file
This function interfaces with the "-nifti-information"
Workbench command.
xifti$meta$subcort$labels
is a factor with the following levels:
Cortex-L
Cortex-R
Accumbens-L
Accumbens-R
Amygdala-L
Amygdala-R
Brain Stem
Caudate-L
Caudate-R
Cerebellum-L
Cerebellum-R
Diencephalon-L
Diencephalon-R
Hippocampus-L
Hippocampus-R
Pallidum-L
Pallidum-R
Putamen-L
Putamen-R
Thalamus-L
Thalamus-R
These correspond to the same structures as given by
ft_read_cifti
in the cifti-matlab
MATLAB toolbox. Note that
the first two levels (left and right cortex) are not used.
Other reading:
as.xifti()
,
load_parc()
,
load_surf()
,
read_cifti()
,
read_surf()
,
read_xifti2()
"xifti"
objectCheck if object is valid for a "xifti"
. This alias for
is.xifti
is offered as a convenience, and a message will warn
the user. We recommend using is.xifti
instead.
is.cifti(x, messages = TRUE) is_cifti(x, messages = TRUE) isCIfTI(x, messages = TRUE)
is.cifti(x, messages = TRUE) is_cifti(x, messages = TRUE) isCIfTI(x, messages = TRUE)
x |
The putative |
messages |
If |
Requirements: it is a list with the same structure as
template_xifti
. The size of each data entry must be
compatible with its corresponding mask (medial wall for the cortex and
volumetric mask for the subcortex). Metadata should be present if and only
if the corresponding data is also present. The surfaces can be present
whether or not the cortex data are present.
See the "Label Levels" section for the requirements of
xifti$meta$subcort$labels
.
Logical. Is x
a valid "xifti"
?
xifti$meta$subcort$labels
is a factor with the following levels:
Cortex-L
Cortex-R
Accumbens-L
Accumbens-R
Amygdala-L
Amygdala-R
Brain Stem
Caudate-L
Caudate-R
Cerebellum-L
Cerebellum-R
Diencephalon-L
Diencephalon-R
Hippocampus-L
Hippocampus-R
Pallidum-L
Pallidum-R
Putamen-L
Putamen-R
Thalamus-L
Thalamus-R
These correspond to the same structures as given by
ft_read_cifti
in the cifti-matlab
MATLAB toolbox. Note that
the first two levels (left and right cortex) are not used.
Other common:
read_cifti()
,
resample_cifti()
,
smooth_cifti()
,
view_xifti()
,
write_cifti()
"surf"
object (vertices + faces)Check if object is valid for xifti$surf$cortex_left
or
xifti$surf$cortex_right
, where xifti
is a "xifti"
object.
is.surf(x)
is.surf(x)
x |
The putative |
This is a helper function for is.xifti
.
Requirements: the "surf"
must be a list of three components: "vertices",
"faces", and "hemisphere". The first two should each be a numeric matrix
with three columns. The values in "vertices" represent spatial coordinates
whereas the values in "faces" represent vertex indices defining the face.
Thus, values in "faces" should be integers between 1 and the number of
vertices. The last list entry, "hemisphere", should be "left", "right",
or NULL indicating the brain hemisphere which the surface represents.
Logical. Is x
a valid "surf"
?
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
"xifti"
object.Check if object is valid for a "xifti"
object.
is.xifti(x, messages = TRUE) is_xifti(x, messages = TRUE)
is.xifti(x, messages = TRUE) is_xifti(x, messages = TRUE)
x |
The putative |
messages |
If |
Requirements: it is a list with the same structure as
template_xifti
. The size of each data entry must be
compatible with its corresponding mask (medial wall for the cortex and
volumetric mask for the subcortex). Metadata should be present if and only
if the corresponding data is also present. The surfaces can be present
whether or not the cortex data are present.
See the "Label Levels" section for the requirements of
xifti$meta$subcort$labels
.
Logical. Is x
a valid "xifti"
object?
xifti$meta$subcort$labels
is a factor with the following levels:
Cortex-L
Cortex-R
Accumbens-L
Accumbens-R
Amygdala-L
Amygdala-R
Brain Stem
Caudate-L
Caudate-R
Cerebellum-L
Cerebellum-R
Diencephalon-L
Diencephalon-R
Hippocampus-L
Hippocampus-R
Pallidum-L
Pallidum-R
Putamen-L
Putamen-R
Thalamus-L
Thalamus-R
These correspond to the same structures as given by
ft_read_cifti
in the cifti-matlab
MATLAB toolbox. Note that
the first two levels (left and right cortex) are not used.
ciftiTools
Load a parcellation included in ciftiTools
.
load_parc( name = c("Schaefer_100", "Schaefer_400", "Schaefer_1000", "Yeo_7", "Yeo_17") )
load_parc( name = c("Schaefer_100", "Schaefer_400", "Schaefer_1000", "Yeo_7", "Yeo_17") )
name |
The name of the parcellation to load:
|
When using these parcellations, please cite the corresponding paper(s):
Yeo, B. T. T. et al. The organization of the human cerebral cortex estimated by intrinsic functional connectivity. J Neurophysiol 106, 1125-1165 (2011).
Schaefer, A. et al. Local-Global Parcellation of the Human Cerebral Cortex from Intrinsic Functional Connectivity MRI. Cereb Cortex 28, 3095-3114 (2018).
Kong, R. et al. Individual-Specific Areal-Level Parcellations Improve Functional Connectivity Prediction of Behavior. Cerebral Cortex (2021+) doi:10.1093/cercor/bhab101.
Note that the Schaefer parcels have been matched to networks from Kong (2021+).
The parcellation as a dlabel "xifti"
with one column. Each key
represents one unique parcel.
Other reading:
as.xifti()
,
info_cifti()
,
load_surf()
,
read_cifti()
,
read_surf()
,
read_xifti2()
Other parcellation-related:
apply_parc()
,
load_sub_parc()
,
parc_add_subcortex()
,
parc_borders()
,
parc_vals_to_xifti()
"surf"
included in ciftiTools
Load a "surf"
object from one of the three 32k anatomical surfaces
included in ciftiTools
.
load_surf( hemisphere = c("left", "right"), name = c("inflated", "very inflated", "midthickness"), resamp_res = NULL )
load_surf( hemisphere = c("left", "right"), name = c("inflated", "very inflated", "midthickness"), resamp_res = NULL )
hemisphere |
|
name |
The name of the surface geometry to load: |
resamp_res |
The resolution to resample the surfaces to. If |
The surfaces are from the HCP and are included according to these data use terms: Data were provided [in part] by the Human Connectome Project, WU-Minn Consortium (Principal Investigators: David Van Essen and Kamil Ugurbil; 1U54MH091657) funded by the 16 NIH Institutes and Centers that support the NIH Blueprint for Neuroscience Research; and by the McDonnell Center for Systems Neuroscience at Washington University.
The "surf"
object
Other reading:
as.xifti()
,
info_cifti()
,
load_parc()
,
read_cifti()
,
read_surf()
,
read_xifti2()
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
Control the mapping of values to colors with colors
,
color_mode
, and zlim
.
make_color_pal( colors = NULL, color_mode = c("sequential", "qualitative", "diverging"), zlim = NULL )
make_color_pal( colors = NULL, color_mode = c("sequential", "qualitative", "diverging"), zlim = NULL )
colors |
(Optional) "ROY_BIG_BL", the name of a ColorBrewer palette
(see |
color_mode |
(Optional) |
zlim |
(Optional) Controls the mapping of values to each color in
|
There are three kinds of arguments for colors
: "ROY_BIG_BL"
,
the name of a ColorBrewer palette (see RColorBrewer::brewer.pal.info
and colorbrewer2.org), the name of a viridisLite palette, or a character
vector of color names.
If colors=="ROY_BIG_BL"
, the "ROY_BIG_BL" palette will be used. It is
the same palette as the default for the Connectome Workbench application
(https://github.com/Washington-University/workbench/blob/master/src/Files/PaletteFile.cxx).
The midpoint will be colored
black. From the midpoint toward the upper bound, colors will proceed from
black to red to yellow. From the midpoint toward the lower bound, colors
will proceed from black to blue to purple to green to aqua. Here is how each
color mode behaves if colors=="ROY_BIG_BL"
:
color_mode=="sequential"
Only half of the palette will be
used. If zlim
is length 2, the higher value will be the maximum and
the lower value will be the minimum. Set zlim[1] > zlim[2]
to
reverse the color scale. (Note that the second half, black –> red –>
yellow, is used by default. To use the negative half specify
colors=="ROY_BIG_BL_neg"
instead. It will also be used automatically
by xifti_read_surface
when the data range is negative.)
zlim
can also be length 10, in which case each value corresponds to
the position of an individual color in the half palette.
color_mode=="qualitative"
"ROY_BIG_BL" is not recommended for
qualitative data, so a warning will be issued. Palette colors will be
selected from the landmark "ROY_BIG_BL" colors, with interpolated colors
added if the number of colors in the palette (18) is less than this range.
zlim
should be a single number: the number of unique colors to get.
color_mode=="diverging"
If zlim
is length 2 or 3, the
lowest number will be the lower bound and the highest number will
be the upper bound. If zlim
is length 3, the middle number will be the
midpoint (black). The lower and upper bounds will be aqua and yellow,
respectively, except if zlim
is in descending order, in which case
the color scale will be reversed (lowest is yellow; highest is aqua).
zlim
can also be length 19, in which case each value corresponds to
the position of an individual color in the palette.
If colors
is the name of an RColorBrewer palette (see
RColorBrewer::brewer.pal.info
) or viridisLite palette, the colors in
that palette will be used, and the following behavior applies.
If colors
is a character vector of color names (hex codes or standard
R color names), the following behavior applies directly:
color_mode=="sequential"
If zlim
is length 2, the
higher value will be the maximum and the lower value will be the minimum.
Set zlim[1] > zlim[2]
to reverse the color scale. zlim
can
also be the same length as the palette, in which case each value
corresponds to the position of an individual color in the palette.
color_mode=="qualitative"
zlim
should be a single
number: the number of unique colors to get. Color interpolation will be
used if the number of colors in the palette is less than this range. If
length(zlim)==length(colors)
, each color will be mapped to each
corresponding value.
color_mode=="diverging"
If zlim
is length 2 or 3, the
lowest number will be the lower bound and the highest number will
be the upper bound. If zlim
is length 3, the middle number will be the
midpoint. Set zlim
in descending order to reverse the color scale.
zlim
can also be the same length as the palette, in which case each
value corresponds to the position of an individual color in the palette.
A data.frame with two columns: "color"
(character: color hex
codes) and "value"
(numeric)
Other coloring:
ROY_BIG_BL()
,
expand_color_pal()
,
use_color_pal()
mask: vertices
mask |
A length |
Mask a surface mesh.
mask_surf(surf, mask)
mask_surf(surf, mask)
surf |
A |
mask |
A length |
Apply a binary mask to a "surf"
object (list of vertices and
corresponding faces). Vertices not in the mask are removed, and faces
(triangles) with any vertices not in the mask are removed. Finally,
vertex numbering for the new faces matrix is corrected.
The masked "surf"
object.
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
"xifti"
sConcatenate "xifti"
objects along the columns. They must have the same
brainstructures and resolutions. The first "xifti"
's metadata will be
retained, including its intent.
merge_xifti(..., xifti_list = NULL)
merge_xifti(..., xifti_list = NULL)
... , xifti_list
|
Provide as arguments the |
The concatenated "xifti"
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Move all medial wall locations into the cortical data matrices by assigning them a specific value (e.g. NA).
move_from_mwall(xifti, value = NA, name = "Medial_Wall", RGBA = c(1, 1, 1, 0))
move_from_mwall(xifti, value = NA, name = "Medial_Wall", RGBA = c(1, 1, 1, 0))
xifti |
A |
value |
The value to assign the medial wall locations. Default: |
name , RGBA
|
Only used if the Currently, only one name and set of RGBA values are supported, meaning that
the medial wall locations will have the same Key, name, and color across
all data columns in the Defaults: |
The "xifti"
with re-organized data and medial wall masks
move_to_mwall
unmask_cortex
Move subcortex mask locations into the subcortex data matrix by assigning them a specific value (e.g. NA).
move_from_submask( xifti, new_mask, value = NA, label_value = "Other", name = "Other", RGBA = c(1, 1, 1, 0) )
move_from_submask( xifti, new_mask, value = NA, label_value = "Other", name = "Other", RGBA = c(1, 1, 1, 0) )
xifti |
A |
new_mask |
The new mask, of which the current mask should be a subset.
( |
value |
The value to assign the new locations. Default: |
label_value |
The label value to assign the new locations. Default:
|
name , RGBA
|
Only used if the Currently, only one name and set of RGBA values are supported, meaning that
the out-of-mask subcortex locations will have the same Key, name, and color
across all data columns in the Defaults: |
The "xifti"
with re-organized data and subcortex masks
move_to_submask
unmask_cortex
Move cortical data locations with a specific value(s) to the medial wall mask. For example, dlabel CIFTIs often have medial wall vertices set to a specific key value, rather than a medial wall mask. This function can move those data locations from the data matrix to the medial wall mask in the metadata.
move_to_mwall(xifti, values = c(NA, NaN), drop = FALSE)
move_to_mwall(xifti, values = c(NA, NaN), drop = FALSE)
xifti |
A |
values |
Medial wall values. Default: |
drop |
Only used if the |
The "xifti"
with re-organized data and medial wall masks
move_from_mwall
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Move subcortex data locations with a specific value(s) to the subcortex mask.
move_to_submask(xifti, values = c(NA, NaN), drop = FALSE)
move_to_submask(xifti, values = c(NA, NaN), drop = FALSE)
xifti |
A |
values |
Values to mask out. Default: |
drop |
Only used if the |
The "xifti"
with re-organized data and subcortex masks
move_from_submask
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
"xifti"
Replace the data in a "xifti"
with new data from a data matrix.
newdata_xifti(xifti, newdata, newnames = NULL)
newdata_xifti(xifti, newdata, newnames = NULL)
xifti |
A |
newdata |
The If Can also be a length-one vector to set all values equally. |
newnames |
Replaces the names in the |
If the "xifti"
has grayordinates and
measurements\,
newdata
should be a matrix. If
is not equal to
, then any column names or label tables will be
removed. (A "dlabel" will be converted to a "dscalar".)
The new "xifti"
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Add the subcortex, with each brain structure as a separate parcel, to a "dlabel" cortical parcellation.
parc_add_subcortex(parc, parc_sub = "MNI")
parc_add_subcortex(parc, parc_sub = "MNI")
parc |
A single-column "dlabel" |
parc_sub |
A single-column |
The new parcellation with added subcortical data and labels.
Other parcellation-related:
apply_parc()
,
load_parc()
,
load_sub_parc()
,
parc_borders()
,
parc_vals_to_xifti()
Identify vertices which lie on the border of different parcels.
parc_borders(parc, surf = NULL, hemisphere = c("left", "right"))
parc_borders(parc, surf = NULL, hemisphere = c("left", "right"))
parc |
Integer vector the same length as the number of vertices. Each entry indicates the parcel that vertex belongs to. |
surf |
The surface which the vertices belong to, or just the |
hemisphere |
Only used to choose which default surface to use if
|
Logical vector the same length as parc
indicating if the
vertex lies on a border.
Other parcellation-related:
apply_parc()
,
load_parc()
,
load_sub_parc()
,
parc_add_subcortex()
,
parc_vals_to_xifti()
"xifti"
From a parcellation and a corresponding value matrix, make a "xifti"
object that has the value vector of each parcel across its locations.
parc_vals_to_xifti(parc, vals)
parc_vals_to_xifti(parc, vals)
parc |
A single-column "dlabel" |
vals |
A numeric matrix. Rows should correspond to rows in
the color table of |
A "xifti"
object
Other parcellation-related:
apply_parc()
,
load_parc()
,
load_sub_parc()
,
parc_add_subcortex()
,
parc_borders()
Visualize a single surface
## S3 method for class 'surf' plot(x, ...)
## S3 method for class 'surf' plot(x, ...)
x |
A |
... |
Additional arguments to |
view_xifti
to plot a "xifti"
objectS3 method: use view_xifti
to plot a "xifti"
object
## S3 method for class 'xifti' plot(x, ...)
## S3 method for class 'xifti' plot(x, ...)
x |
A |
... |
Additional arguments to |
Read in a CIFTI file as a "xifti"
object.
read_cifti( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... ) readCIfTI( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... ) readcii( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... ) read_xifti( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... )
read_cifti( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... ) readCIfTI( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... ) readcii( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... ) read_xifti( cifti_fname = NULL, surfL_fname = NULL, surfR_fname = NULL, brainstructures = "all", idx = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, flat = FALSE, mwall_values = c(NA, NaN), verbose = FALSE, ... )
cifti_fname |
File path to a CIFTI file (ending in ".d*.nii"). |
surfL_fname |
(Optional) File path to a GIFTI surface geometry file representing the left cortex. |
surfR_fname |
(Optional) File path to a GIFTI surface geometry file representing the right cortex. |
brainstructures |
Character vector indicating which brain structure(s)
to obtain: If a brain structure is indicated but does not exist in the CIFTI file, a warning will occur and that brain structure will be skipped. |
idx |
Numeric vector indicating the data indices (columns) to read. If
For high-resolution CIFTI files, reading in only a subset of the data saves memory, but will be slower than reading in the entire file due to the required intermediate steps. |
resamp_res |
Resolution to resample the cortical data and surface to.
Default: |
resamp_method |
While adaptive resampling is recommended for metric or label
data, it requires that Note that surfaces will resampled using barycentric resampling regardless of
|
areaL_original_fname , areaR_original_fname
|
File paths to the surfaces
to use for vertex area correction during adaptive resampling. (Only used if
resampling with the adaptive method.) For resampling: the Workbench command for adaptive resampling requires the
target surfaces for area correction too. But to make the workflow easier,
For remapping: |
flat |
Should the result be flattened into a single matrix? If If If |
mwall_values |
If the medial wall locations are not indicated in the
CIFTI, use these values to infer the medial wall mask. Default:
|
verbose |
Should occasional updates be printed? Default: |
... |
Additional arguments to |
First, metadata is obtained with info_cifti
. Then, if no
resampling is requested, the -cifti-convert -to-gifti-ext
Workbench
Command is used to "flatten" the data and save it as a metric or label GIFTI
file, which is read in and separated by brainstructure according to the metadata
(read_cifti_convert
). Otherwise, if sampling is requested,
then the CIFTI is separated into its GIFTI and NIFTI components, resampled,
and then re-assembled (read_cifti_separate
). The former is
much faster for large CIFTI files, so the latter is only used when necessary
for resampling.
If cifti_fname
is not provided, then only the surfaces are read in.
If !flat
, a "xifti"
object. Otherwise, a
matrix (
measurements,
grayordinates).
This function interfaces with the "-cifti-convert"
Workbench command if
resampling is not needed, and the "-cifti-separate"
Workbench command
if resampling is needed.
xifti$meta$subcort$labels
is a factor with the following levels:
Cortex-L
Cortex-R
Accumbens-L
Accumbens-R
Amygdala-L
Amygdala-R
Brain Stem
Caudate-L
Caudate-R
Cerebellum-L
Cerebellum-R
Diencephalon-L
Diencephalon-R
Hippocampus-L
Hippocampus-R
Pallidum-L
Pallidum-R
Putamen-L
Putamen-R
Thalamus-L
Thalamus-R
These correspond to the same structures as given by
ft_read_cifti
in the cifti-matlab
MATLAB toolbox. Note that
the first two levels (left and right cortex) are not used.
Other common:
is.cifti()
,
resample_cifti()
,
smooth_cifti()
,
view_xifti()
,
write_cifti()
Other reading:
as.xifti()
,
info_cifti()
,
load_parc()
,
load_surf()
,
read_surf()
,
read_xifti2()
"surf"
objectCoerce a file path to a surface GIFTI, a "gifti"
object, a list with
entries "pointset" and "triangle", or a "surf"
to a
"surf"
.
read_surf(surf, expected_hemisphere = NULL, resamp_res = NULL) make_surf(surf, expected_hemisphere = NULL, resamp_res = NULL)
read_surf(surf, expected_hemisphere = NULL, resamp_res = NULL) make_surf(surf, expected_hemisphere = NULL, resamp_res = NULL)
surf |
Either a file path to a surface GIFTI; a |
expected_hemisphere |
The expected hemisphere ( |
resamp_res |
The resolution to resample the surfaces to. If |
The "surf"
: a list with components "vertices"
(3D spatial locations), "faces"
(defined by three vertices), and
"hemisphere"
("left"
, "right"
, or NULL
if
unknown).
Other reading:
as.xifti()
,
info_cifti()
,
load_parc()
,
load_surf()
,
read_cifti()
,
read_xifti2()
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
"xifti"
objectRead in GIFTI metric or label files as a "xifti"
object. May also include
surface geometry GIFTI files and perform resampling.
read_xifti2( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), surfL = NULL, surfR = NULL, resamp_res = NULL, col_names = NULL, HCP_32k_auto_mwall = TRUE, read_dir = NULL, validate = TRUE )
read_xifti2( cortexL = NULL, cortexL_mwall = NULL, cortexR = NULL, cortexR_mwall = NULL, mwall_values = c(NA, NaN), surfL = NULL, surfR = NULL, resamp_res = NULL, col_names = NULL, HCP_32k_auto_mwall = TRUE, read_dir = NULL, validate = TRUE )
cortexL , cortexL_mwall
|
Left cortex data and ROI. Each must be a path to a metric or label GIFTI file. If If Since the unmasked cortices must have the same number of vertices,
|
cortexR , cortexR_mwall
|
Right cortex data and ROI. Each must be a path to a metric or label GIFTI file. If If Since the unmasked cortices must have the same number of vertices,
|
mwall_values |
If |
surfL , surfR
|
(Optional) File path(s) to surface GIFTI(s) for the left or right cortex. |
resamp_res |
Resolution to resample the cortical data and surface to.
Default: |
col_names |
Names of each measurement/column in the data. Overrides names indicated in the data components. |
HCP_32k_auto_mwall |
If left and/or right cortex data is provided, and
the number of vertices matches that of the HCP 32k mesh (29696 on left, and
29716 on right), should the medial wall masks be added to the |
read_dir |
(Optional) Append a directory to all file names in the
arguments. If |
validate |
Validate that the result is a |
The "xifti"
object containing all the data in the input giftis.
Other reading:
as.xifti()
,
info_cifti()
,
load_parc()
,
load_surf()
,
read_cifti()
,
read_surf()
Remap CIFTI data between two different spaces, such as between FreeSurfer fsaverage group data and fs_LR group data.
remap_cifti( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) remapCIfTI( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) remapcii( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) remap_xifti( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE )
remap_cifti( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) remapCIfTI( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) remapcii( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) remap_xifti( x, cifti_target_fname = NULL, remap_method = c("adaptive", "barycentric"), areaL_original_fname = NULL, areaR_original_fname = NULL, areaL_target_fname = NULL, areaR_target_fname = NULL, sphereL_original_fname = NULL, sphereR_original_fname = NULL, sphereL_target_fname = NULL, sphereR_target_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE )
x |
The CIFTI file name or |
cifti_target_fname |
File name for the resampled CIFTI. Will be placed
in |
remap_method |
For remapping fs_LR group data to fsaverage, barycentric should be used. For remapping FreeSurfer fsaverage group data to fs_LR, adaptive should be used. |
areaL_original_fname , areaL_target_fname
|
File paths to the left cortex
surfaces to use for vertex area correction during adaptive resampling.
Required if |
areaR_original_fname , areaR_target_fname , sphereR_original_fname , sphereR_target_fname
|
See the corresponding arguments for the left cortex. |
sphereL_original_fname , sphereL_target_fname
|
File paths to the sphere surfaces in the original and target spaces, for the left cortex. |
write_dir |
Where to write the resampled CIFTI (and surfaces if present.)
If |
mwall_values |
If the medial wall locations are not indicated in the
CIFTI, and if Correctly indicating the medial wall locations is important for remapping, because the medial wall mask is taken into account during remapping calculations. |
verbose |
Should occasional updates be printed? Default: |
Can accept a "xifti"
object as well as a path to a CIFTI-file. If
the input "xifti"
object has surface geometry, it will be removed.
This function is in active development: its arguments and behavior may change greatly in future versions of the package.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Remap GIFTI metric or label data between two different spaces, such as
between FreeSurfer fsaverage group data and fs_LR group data. This function
is a wrapper to resample_gifti
.
remap_gifti( original_fname, target_fname, hemisphere = c("left", "right"), remap_method = c("adaptive", "barycentric"), area_original_fname, area_target_fname, ROIcortex_original_fname, ROIcortex_target_fname, sphere_original_fname, sphere_target_fname )
remap_gifti( original_fname, target_fname, hemisphere = c("left", "right"), remap_method = c("adaptive", "barycentric"), area_original_fname, area_target_fname, ROIcortex_original_fname, ROIcortex_target_fname, sphere_original_fname, sphere_target_fname )
original_fname |
The GIFTI file to remap. |
target_fname |
Where to save the remapped file. |
hemisphere |
|
remap_method |
For remapping between fs_LR group data and FreeSurfer fsaverage group data, adaptive resampling should be used. |
area_original_fname , area_target_fname
|
File paths to the surfaces to
use for vertex area correction during adaptive resampling. Required if
|
ROIcortex_original_fname , ROIcortex_target_fname
|
|
sphere_original_fname , sphere_target_fname
|
File paths to the sphere surfaces in the original and target spaces. |
The remapped GIFTI file name, invisibly
This function interfaces with the "-metric-resample"
, "-label-resample"
,
and/or "-surface-resample"
Workbench commands, depending on the input.
Other gifting:
resample_gifti()
,
smooth_gifti()
"xifti"
Remove a brain structure, surface, or subcortical structure from a
"xifti"
.
remove_xifti(xifti, remove = NULL, remove_sub = NULL)
remove_xifti(xifti, remove = NULL, remove_sub = NULL)
xifti |
A |
remove |
A character vector containing one or more of the following:
|
remove_sub |
A vector containing subcortical structures to be removed
from |
The new "xifti"
with the requested component(s) removed
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Performs spatial resampling of CIFTI data on the cortical surface by separating it into GIFTI and NIFTI files, resampling the GIFTIs, and then putting them together. (The subcortex is not resampled.)
resample_cifti( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) resampleCIfTI( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) resamplecii( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) resample_xifti( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE )
resample_cifti( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) resampleCIfTI( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) resamplecii( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE ) resample_xifti( x = NULL, cifti_target_fname = NULL, surfL_original_fname = NULL, surfR_original_fname = NULL, surfL_target_fname = NULL, surfR_target_fname = NULL, resamp_res, resamp_method = c("barycentric", "adaptive"), areaL_original_fname = NULL, areaR_original_fname = NULL, write_dir = NULL, mwall_values = c(NA, NaN), verbose = TRUE )
x |
The CIFTI file name or |
cifti_target_fname |
File name for the resampled CIFTI. Will be placed
in |
surfL_original_fname , surfR_original_fname
|
(Optional) Path to a GIFTI surface geometry file representing the left/right cortex. One or both can be provided. These will be resampled too, and are convenient for visualizing the resampled data. If |
surfL_target_fname , surfR_target_fname
|
(Optional) File names for the
resampled GIFTI surface geometry files. Will be placed in |
resamp_res |
Target resolution for resampling (number of cortical surface vertices per hemisphere). |
resamp_method |
While adaptive resampling is recommended for metric or label
data, it requires that Note that surfaces will resampled using barycentric resampling regardless of
|
areaL_original_fname , areaR_original_fname
|
File paths to the surfaces
to use for vertex area correction during adaptive resampling. (Only used if
resampling with the adaptive method.) For resampling: the Workbench command for adaptive resampling requires the
target surfaces for area correction too. But to make the workflow easier,
For remapping: |
write_dir |
Where to write the resampled CIFTI (and surfaces if present.)
If |
mwall_values |
If the medial wall locations are not indicated in the
CIFTI, use these values to infer the medial wall mask. Default:
Correctly indicating the medial wall locations is important for resampling, because the medial wall mask is taken into account during resampling calculations. |
verbose |
Should occasional updates be printed? Default: |
Can accept a "xifti"
object as well as a path to a CIFTI-file.
If surface data is included, it will be resampled with the barycentric
method even if resamp_method=="adaptive"
because the barycentric
method is recommended for surface geometry data.
A named character vector of written files: "cifti"
and
potentially "surfL"
(if surfL_original_fname
was provided)
and/or "surfR"
(if surfR_original_fname
was provided).
This function interfaces with the "-metric-resample"
, "-label-resample"
,
and/or "-surface-resample"
Workbench commands, depending on the input.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Other common:
is.cifti()
,
read_cifti()
,
smooth_cifti()
,
view_xifti()
,
write_cifti()
Resample a CIFTI from a template, ensuring the new CIFTI's resolution matches that of the template.
resample_cifti_from_template(original_fname, template_fname, target_fname)
resample_cifti_from_template(original_fname, template_fname, target_fname)
original_fname |
A CIFTI file to resample. |
template_fname |
A CIFTI file to use as the template. |
target_fname |
The file name to save the resampled CIFTI. |
The target_fname
, invisibly
This function interfaces with the "-cifti-resample"
Workbench command.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Perform spatial resampling of GIFTI data on the cortical surface (metric and label), or of GIFTI surface geometry data itself.
resample_gifti( original_fname, target_fname, hemisphere = c("left", "right"), file_type = NULL, original_res = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), area_original_fname = NULL, area_target_fname = NULL, ROIcortex_original_fname = NULL, ROIcortex_target_fname = NULL, sphere_original_fname = NULL, sphere_target_fname = NULL, read_dir = NULL, write_dir = NULL ) resampleGIfTI( original_fname, target_fname, hemisphere, file_type = NULL, original_res = NULL, resamp_res, ROIcortex_original_fname = NULL, ROIcortex_target_fname = NULL, read_dir = NULL, write_dir = NULL ) resamplegii( original_fname, target_fname, hemisphere, file_type = NULL, original_res = NULL, resamp_res, ROIcortex_original_fname = NULL, ROIcortex_target_fname = NULL, read_dir = NULL, write_dir = NULL )
resample_gifti( original_fname, target_fname, hemisphere = c("left", "right"), file_type = NULL, original_res = NULL, resamp_res = NULL, resamp_method = c("barycentric", "adaptive"), area_original_fname = NULL, area_target_fname = NULL, ROIcortex_original_fname = NULL, ROIcortex_target_fname = NULL, sphere_original_fname = NULL, sphere_target_fname = NULL, read_dir = NULL, write_dir = NULL ) resampleGIfTI( original_fname, target_fname, hemisphere, file_type = NULL, original_res = NULL, resamp_res, ROIcortex_original_fname = NULL, ROIcortex_target_fname = NULL, read_dir = NULL, write_dir = NULL ) resamplegii( original_fname, target_fname, hemisphere, file_type = NULL, original_res = NULL, resamp_res, ROIcortex_original_fname = NULL, ROIcortex_target_fname = NULL, read_dir = NULL, write_dir = NULL )
original_fname |
The GIFTI file to resample. |
target_fname |
Where to save the resampled file. |
hemisphere |
|
file_type |
|
original_res |
The resolution of the original file. If In general, |
resamp_res |
Target resolution for resampling (number of
cortical surface vertices per hemisphere). Alternatively, provide
In general, |
resamp_method |
While adaptive resampling is recommended for metric or label
data, it requires that |
area_original_fname , area_target_fname
|
File paths to the surfaces to
use for vertex area correction during adaptive resampling. (Ignored if
resampling with the barycentric method.) |
ROIcortex_original_fname |
The name of the ROI file corresponding to
|
ROIcortex_target_fname |
The name of the resampled ROI file. Only
applicable if |
sphere_original_fname , sphere_target_fname
|
File paths to the sphere
surfaces in the original and target resolutions. If possible, the simpler
arguments |
read_dir |
Directory to append to the path of every file name in
|
write_dir |
Directory to append to the path of every file name in
|
The resampled GIFTI file name, invisibly
This function interfaces with the "-metric-resample"
, "-label-resample"
,
and/or "-surface-resample"
Workbench commands, depending on the input.
Other gifting:
remap_gifti()
,
smooth_gifti()
"surf"
objectResample a "surf"
object by writing it to a GIFTI, using the Connectome
Workbench to resample it, and then reading the new file. The barycentric
resampling method, which is recommended for anatomical surfaces, will be
used.
resample_surf(surf, resamp_res, hemisphere = c("left", "right"))
resample_surf(surf, resamp_res, hemisphere = c("left", "right"))
surf |
A |
resamp_res |
The desired resolution |
hemisphere |
|
The new "surf"
This function interfaces with the "-surface-resample"
Workbench command.
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
"surf"
objectRotate a "surf"
. Can be used to adjust the mesh orientation prior
to view_xifti_surface
.
rotate_surf(surf, r1 = 0, r2 = 0, r3 = 0, units = c("radians", "degrees"))
rotate_surf(surf, r1 = 0, r2 = 0, r3 = 0, units = c("radians", "degrees"))
surf |
The |
r1 , r2 , r3
|
Angle to rotate along the first, second, and third column's
axis, in With |
units |
|
The rotated "surf"
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
surf_area()
,
view_surf()
,
write_surf_gifti()
"ROY_BIG_BL", the default palette from the Connectome Workbench.
ROY_BIG_BL(min = 0, max = 1, mid = NULL, half = NULL, pos_half = FALSE)
ROY_BIG_BL(min = 0, max = 1, mid = NULL, half = NULL, pos_half = FALSE)
min |
The minimum value for the color mapping. As in the original
palette, the last color (aqua) is actually placed at the bottom .5\
the minimum and maximum. Default: |
max |
The maximum value for the color mapping. If this value is lower
than the minimum, the color mapping will be reversed. If this is equal to
the minimum, a palette with only the color black will be returned.
Default: |
mid |
(Optional) The midpoint value for the color mapping. If
|
half |
|
pos_half |
Deprecated. Use |
Yields the landmark color hex codes and values for the "ROY_BIG_BL" palette. This is the same color palette as the default Connectome Workbench palette. Source: https://github.com/Washington-University/workbench/blob/master/src/Files/PaletteFile.cxx
A data.frame with two columns: "color"
(character: color hex
codes) and "value"
(numeric)
Other coloring:
expand_color_pal()
,
make_color_pal()
,
use_color_pal()
Runs a Connectome Workbench command that has already been formatted.
run_wb_cmd(cmd, intern = TRUE, ignore.stdout = NULL, ignore.stderr = NULL)
run_wb_cmd(cmd, intern = TRUE, ignore.stdout = NULL, ignore.stderr = NULL)
cmd |
The full command, beginning after the workbench path. |
intern |
Return printed output? If |
ignore.stdout , ignore.stderr
|
The "ignore.stdout" and "ignore.stderr"
arguments to |
If intern==TRUE
, the printed output of the command.
If intern==FALSE
, a logical indicating if the command finished
successfully.
"xifti"
S3 Math methodsMath methods for "xifti"
objects.
## S3 method for class 'xifti' Math(x, ...)
## S3 method for class 'xifti' Math(x, ...)
x |
The |
... |
Additional arguments to the function |
Uses transform_xifti
.
"xifti"
S3 Ops methodsOps methods for "xifti"
objects.
## S3 method for class 'xifti' Ops(e1, e2 = NULL)
## S3 method for class 'xifti' Ops(e1, e2 = NULL)
e1 , e2
|
The arguments to the operation. |
Uses transform_xifti
.
"xifti"
S3 Summary methodsSummary methods for "xifti"
objects.
## S3 method for class 'xifti' Summary(..., na.rm = FALSE)
## S3 method for class 'xifti' Summary(..., na.rm = FALSE)
... |
The |
na.rm |
Remove |
Scale CIFTI data. Similar to scale
.
scale_xifti(xifti, center = TRUE, scale = TRUE)
scale_xifti(xifti, center = TRUE, scale = TRUE)
xifti |
A |
center , scale
|
Arguments to |
The input "xifti"
with scaled columns.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
"xifti"
Select column indices to keep in a "xifti"
. Can also be used to
reorder the columns.
select_xifti(xifti, idx, add_meta = "select")
select_xifti(xifti, idx, add_meta = "select")
xifti |
A |
idx |
The column indices to keep, in order. |
add_meta |
Add |
The "xifti"
with only the selected columns.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
set_names_xifti()
,
smooth_cifti()
,
transform_xifti()
Separate a CIFTI file into GIFTI files for the cortical data and NIFTI files
for the subcortical data and labels. ROIs can also be written to indicate
the medial wall mask (cortex) and volume mask (subcortex). This uses the
Connectome Workbench command -cifti-separate
.
separate_cifti( cifti_fname, brainstructures = NULL, cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL ) separateCIfTI( cifti_fname, brainstructures = "all", cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL ) separatecii( cifti_fname, brainstructures = "all", cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL )
separate_cifti( cifti_fname, brainstructures = NULL, cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL ) separateCIfTI( cifti_fname, brainstructures = "all", cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL ) separatecii( cifti_fname, brainstructures = "all", cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL )
cifti_fname |
File path to a CIFTI file (ending in ".d*.nii"). |
brainstructures |
(Optional) character vector indicating a subset of
brain structure(s) to write: |
cortexL_fname , cortexR_fname
|
(Optional) GIFTI file names (*.[func/label].gii) to save the [left/right] cortex data to. dtseries and dscalar files should use "func", whereas dlabel files should use "label". If |
subcortVol_fname , subcortLabs_fname
|
(Optional) NIFTI file names to save the subcortical [volume/labels] to. Provide both or neither. If |
ROI_brainstructures |
Which ROIs should be obtained? |
ROIcortexL_fname , ROIcortexR_fname
|
(Optional) GIFTI file names (*.[func/label].gii) to save the [left/right] cortex ROI to. dtseries and dscalar files should use "func", whereas dlabel files should use "label". If The cortical ROIs typically represent the medial wall
mask, with values of 1 for in-ROI (non-medial wall) vertices and 0 for
out-of-ROI (medial wall) vertices. Will be written in |
ROIsubcortVol_fname |
(Optional) NIFTI file names to save the subcortical ROI to. If The subcortical ROI typically represents the volumetric
mask for the entire subcortical structure, with values of 1 for in-ROI
(in subcortex) voxels and 0 for out-of-ROI (not in subcortex) voxels. Will
be written in |
write_dir |
(Optional) A path to an existing directory. If provided,
every component in the |
Time unit, start, and step (dtseries files) will not be written to the GIFTI/NIFTIs. Column names (dscalar files) will not be written to the GIFTIs, as well as label names and colors (dlabel files). (Haven't checked the NIFTIs yet.)
ROI/medial wall behavior: If there are 32k vertices in the left cortex with
3k representing the medial wall, then both cortexL_fname
and
ROIcortexL_fname
will have 32k entries, 3k of which having a value of
0 indicating the medial wall. The non-medial wall entries will have the
data values in cortexL_fname
and a value of 1 in
ROIcortexL_fname
. Thus, exporting ROIcortexL_fname
is vital if
the data values include 0, because 0-valued non-medial wall vertices and
medial wall vertices cannot be distinguished from one another within
cortexL_fname
alone.
A named character vector with the file paths to the written NIFTI and GIFTI files
This function interfaces with the "-cifti-separate"
Workbench command.
Other writing:
write_cifti()
,
write_metric_gifti()
,
write_subcort_nifti()
,
write_surf_gifti()
,
write_xifti2()
"xifti"
column namesChange the column names of a "dscalar"
or "dlabel"
"xifti"
object.
set_names_xifti(xifti, names)
set_names_xifti(xifti, names)
xifti |
A |
names |
The new column names, as a character vector with length
equal to the same number of columns in |
xifti
with the new column names.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
smooth_cifti()
,
transform_xifti()
Spatially smooth the metric data of a CIFTI file or "xifti"
object.
smooth_cifti( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 3, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE ) smoothCIfTI( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 5, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE ) smoothcii( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 5, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE ) smooth_xifti( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 5, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE )
smooth_cifti( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 3, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE ) smoothCIfTI( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 5, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE ) smoothcii( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 5, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE ) smooth_xifti( x, cifti_target_fname = NULL, surf_FWHM = 5, vol_FWHM = 5, surfL_fname = NULL, surfR_fname = NULL, cerebellum_fname = NULL, subcortical_zeroes_as_NA = FALSE, cortical_zeroes_as_NA = FALSE, subcortical_merged = FALSE )
x |
The CIFTI file name or |
cifti_target_fname |
File name for the smoothed CIFTI. If
|
surf_FWHM , vol_FWHM
|
The full width at half maximum (FWHM) parameter
for the gaussian surface or volume smoothing kernel, in mm. Default: |
surfL_fname , surfR_fname
|
(Required if the corresponding cortex is
present) Surface GIFTI files for the left and right cortical surfaces. If
not provided, the surfaces in |
cerebellum_fname |
(Optional) Surface GIFTI file for the cerebellar surface |
subcortical_zeroes_as_NA , cortical_zeroes_as_NA
|
Should zero-values in
the subcortical volume or cortex be treated as NA? Default: |
subcortical_merged |
Smooth across subcortical structure boundaries?
Default: |
If the CIFTI is a ".dlabel" file (intent 3007), then it will be converted to a ".dscalar" file because the values will no longer be integer indices. Unless the label values were ordinal, this is probably not desired so a warning will be printed.
Can accept a "xifti"
object as well as a path to a CIFTI-file.
Surfaces are required for each hemisphere in the CIFTI. If they are not provided, the default inflated surfaces will be used.
Conversion for sigma:
The cifti_target_fname
, invisibly, if x
was a CIFTI
file name. A "xifti"
object if x
was a "xifti"
object.
This function interfaces with the "-cifti-smoothing"
Workbench command.
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
transform_xifti()
Other common:
is.cifti()
,
read_cifti()
,
resample_cifti()
,
view_xifti()
,
write_cifti()
Smooths metric GIFTI data along the cortical surface. The results are written to a new GIFTI file.
smooth_gifti( original_fname, target_fname, surf_fname = NULL, surf_FWHM = 5, hemisphere = c("left", "right"), ROI_fname = NULL, zeroes_as_NA = FALSE ) smoothGIfTI( original_fname, target_fname, surf_fname, surf_FWHM = 5, zeroes_as_NA = FALSE ) smoothgii( original_fname, target_fname, surf_fname, surf_FWHM = 5, zeroes_as_NA = FALSE )
smooth_gifti( original_fname, target_fname, surf_fname = NULL, surf_FWHM = 5, hemisphere = c("left", "right"), ROI_fname = NULL, zeroes_as_NA = FALSE ) smoothGIfTI( original_fname, target_fname, surf_fname, surf_FWHM = 5, zeroes_as_NA = FALSE ) smoothgii( original_fname, target_fname, surf_fname, surf_FWHM = 5, zeroes_as_NA = FALSE )
original_fname |
The GIFTI file to smooth. |
target_fname |
Where to save the smoothed file. |
surf_fname |
Surface GIFTI files cortical surface along which to smooth. If not provided, the default inflated surfaces will be used. |
surf_FWHM |
The full width at half maximum (FWHM) parameter
for the gaussian surface smoothing kernel, in mm. Default: |
hemisphere |
The cortex hemisphere: |
ROI_fname |
The ROI to limit smoothing to, as a metric file. This is used to exclude the medial wall from smoothing. If not provided (default) all the data is smoothed across the surface. |
zeroes_as_NA |
Should zero-values be treated as NA? Default: |
The smoothed GIFTI file name, invisibly
This function interfaces with the "-metric-smoothing"
Workbench command.
Other gifting:
remap_gifti()
,
resample_gifti()
Table of labels for cortex hemispheres (left and right) and subcortical
substructures. The same labels used by the HCP data are here, plus "Other".
Names from the CIFTI format ("CIFTI_STRUCTURE_*") and the names used by
ciftiTools
are given.
substructure_table()
substructure_table()
The names used by ciftiTools
are based on those in
FT_READ_CIFTI
from the FieldTrip MATLAB toolbox.
A data.frame with each substructure along the rows. The first
column gives the CIFTI format name and the second column gives the
ciftiTools
name.
"surf"
objectSummary method for class "surf"
## S3 method for class 'surf' summary(object, ...) ## S3 method for class 'summary.surf' print(x, ...) ## S3 method for class 'surf' print(x, ...)
## S3 method for class 'surf' summary(object, ...) ## S3 method for class 'summary.surf' print(x, ...) ## S3 method for class 'surf' print(x, ...)
object |
|
... |
further arguments passed to or from other methods. |
x |
Object of class "surf". |
"xifti"
objectSummary method for class "xifti"
## S3 method for class 'xifti' summary(object, ...) ## S3 method for class 'summary.xifti' print(x, ...) ## S3 method for class 'xifti' print(x, ...)
## S3 method for class 'xifti' summary(object, ...) ## S3 method for class 'summary.xifti' print(x, ...) ## S3 method for class 'xifti' print(x, ...)
object |
Object of class |
... |
further arguments passed to or from other methods. |
x |
A |
ciftiTools
Table of CIFTI file types (NIFTI intents) supported by ciftiTools
.
supported_intents()
supported_intents()
See https://www.nitrc.org/forum/attachment.php?attachid=334&group_id=454&forum_id=1955 for information about the different NIFTI intents.
A data.frame
with each supported file type along the rows, and
column names "extension", "intent_code", "value", and "intent_name"
Calculate surface area of a "surf"
object by vertex or face. Surface
area calculation by vertex matches the Workbench command
"-surface-vertex-areas".
surf_area(surf, by = c("vertex", "face"))
surf_area(surf, by = c("vertex", "face"))
surf |
The |
by |
|
Vector of surface areas by
vertex or face, in the same order
as how the vertices or faces are listed in surf
. The units are the
square of the units of surf$vertices
.
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
view_surf()
,
write_surf_gifti()
"xifti"
or pair of "xifti"
s.Apply a univariate transformation to each value in a "xifti"
or pair of
"xifti"
s. If a pair, they must share the same dimensions (brainstructures)
and number of measurements.
transform_xifti(xifti, FUN, xifti2 = NULL, idx = NULL, ...)
transform_xifti(xifti, FUN, xifti2 = NULL, idx = NULL, ...)
xifti |
A |
FUN |
The function. If |
xifti2 |
The second xifti, if applicable. Otherwise, |
idx |
The column indices for which to apply the transformation.
If |
... |
Additional arguments to |
If the "xifti"
had the dlabel intent, and the transformation creates
any value that is not a label value (e.g. a non-integer), then it is converted
to a dscalar.
Technically, the function does not have to be univariate: it only has to return the
same number of values as the input. The function will be applied to the matrix
for each brain structure separately. For example, the function
function(q){(q - mean(q)) / sd(q)}
will scale each brainstructure, while
scale
will scale each column of each brainstructure.
A "xifti"
storing the result of applying FUN
to the input(s).
The data dimensions will be the same. The metadata of xifti
will be retained,
and the metadata of xifti2
will be discarded (if provided).
Other manipulating xifti:
add_surf()
,
apply_parc()
,
apply_xifti()
,
combine_xifti()
,
convert_to_dlabel()
,
merge_xifti()
,
move_to_mwall()
,
move_to_submask()
,
newdata_xifti()
,
remap_cifti()
,
remove_xifti()
,
resample_cifti()
,
resample_cifti_from_template()
,
scale_xifti()
,
select_xifti()
,
set_names_xifti()
,
smooth_cifti()
Un-applies the mask to the subcortical data in a "xifti"
to yield its
volumetric representation.
unmask_subcortex(xifti, fill = NA)
unmask_subcortex(xifti, fill = NA)
xifti |
A |
fill |
The value for locations outside the mask. Default: |
The 3D or 4D unflattened volume array
Applies a palette to a data vector to yield a vector of colors.
use_color_pal(data_values, pal, color_NA = "white", indices = FALSE)
use_color_pal(data_values, pal, color_NA = "white", indices = FALSE)
data_values |
The values to map to colors |
pal |
The palette to use to map values to colors |
color_NA |
The color to use for |
indices |
Return the numeric indices of colors in |
A character vector of color names (or integers if indices
).
Other coloring:
ROY_BIG_BL()
,
expand_color_pal()
,
make_color_pal()
vertices
vertices |
A |
Create a single image which displays multiple image files. Tailored to support
composite layouts of plots from view_xifti
.
view_comp( img, ncol = NULL, nrow = NULL, legend = NULL, title = NULL, legend_height = 0.3, title_height = 0.1, title_fsize = 5, newpage = is.null(fname), fname = NULL, ... )
view_comp( img, ncol = NULL, nrow = NULL, legend = NULL, title = NULL, legend_height = 0.3, title_height = 0.1, title_fsize = 5, newpage = is.null(fname), fname = NULL, ... )
img |
Character vector of paths to images to include. They will be arranged by row. |
ncol , nrow
|
Control the layout of the composite image. |
legend |
File path to a legend image to add, or |
title |
A length-one character vector to use as the title, or |
legend_height , title_height
|
Heights of the legend and title, if
applicable. Specified relative to all the plots, so |
title_fsize |
Multiplier for font size. Default: |
newpage |
Call |
fname |
If |
... |
Additional arguments to |
Requires the following packages: png
, grid
, gridExtra
How it works: the non-legend images (plots) are composited in a call to
grid::arrangeGrob
. If a title or legend exists, it's added to the top and
bottom, respectively, of the plots after with another call to grid::arangeGrob
.
The composite plot
Other visualizing:
view_surf()
,
view_xifti()
,
view_xifti_surface()
,
view_xifti_volume()
"surf"
object(s)Visualize one or two "surf"
objects(s), or the "surf"
component(s) in a "xifti"
using an interactive Open GL window
made with rgl
. The rgl
package is required.
view_surf( ..., view = c("both", "lateral", "medial"), widget = NULL, title = NULL, fname = FALSE, cex.title = NULL, text_color = "black", bg = NULL, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, width = NULL, height = NULL, zoom = NULL )
view_surf( ..., view = c("both", "lateral", "medial"), widget = NULL, title = NULL, fname = FALSE, cex.title = NULL, text_color = "black", bg = NULL, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, width = NULL, height = NULL, zoom = NULL )
... |
One of: A |
view |
Which view to display: |
widget |
Display the plot in an htmlwidget? Should be logical or
|
title |
Optional title(s) for the plot(s). It will be printed at the top in a separate subplot with 1/4 the height of the brain cortex subplots. Default: To use a custom title(s), use a length 1 character vector (same title for
each plot) or length If the title is non-empty but does not appear, try lowering |
fname |
Save the plot(s) (and color legend if applicable)? If If If neither of the cases above apply, a png image will be written for each
|
cex.title |
Font size multiplier for the title. |
text_color |
Color for text in title and colorbar legend. Default:
|
bg |
Background color. |
alpha |
Transparency value for mesh coloring, between 0 and 1. Default:
|
edge_color |
Outline each edge in this color. Default: |
vertex_color |
Draw each vertex in this color. Default:
|
vertex_size |
Draw each vertex with this size. Default: |
material |
A list of materials from |
width , height
|
The dimensions of the RGL window, in pixels. If both are
The plot will be taller than If multiple |
zoom |
Adjust the sizes of the brain meshes. Default: |
This function works as a wrapper to view_xifti_surface
, but
some arguments are not applicable (e.g. color scheme and legend). Also,
instead of using the hemisphere
argument, name the surface arguments
surfL
or surfR
(see description for parameter ...
).
Finally, the default value for param
is "surf"
, not
"xifti"
.
To navigate the interactive Open GL window and html widget, left click and
drag the cursor to rotate the meshes. Use the scroll wheel or right click
and drag to zoom. Press the scroll wheel and drag to change the field-of-view.
For Open GL windows, execute
snapshot
to save the current window as a .png file,
close3d
to close the window, and
view3d
to programmatically control the
perspective.
To embed an interactive plot in an R Markdown document, first execute
rgl::setupKnitr()
to prepare the document for embedding the widget.
Then execute the plot command as you normally would to create a widget (i.e.
without specifying fname
, and by requesting more than one idx
or by setting widget
to TRUE
). When the R Markdown document is
knitted, the interactive widget should be displayed below the chunk in which
the plot command was executed. See the vignette for an example.
To embed a static plot in an R Markdown document, first execute
rgl::setupKnitr()
to prepare the document for embedding the snapshot
of the Open GL window. Then execute the plot command as you normally would
to create an Open GL window (i.e. without specifying fname
, and by
requesting only one idx
). In the options for the chunk in which the
plot command is executed, set rgl=TRUE, format="png"
. You can also
control the image dimensions here e.g. fig.height=3.8, fig.width=5
.
When the R Markdown document is knitted, the static plots should be
displayed below the chunk in which the plot command was executed. See the
vignette for an example.
Other visualizing:
view_comp()
,
view_xifti()
,
view_xifti_surface()
,
view_xifti_volume()
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
write_surf_gifti()
"xifti"
objectDisplays the data in a "xifti"
object using view_xifti_surface
and/or view_xifti_volume
. Compared to calling these two
functions separately on the same data, this function may be more convenient
since the automatic choice of color mode and limits is determined across
the entire data and shared between the two plots. Also, if writing files
the subcortical plots will not overwrite the cortical plots.
view_xifti(xifti, what = NULL, ...) view_cifti(xifti, ...) viewCIfTI(xifti, ...) viewcii(xifti, ...)
view_xifti(xifti, what = NULL, ...) view_cifti(xifti, ...) viewCIfTI(xifti, ...) viewcii(xifti, ...)
xifti |
A |
what |
|
... |
Additional arguments to pass to either view function. |
The return value of view_xifti_surface
or
view_xifti_volume
.
Other common:
is.cifti()
,
read_cifti()
,
resample_cifti()
,
smooth_cifti()
,
write_cifti()
Other visualizing:
view_comp()
,
view_surf()
,
view_xifti_surface()
,
view_xifti_volume()
"xifti"
Visualize "xifti"
cortical data using an interactive Open GL window
or htmlwidget made with rgl
. The rmarkdown
package is
required for the htmlwidget functionality.
view_xifti_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL ) view_cifti_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL ) viewCIfTI_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL ) viewcii_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL )
view_xifti_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL ) view_cifti_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL ) viewCIfTI_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL ) viewcii_surface( xifti = NULL, surfL = NULL, surfR = NULL, color_mode = "auto", zlim = NULL, colors = NULL, idx = NULL, hemisphere = NULL, together = NULL, together_ncol = NULL, together_title = NULL, view = c("both", "lateral", "medial"), widget = NULL, title = NULL, slider_title = "Index", fname = FALSE, fname_suffix = c("names", "idx"), legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, text_color = "black", bg = NULL, NA_color = "white", borders = FALSE, alpha = 1, edge_color = NULL, vertex_color = NULL, vertex_size = 0, material = NULL, shadows = 1, width = NULL, height = NULL, zoom = NULL )
xifti |
A |
surfL , surfR
|
(Optional) The brain surface model to use. Each can be a
|
color_mode |
(Optional) |
zlim |
(Optional) Controls the mapping of values to each
color in |
colors |
(Optional) |
idx |
The time/column index of the data to display. If its length is greater than one, and |
hemisphere |
Which brain cortex to display: "both" (default), "left", or "right". Each will be plotted in a separate panel column. If a brain cortex is requested but no surface is available, a default inflated surface will be used. This argument can also be Surfaces without data will be colored white. |
together |
Only applies if saving image files (
|
together_ncol |
If |
together_title |
If a composite image is made based on |
view |
Which view to display: |
widget |
Display the plot in an htmlwidget? Should be logical or
|
title |
Optional title(s) for the plot(s). It will be printed at the top in a separate subplot with 1/4 the height of the brain cortex subplots. Default: To use a custom title(s), use a length 1 character vector (same title for
each plot) or length If the title is non-empty but does not appear, try lowering |
slider_title |
Text at bottom of plot that will be added if a slider
is used, to provide a title for it. Default: |
fname |
Save the plot(s) (and color legend if applicable)? If If If neither of the cases above apply, a png image will be written for each
|
fname_suffix |
Either the data column names ( |
legend_fname |
Save the color legend? Since the legend is the same
for each |
legend_ncol |
Number of columns in color legend. If
|
legend_alllevels |
Show all label levels in the color legend? If
|
legend_embed |
Should the colorbar be embedded in the plot?
It will be positioned in the bottom-left corner, in a separate subplot
with 1/4 the height of the brain cortex subplots. Default: Only applies if the color bar is used (sequential or diverging data)
or if |
digits |
The number of digits for the colorbar legend ticks.
If |
scientific |
Use scientific notation? If |
cex.title |
Font size multiplier for the title. |
text_color |
Color for text in title and colorbar legend. Default:
|
bg |
Background color. |
NA_color |
The color for the medial wall and |
borders |
Only applicable if |
alpha |
Transparency value for mesh coloring, between 0 and 1. Default:
|
edge_color |
Outline each edge in this color. Default: |
vertex_color |
Draw each vertex in this color. Default:
|
vertex_size |
Draw each vertex with this size. Default: |
material |
A list of materials from |
shadows |
Number from 0 (maximum added lighting) to 1 (no added
lighting) to control the darkness and extent of shadowing on the 3D surface.
Default: |
width , height
|
The dimensions of the RGL window, in pixels. If both are
The plot will be taller than If multiple |
zoom |
Adjust the sizes of the brain meshes. Default: |
If a png or html file(s) were written, the names of the files for each index (and color legend if applicable) will be returned. Otherwise, the widget itself is returned if a widget was used, and the rgl object IDs are returned if an Open GL window was used. The rgl object IDs are useful for further programmatic manipulation of the Open GL window.
To navigate the interactive Open GL window and html widget, left click and
drag the cursor to rotate the meshes. Use the scroll wheel or right click
and drag to zoom. Press the scroll wheel and drag to change the field-of-view.
For Open GL windows, execute
snapshot
to save the current window as a .png file,
close3d
to close the window, and
view3d
to programmatically control the
perspective.
To embed an interactive plot in an R Markdown document, first execute
rgl::setupKnitr()
to prepare the document for embedding the widget.
Then execute the plot command as you normally would to create a widget (i.e.
without specifying fname
, and by requesting more than one idx
or by setting widget
to TRUE
). When the R Markdown document is
knitted, the interactive widget should be displayed below the chunk in which
the plot command was executed. See the vignette for an example.
To embed a static plot in an R Markdown document, first execute
rgl::setupKnitr()
to prepare the document for embedding the snapshot
of the Open GL window. Then execute the plot command as you normally would
to create an Open GL window (i.e. without specifying fname
, and by
requesting only one idx
). In the options for the chunk in which the
plot command is executed, set rgl=TRUE, format="png"
. You can also
control the image dimensions here e.g. fig.height=3.8, fig.width=5
.
When the R Markdown document is knitted, the static plots should be
displayed below the chunk in which the plot command was executed. See the
vignette for an example.
Other visualizing:
view_comp()
,
view_surf()
,
view_xifti()
,
view_xifti_volume()
"xifti"
Visualize the subcortical data in a "xifti"
using a series of 2D
slices (based on overlay
) or an interactive widget
(based on papayar::papaya
). Note: papayar
has been removed
from CRAN so the widget is not available. If papayar
returns to CRAN
the widget will be made available again.
view_xifti_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... ) view_cifti_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... ) viewCIfTI_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... ) viewcii_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... )
view_xifti_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... ) view_cifti_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... ) viewCIfTI_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... ) viewcii_volume( xifti, structural_img = "MNI", color_mode = "auto", zlim = NULL, colors = NULL, structural_img_colors = gray(0:255/280), title = NULL, idx = NULL, plane = c("axial", "sagittal", "coronal"), convention = c("neurological", "radiological"), n_slices = 9, slices = NULL, together = NULL, together_ncol = NULL, together_title = NULL, widget = FALSE, fname = FALSE, fname_suffix = c("names", "idx"), fname_sub = FALSE, legend_fname = "[fname]_legend", legend_ncol = NULL, legend_alllevels = FALSE, legend_embed = NULL, digits = NULL, scientific = NA, cex.title = NULL, ypos.title = 0, xpos.title = 0, orientation_labels = TRUE, crop = TRUE, text_color = "white", bg = NULL, width = NULL, height = NULL, ... )
xifti |
A |
structural_img |
The structural MRI image on which to overlay the
subcortical plot. Can be a file name, |
color_mode |
(Optional) |
zlim |
(Optional) Controls the mapping of values to each
color in |
colors |
(Optional) |
structural_img_colors |
Colors to use for the background image. These
will be assigned in order from lowest to highest value with equal spacing
between the colors. ( |
title |
Optional title(s) for the plot(s). It will be printed at the top. Default: To use a custom title(s), use a length 1 character vector (same title for
each plot) or length If the title is non-empty but does not appear, try lowering |
idx |
The time/column index of the data to display. If If |
plane |
The plane to display for the slices:
|
convention |
|
n_slices |
The number of slices to display. Default: |
slices |
Which slices to display. If provided, this argument will
override |
together |
Only applies if saving image files (
|
together_ncol |
If |
together_title |
If a composite image is made based on |
widget |
Create an interactive widget using Note that the widget can only display one Note: |
fname , fname_suffix
|
Save the plot(s) (and color legend if applicable)? If If If neither of the cases above apply, a png image will be written for each
|
fname_sub |
Add "_sub" to the end of the names of the files being saved?
Default: |
legend_fname |
Save the color legend? Since the legend is the same
for each |
legend_ncol |
Number of columns in color legend. If
|
legend_alllevels |
Show all label levels in the color legend? If
|
legend_embed |
Should the colorbar be embedded in the plot?
It will be positioned at the bottom. Default: Only applies if the color bar is used (sequential or diverging data). The color legend (qualitative data) cannot be embedded at the moment. |
digits |
The number of digits for the colorbar legend ticks.
If |
scientific |
Use scientific notation? If |
cex.title |
Font size multiplier for the title. |
ypos.title , xpos.title
|
The positioning of the title can be finicky,
especially when using an R Markdown document interactively in which case it
appears too high in the plot. Use these arguments to nudge the title up
or down ( |
orientation_labels |
Show orientation labels at the top left and top
right of the plot? These will indicate the directions along the left-right
axis for each slice image. Default: |
crop |
Crop the slice subplots to the subcortical structures, instead of
showing the full anatomical image? Default: |
text_color |
Color for text in title and colorbar legend. Default:
|
bg |
Background color. |
width , height
|
The dimensions of the plot, in pixels. Only affects saved
images (if Currently, there is no way to control the dimensions of the plot if working interactively in RStudio or creating a knitted R Markdown document. The default appears to be a wide aspect ratio. |
... |
Additional arguments to pass to |
Note that color_mode
, zlim
, and colors
only affect the
color scale of the data values whereas structural_img_colors
only
affects the color scale of the background image.
Currently, the color-related arguments only affect the 2D slice view. The color limits and palette must be edited using the widget controls once it's rendered.
Arguments concerning anatomical orientation assume that the subcortical data is stored in the following way: first dimension is normal to the sagittal plane, going left to right; second dimension is normal to the coronal plane, going from the front of the head (anterior) to the back (posterior); third dimension is normal to the axial plane, going from the top of the head (superior) to the neck (inferior).
For non-interactive plots, if n_slices > 1
and convention="neurological"
,
axial slices are ordered from the neck (inferior) to the top of the head
(superior), sagittal slices are ordered left to right, and coronal slices
are ordered back (posterior) to front (anterior). If
convention="radiological"
, sagittal slices are instead ordered right
to left.
If a png or pdf file(s) were written, the names of the files for
each index (and color legend if applicable) will be returned. Otherwise,
NULL
is invisibly returned.
Other visualizing:
view_comp()
,
view_surf()
,
view_xifti()
,
view_xifti_surface()
"xifti"
objectWrite out a "xifti"
object as a CIFTI file and (optionally) GIFTI
surface files.
write_cifti( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE ) writeCIfTI( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE ) writecii( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE ) write_xifti( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE )
write_cifti( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE ) writeCIfTI( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE ) writecii( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE ) write_xifti( xifti, cifti_fname, surfL_fname = NULL, surfR_fname = NULL, verbose = TRUE )
xifti |
A |
cifti_fname |
File path to a CIFTI file (ending in ".d*.nii"). |
surfL_fname , surfR_fname
|
If the [left/right] surface is present, it
will be a written to a GIFTI file at this file path. If |
verbose |
Should occasional updates be printed? Default: |
See write_xifti2
to write a "xifti"
object out as
separate GIFTI and/or NIFTI files instead.
Named character vector of the written files
This function interfaces with the "-cifti-create-dense-timeseries"
,
"-cifti-create-dense-scalar"
, or "-cifti-create-label"
Workbench
Command, depending on the input.
Other common:
is.cifti()
,
read_cifti()
,
resample_cifti()
,
smooth_cifti()
,
view_xifti()
Other writing:
separate_cifti()
,
write_metric_gifti()
,
write_subcort_nifti()
,
write_surf_gifti()
,
write_xifti2()
Write the data for the left or right cortex to a metric GIFTI file.
write_metric_gifti( x, gifti_fname, hemisphere = c("left", "right"), intent = NULL, data_type = NULL, encoding = NULL, endian = c("LittleEndian", "BigEndian"), col_names = NULL, label_table = NULL )
write_metric_gifti( x, gifti_fname, hemisphere = c("left", "right"), intent = NULL, data_type = NULL, encoding = NULL, endian = c("LittleEndian", "BigEndian"), col_names = NULL, label_table = NULL )
x |
A |
gifti_fname |
Where to write the GIFTI file. |
hemisphere |
|
intent |
"NIFTI_INTENT_*". |
data_type |
the type of |
encoding |
One of "ASCII", "Base64Binary", or "GZipBase64Binary". If
|
endian |
"LittleEndian" (default) or "BigEndian". If |
col_names |
The names of each data column in |
label_table |
A data.frame with labels along rows. The row names should be the label names. The column names should be among: "Key", "Red", "Green", "Blue", and "Alpha". The "Key" column is required whereas the others are optional (but very often included). Values in the "Key" column should be non-negative integers, typically beginning with 0. The other columns should be floating-point numbers between 0 and 1. Although CIFTI files support a different label table for each data column, GIFTI files only support a single label table. So this label table should be applicable to each data column. |
Whether the GIFTI was successfully written
Other writing:
separate_cifti()
,
write_cifti()
,
write_subcort_nifti()
,
write_surf_gifti()
,
write_xifti2()
Write subcortical data to NIFTI files representing the data values,
subcortical structure labels, and volumetric mask. The input formats of
subcortVol
, subcortLabs
, and subcortMask
correspond to the data structures of xifti$data$subcort
,
xifti$meta$subcort$labels
, and xifti$meta$subcort$mask
respectively. subcortVol
and subcortLabs
should be vectorized,
so if they are volumes consider using RNifti::writeNIfTI
.
write_subcort_nifti( subcortVol, subcortLabs, subcortMask, trans_mat = NULL, trans_units = NULL, col_names = NULL, label_table = NULL, subcortVol_fname, subcortLabs_fname, ROIsubcortVol_fname = NULL, fill = 0 )
write_subcort_nifti( subcortVol, subcortLabs, subcortMask, trans_mat = NULL, trans_units = NULL, col_names = NULL, label_table = NULL, subcortVol_fname, subcortLabs_fname, ROIsubcortVol_fname = NULL, fill = 0 )
subcortVol |
A vectorized data matrix: V voxels by T measurements |
subcortLabs |
Numeric (0 and 3-22) or factor vector corresponding to
subcortical structure labels. See |
subcortMask |
Logical volumetric mask. Values of 0 represent out-of-mask voxels (not subcortical), and values of 1 represent in-mask voxels (subcortical), |
trans_mat |
The TransformationMatrixIJKtoXYZ, or equivalently the desired
sform matrix (srow_x, srow_y and srow_z) to write. If |
trans_units |
The units of |
col_names |
(Optional) Column names. |
label_table |
(Optional) |
subcortVol_fname , subcortLabs_fname , ROIsubcortVol_fname
|
File path to
a NIFTI to save the corresponding data. |
fill |
Values to use for out-of-mask voxels. Default: |
All file path arguments are required except ROIsubcortVol_fname
. If
not provided, the volumetric mask will not be written. (It's redundant with
the 0 values in subcortLabs_fname
because valid labels have positive
indexes.)
Note that for label data (i.e. if label_table
is provided) only one
label table can be saved.
Named character vector with the "subcortVol"
,
"subcortLabs"
, and "ROIsubcortVol"
file names (if written)
This function interfaces with the "-volume-label-import"
Workbench
Command.
Other writing:
separate_cifti()
,
write_cifti()
,
write_metric_gifti()
,
write_surf_gifti()
,
write_xifti2()
"surf"
to a GIFTI surface fileWrite the data for the left or right surface to a surface GIFTI file.
write_surf_gifti( x, gifti_fname, hemisphere = c("left", "right"), encoding = NULL, endian = c("LittleEndian", "BigEndian") ) write_surf( x, gifti_fname, hemisphere = c("left", "right"), encoding = NULL, endian = c("LittleEndian", "BigEndian") )
write_surf_gifti( x, gifti_fname, hemisphere = c("left", "right"), encoding = NULL, endian = c("LittleEndian", "BigEndian") ) write_surf( x, gifti_fname, hemisphere = c("left", "right"), encoding = NULL, endian = c("LittleEndian", "BigEndian") )
x |
A |
gifti_fname |
Where to write the GIFTI file. |
hemisphere |
"left" (default) or "right". Ignored if |
encoding |
A length-2 vector with elements chosen among "ASCII",
"Base64Binary", and "GZipBase64Binary". If |
endian |
"LittleEndian" (default) or "BigEndian". |
Whether the GIFTI was successfully written
Other writing:
separate_cifti()
,
write_cifti()
,
write_metric_gifti()
,
write_subcort_nifti()
,
write_xifti2()
Other surface-related:
add_surf()
,
boundary_mask_surf()
,
edit_mask_surf()
,
even_vert_samp()
,
is.surf()
,
load_surf()
,
mask_surf()
,
read_surf()
,
resample_surf()
,
rotate_surf()
,
surf_area()
,
view_surf()
"xifti"
object to GIFTI and NIFTI filesWrite metric or label GIFTIs for the cortical surface data and NIFTIs for the
subcortical labels and mask in a "xifti"
object. Each present
brainstructure will be written; if a brainstructure is absent the
corresponding file is not written.
write_xifti2( xifti, brainstructures = NULL, cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL, verbose = FALSE )
write_xifti2( xifti, brainstructures = NULL, cortexL_fname = NULL, cortexR_fname = NULL, subcortVol_fname = NULL, subcortLabs_fname = NULL, ROI_brainstructures = "all", ROIcortexL_fname = NULL, ROIcortexR_fname = NULL, ROIsubcortVol_fname = NULL, write_dir = NULL, verbose = FALSE )
xifti |
A |
brainstructures |
(Optional) character vector indicating a subset of
brain structure(s) to write: |
cortexL_fname , cortexR_fname
|
(Optional) GIFTI file names (*.[func/label].gii) to save the [left/right] cortex data to. dtseries and dscalar files should use "func", whereas dlabel files should use "label". If |
subcortVol_fname , subcortLabs_fname
|
(Optional) NIFTI file names to save the subcortical [volume/labels] to. Provide both or neither. If |
ROI_brainstructures |
Which ROIs should be obtained? |
ROIcortexL_fname , ROIcortexR_fname
|
(Optional) GIFTI file names (*.[func/label].gii) to save the [left/right] cortex ROI to. dtseries and dscalar files should use "func", whereas dlabel files should use "label". If The cortical ROIs typically represent the medial wall
mask, with values of 1 for in-ROI (non-medial wall) vertices and 0 for
out-of-ROI (medial wall) vertices. Will be written in |
ROIsubcortVol_fname |
(Optional) NIFTI file names to save the subcortical ROI to. If The subcortical ROI typically represents the volumetric
mask for the entire subcortical structure, with values of 1 for in-ROI
(in subcortex) voxels and 0 for out-of-ROI (not in subcortex) voxels. Will
be written in |
write_dir |
(Optional) A path to an existing directory. If provided,
every component in the |
verbose |
Should occasional updates be printed? Default: |
List of written files
Other writing:
separate_cifti()
,
write_cifti()
,
write_metric_gifti()
,
write_subcort_nifti()
,
write_surf_gifti()