session¶
Manage BrkRaw environment defaults for CLI workflows.
brkraw session does not modify your shell directly. Instead it prints shell
commands, so you can apply them using eval ....
This is useful when you run multiple commands repeatedly against the same dataset or with the same conversion defaults.
Tip:
brkraw init --shell-rc ~/.zshrc(or~/.bashrc) can install helper functionsbrkraw-setandbrkraw-unsetfor convenience.
brkraw session also accepts --root, but session defaults are stored only in
environment variables (not in the config root).
Applying Session Defaults in Your Shell¶
brkraw session set and brkraw session unset print shell code (export/unset).
To apply it to your current shell, wrap it with eval:
eval "$(brkraw session set --path /path/to/study --scan-id 3 --reco-id 1)"
This pattern works in both bash and zsh.
Shell Helpers (brkraw-set / brkraw-unset)¶
On Linux (and other systems using bash), you can install small helper
functions into your shell rc file so you don't have to type eval "$( ... )"
each time:
brkraw init --shell-rc ~/.bashrc
Then start a new shell (or reload your rc file):
source ~/.bashrc
Examples:
brkraw-set -p /path/to/study -s 3 -r 1
brkraw convert
Unset everything:
brkraw-unset
Unset only the dataset path:
brkraw-unset -p
session set¶
Emit export ... statements for BrkRaw defaults.
Examples:
Set a default dataset path:
eval "$(brkraw session set --path /path/to/study)"
Set default scan/reco ids:
eval "$(brkraw session set --scan-id 3 --reco-id 1)"
Set a default parameter key for brkraw params:
eval "$(brkraw session set --param-key PVM_RepetitionTime)"
Set default parameter file(s) for brkraw params:
eval "$(brkraw session set --param-file visu_pars)"
Set default convert options (repeatable):
eval "$(brkraw session set --convert-option SIDECAR=true --convert-option SPACE=subject_ras)"
Convert option keys map to BRKRAW_CONVERT_<OPTION> environment variables.
Supported keys include:
- OUTPUT, PREFIX, SCAN_ID, RECO_ID, SIDECAR, CONTEXT_MAP
- COMPRESS, SPACE, FLATTEN_FG
- OVERRIDE_SUBJECT_TYPE, OVERRIDE_SUBJECT_POSE
- XYZ_UNITS, T_UNITS
- HEADER
- FORMAT
Notes:
--convert-optionexpectsKEY=VALUE.- Keys are normalized to uppercase and
-becomes_. - When setting
--path, the path is validated and BrkRaw checks it can load as a dataset.
session unset¶
Emit unset ... commands to remove defaults.
Unset everything:
eval "$(brkraw session unset)"
Unset selected categories:
eval "$(brkraw session unset --path --scan-id --reco-id)"
Unset specific convert variables:
eval "$(brkraw session unset --convert-option OUTPUT --convert-option SPACE)"
Unset all convert variables:
eval "$(brkraw session unset --convert-option)"
Notes:
unsetflags are toggles (e.g.,--reco-idunsets the default reco id).
session env¶
Show current BrkRaw environment defaults (from environment variables).
brkraw session env
If nothing is set:
(none)
Note on BRKRAW_SCAN_ID¶
BRKRAW_SCAN_ID is stored as a comma-separated string.
Different commands may interpret it differently:
brkraw infotreats it as a list of scan ids.brkraw convertuses only the first scan id when--scan-idis omitted.brkraw paramsexpects a single scan id; set-s/--scan-idexplicitly if needed.
Interface With ParaVision (pvcmd Auto-Detection)¶
When running in a ParaVision environment, BrkRaw can auto-populate session defaults by querying ParaVision's active parameter space.
Typical scenario:
- After completing a scan, you select a protocol/scan in the ParaVision Experiments view and the method panel is visible.
- You open the ParaVision-provided terminal and run
brkraw.
If pvcmd is available and ParxServer is active, brkraw will use pvcmd to
detect the current experiment path and scan context, and set these environment
variables before processing CLI arguments:
BRKRAW_PATHBRKRAW_SCAN_IDBRKRAW_RECO_ID
This lets you run commands without explicitly providing path and --scan-id,
for example:
brkraw info
brkraw convert --reco-id 1
Internally, this uses pvcmd to query the active parameter space and extract a
path like <exp_path>/<scan_id>/pdata/<reco_id> before argparse parses the
command line.