transform_xifti {ciftiTools}R Documentation

Apply a univariate transformation to a "xifti" or pair of "xifti"s.

Description

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.

Usage

transform_xifti(xifti, FUN, xifti2 = NULL, idx = NULL, ...)

Arguments

xifti

A "xifti" object.

FUN

The function. If xifti2 is not provided, it should be a univariate function like log or sqrt. If xifti2 is provided, it should take in two arguments, like `+` or pmax.

xifti2

The second xifti, if applicable. Otherwise, NULL (default)

idx

The column indices for which to apply the transformation. If NULL (default), apply to all columns. If two "xifti" objects, were provided, the values in the first (xifti) will be retained for columns that are not transformed.

...

Additional arguments to FUN

Details

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.

Value

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

See Also

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


[Package ciftiTools version 0.14.0 Index]