resample_cifti: Resample CIFTI data

View source: R/resample_cifti.R

resample_ciftiR Documentation

Resample CIFTI data

Description

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.)

Usage

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
)

Arguments

x

The CIFTI file name or "xifti" object to resample. If NULL, the result will be a "xifti" with resampled surfaces given by surfL_original_fname and surfR_original_fname.

cifti_target_fname

File name for the resampled CIFTI. Will be placed in write_dir. If NULL, will be written to "resampled.d*.nii". write_dir will be appended to the beginning of the path.

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 x is a "xifti" object with surfaces, these arguments will override the surfaces in the "xifti".

surfL_target_fname, surfR_target_fname

(Optional) File names for the resampled GIFTI surface geometry files. Will be placed in write_dir. If NULL (default), will use default names created by resample_cifti_default_fname.

resamp_res

Target resolution for resampling (number of cortical surface vertices per hemisphere).

resamp_method

"barycentric" (default) or "adaptive" resampling for the metric or label data. These options correspond to the Workbench command options "BARYCENTRIC" and "ADAP_BARY_AREA", respectively.

While adaptive resampling is recommended for metric or label data, it requires that area[L/R]_original_fname be provided.

Note that surfaces will resampled using barycentric resampling regardless of resamp_method, because barycentric resampling rather than adaptive resampling is recommended for surface data.

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.) area[L/R]_original_fname should match the current resolution of the data.

For resampling: the Workbench command for adaptive resampling requires the target surfaces for area correction too. But to make the workflow easier, ciftiTools will resample area[L/R]_original_fname with the barycentric method and use that for the target area.

For remapping: area[L/R]_target_fname must be directly provided.

write_dir

Where to write the resampled CIFTI (and surfaces if present.) If NULL (default), will use the current working directory if x was a CIFTI file, and a temporary directory if x was a "xifti" object.

mwall_values

If the medial wall locations are not indicated in the CIFTI, use these values to infer the medial wall mask. Default: c(NA, NaN). If NULL, do not attempt to infer the medial wall.

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: TRUE.

Details

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.

Value

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).

Connectome Workbench

This function interfaces with the "-metric-resample", "-label-resample", and/or "-surface-resample" Workbench commands, depending on the input.

See Also

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()


ciftiTools documentation built on Oct. 4, 2024, 1:12 a.m.