wbcmd wraps the Connectome
Workbench wb_command CLI for use in R. Every function
calls the same central dispatcher, so your environment only needs to be
configured once.
Prerequisites
Install Connectome Workbench from the HCP website. Then load the package and verify your setup:
If the binary is not detected automatically, point wbcmd to it:
set_wb_path("/opt/workbench/bin_linux64/wb_command")You can also set the path via environment variable or R option. The lookup order is:
- R option
wbcmd.path - Environment variable
WB_PATH - Platform-specific defaults
- System
PATH
Running commands
The wb_cmd() function is the universal entry point. Pass
the subcommand name and arguments exactly as you would on the command
line:
Convenience wrappers
Typed wrappers handle argument construction and file validation for you.
Separate a CIFTI file
wb_cifti_separate(
"data.dscalar.nii",
direction = "COLUMN",
metric = list(
CORTEX_LEFT = "left.func.gii",
CORTEX_RIGHT = "right.func.gii"
)
)Smooth CIFTI data
wb_cifti_smoothing(
"data.dtseries.nii",
surface_sigma = 4,
volume_sigma = 4,
direction = "COLUMN",
cifti_out = "smoothed.dtseries.nii",
left_surface = "left.midthickness.surf.gii",
right_surface = "right.midthickness.surf.gii"
)Controlling verbosity
By default wbcmd prints each command before running it. Silence this with:
options(wbcmd.verbose = FALSE)Or set the WB_VERBOSE environment variable to
FALSE.