resample_gifti: Resample a GIFTI file (with its ROI)

View source: R/resample_gifti.R

resample_giftiR Documentation

Resample a GIFTI file (with its ROI)

Description

Perform spatial resampling of GIFTI data on the cortical surface (metric and label), or of GIFTI surface geometry data itself.

Usage

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
)

Arguments

original_fname

The GIFTI file to resample.

target_fname

Where to save the resampled file.

hemisphere

"left" (default) or "right". An error will occur if the hemisphere indicated in the GIFTI metadata does not match.

file_type

"metric", "label", "surf", or NULL (default) to infer from original_fname.

original_res

The resolution of the original file. If NULL (default), infer from the file. Alternatively, provide sphere_original_fname which will override original_res.

In general, original_res should be used when the original file is in registration with the spheres created by the Workbench command -surface-create-sphere, and sphere_original_fname should be used when it is not compatible.

resamp_res

Target resolution for resampling (number of cortical surface vertices per hemisphere). Alternatively, provide sphere_target_fname which will override resamp_res.

In general, resamp_res should be used when the target file will be in registration with the spheres created by the Workbench command -surface-create-sphere, and sphere_target_fname should be used when it is not compatible.

resamp_method

"barycentric" (default) or "adaptive" resampling. 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_original_fname be provided.

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.) area_original_fname should match the current resolution of the data, and area_target_fname should match resamp_res. If area_target_fname is not provided, area_original_fname will be resampled with the barycentric method, and the result will be used as area_target_fname.

ROIcortex_original_fname

The name of the ROI file corresponding to original_fname. Leave as NULL (default) if this doesn't exist or shouldn't be resampled.

ROIcortex_target_fname

The name of the resampled ROI file. Only applicable if ROIcortex_original_fname is provided.

sphere_original_fname, sphere_target_fname

File paths to the sphere surfaces in the original and target resolutions. If possible, the simpler arguments original_res and resamp_res can be used instead. But those depend on the surface being compatible with that created by -surface-create-sphere, which isn't always true. Therefore sphere_original_fname and sphere_target_fname can be used if needed.

read_dir

Directory to append to the path of every file name in original_fname and ROIcortex_original_fname. If NULL (default), do not append any directory to the path.

write_dir

Directory to append to the path of every file name in target_fname and ROIcortex_target_fname. If NULL (default), do not append any directory to the path.

Value

The resampled GIFTI file name, invisibly

Connectome Workbench

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

See Also

Other gifting: remap_gifti(), smooth_gifti()


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