Command line#
patch-denoise minimally requires a path to a NIfTI file,
but it can take advantage of reconstructed phase data and/or noise volumes.
main#
main [OPTIONS] INPUT-FILE [ARGS]
Patch denoising CLI tool.
Parameters:
INPUT-FILE, --input-file, -iRequired
OUTPUT-FILE, --output-file, -oOutput denoised NIfTI file (4D). Default is D<input_file>.
--method, -mDenoising method. [Choices:
mp-pca,hybrid-pca,raw,optimal-fro,optimal-fro-noise,optimal-nuc,optimal-ope,nordic,adaptive-qut, Default:optimal-fro]--patch-shape, -psPatch shape. Dimension separated by “,”. Use -1 to use the entire dimension. Example: 11,11,11,-1. [Default:
(11, 11, 11, -1)]--patch-overlap, -poPatch overlap. Dimension separated by “,”. Use -1 to use the entire dimension. Example: 11,11,11,-1. [Default:
(5, 5, 5, -1)]--recombination, -rRecombination method. [Choices:
weighted,mean,average,center, Default:weighted]--mask, -kMask NIfTI file (3D). if None, mask is computed automatically.
--mask-threshold, -tMin % of overlap between a patch and the mask to trigger computation. [Default:
50]--extras, -eExtra parameters for the denoiser as -e.key=value
--nan-to-num, -nReplace any NaN in input-data with VALUE
--verbose, -vRepeat for increase verbosity (-vvv) [Default:
0]--gpu, --cpuUse GPU or CPU for computation. Requires patch_denoise.gpu module. GPU is enabled by default if available [Default:
False]--gpu-batch-sizeNumber of patches processed per GPU batch. If 0, measure the fastest size for this GPU/method/patch-shape once and cache it (~/.cache/patch_denoise/gpu_batch_size.json) for future runs. Ignored on CPU. [Default:
0]--outmap.weightsSave the patch weights. [Default:
False]--outmap.noise-stdSave the noise standard deviation estimate. [Default:
False]--outmap.rankSave the rank estimate. [Default:
False]--outmap.countSave the patch count. [Default:
False]--input-phase, -ipInput phase NIfTI file (4D). If provided, process complex data.
--noise-std-map, -NInput Noise std map
--noise-std-map-phaseInput Noise std map, phase component.
Using patch-denoise on BIDS data#
Warning
These examples assume that the phase data are in radians. If they are in arbitrary units, you will need to rescale them before running patch-denoise.
Magnitude only#
patch-denoise \
sub-01/func/sub-01_task-rest_part-mag_bold.nii.gz \
sub-01_task-rest_part-mag_desc-denoised_bold.nii.gz \
--method optimal-fro \
--patch-shape 11 \
--patch-overlap 5 \
--recombination weighted \
--mask-threshold 1
Magnitude with noise volumes#
patch-denoise \
sub-01/func/sub-01_task-rest_part-mag_bold.nii.gz \
sub-01_task-rest_part-mag_desc-denoised_bold.nii.gz \
--noise-std-map sub-01/func/sub-01_task-rest_part-mag_noRF.nii.gz \
--method optimal-fro \
--patch-shape 11 \
--patch-overlap 5 \
--recombination weighted \
--mask-threshold 1
Magnitude and phase#
patch-denoise \
sub-01/func/sub-01_task-rest_part-mag_bold.nii.gz \
sub-01_task-rest_part-mag_desc-denoised_bold.nii.gz \
--input-phase sub-01/func/sub-01_task-rest_part-phase_bold.nii.gz \
--method optimal-fro \
--patch-shape 11 \
--patch-overlap 5 \
--recombination weighted \
--mask-threshold 1
Magnitude and phase with noise volumes#
patch-denoise \
sub-01/func/sub-01_task-rest_part-mag_bold.nii.gz \
sub-01_task-rest_part-mag_desc-denoised_bold.nii.gz \
--input-phase sub-01/func/sub-01_task-rest_part-phase_bold.nii.gz \
--noise-std-map sub-01/func/sub-01_task-rest_part-mag_noRF.nii.gz \
--noise-std-map-phase sub-01/func/sub-01_task-rest_part-phase_noRF.nii.gz \
--method optimal-fro \
--patch-shape 11 \
--patch-overlap 5 \
--recombination weighted \
--mask-threshold 1