| convert_to_dlabel {ciftiTools} | R Documentation | 
Convert the intent of a CIFTI file or "xifti" object
Description
Convert the intent of a CIFTI file or "xifti" object
Usage
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,
  ...
)
Arguments
| 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  | 
Value
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.
Functions
-  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 withnames.
-  convert_to_dtseries(): Give the ".dtseries" intent (code 3002/ConnDenseSeries) to an input"xifti"object. Can also be used to set the time metadata.
See Also
Other manipulating xifti: 
add_surf(),
apply_parc(),
apply_xifti(),
combine_xifti(),
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()
Examples
## 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)