sct_compute_snr¶
Compute SNR using methods described in [Dietrich et al., Measurement of signal-to-noise ratios in MR images: Influence of multichannel coils, parallel imaging, and reconstruction filters. J Magn Reson Imaging 2007; 26(2): 375-385].
usage: sct_compute_snr -i <file> [-m <file>] [-method {diff,mult,single}]
[-m-noise <file>] [-vol <str>] [-rayleigh {0,1}]
[-o <str>] [-h] [-v <int>] [-profile-time [<file>]]
[-trace-memory [<folder>]] [-r {0,1}]
MANDATORY ARGUMENTS¶
- -i
Image to compute the SNR on. Example:
b0s.nii.gz
For
-method diff
and-method mult
, the image must be 4D, as SNR will be computed along the 4th dimension.For
-method single
, the image can either be 3D or 4D. If a 4D image is passed, a specific 3D volume should be specified using the-vol
argument.
OPTIONAL ARGUMENTS¶
- -m
Binary (or weighted) mask within which SNR will be averaged. Example:
dwi_moco_mean_seg.nii.gz
Default: “”
- -method
Possible choices: diff, mult, single
Method to use to compute the SNR:
diff
: Substract two volumes (defined by -vol) and estimate noise variance within the ROI (flag-m
is required). Requires a 4D volume.mult
: Estimate noise variance over time across volumes specified with-vol
. Requires a 4D volume.single
: Compute the mean signal in the mask specified by-m
and estimate the noise variance in a mask specified by-m-noise
. If the noise mask is in the background (air), the noise variance needs to be corrected for Rayleigh distribution (set-rayleigh 1
). If the noise mask is located in a region with high signal (eg: tissue), noise distribution can be assumed Gaussian and there is no need to correct for Rayleigh distribution (use-rayleigh 0
). This implementation corresponds to the SNRstdv in the Dietrich et al. article. Uses a 3D or a 4D volume. If a 4D volume is input, the volume to compute SNR on is specified by-vol
.
Default: “diff”
- -m-noise
Binary (or weighted) mask within which noise will be calculated. Only valid for
-method single
.Default: “”
- -vol
Volumes to compute SNR from. Separate with
,
(Example:-vol 0,1
), or select range using:
(Example:-vol 2:50
).If this argument is not passed:
For
-method mult
, all volumes will be used.For
-method diff
, the first two volumes will be used.For
-method single
, the first volume will be used.
Default: “”
- -rayleigh
Possible choices: 0, 1
Correct for Rayleigh distribution. It is recommended to always use this correction for the ‘diff’ method and to use it with the ‘single’ method in case the noise mask is taken in a region with low SNR (e.g., the air).
Default: 1
- -o
File name to write the computed SNR to.
MISC ARGUMENTS¶
- -v
Possible choices: 0, 1, 2
Verbosity. 0: Display only errors/warnings, 1: Errors/warnings + info messages, 2: Debug mode.
Default: 1
- -profile-time
Enables time-based profiling of the program, dumping the results to the specified file.
If no file is specified, human-readable results are placed into a ‘time_profiling_results.txt’ document in the current directory (’/home/docs/checkouts/readthedocs.org/user_builds/spinalcordtoolbox/checkouts/stable/documentation/source’). If the specified file is a
.prof
file, the file will instead be in binary format, ready for use with common post-profiler utilities (such assnakeviz
).- -trace-memory
Enables memory tracing of the program.
When active, a measure of the peak memory (in KiB) will be output to the file
peak_memory.txt
. Optionally, developers can also modify the SCT code to add additionalsnapshot_memory()
calls. These calls will ‘snapshot’ the memory usage at that moment, saving the memory trace at that point into a second file (memory_snapshots.txt
).By default, both outputs will be placed in the current directory (’/home/docs/checkouts/readthedocs.org/user_builds/spinalcordtoolbox/checkouts/stable/documentation/source’). Optionally, you may provide an alternative directory (
-trace-memory <dir_name>
), in which case all files will be placed in that directory instead. Note that this WILL incur an overhead to runtime, so it is generally advised that you do not run this in conjunction with the time profiler or in time-sensitive contexts.- -r
Possible choices: 0, 1
Remove temporary files.
Default: 1