sct_merge_images¶
Merge multiple source images (-i
) onto destination space (-d
). (All images are warped to the destination space and then added together.)
To deal with overlap during merging (e.g. multiple input images map to the same voxel regions in the destination space), the output voxels are divided by the sum of the partial volume values for each image.
Specifically, the per-voxel calculation used is:
im_out = (im_1*pv_1 + im_2*pv_2 + ...) / (pv_1 + pv_2 + ...)
So this function acts like a weighted average operator, only in destination voxels that share multiple source voxels.
usage: sct_merge_images -i <file> [<file> ...] -d <file> -w <file> [<file> ...]
[-x <str>] [-o <file>] [-h] [-v <int>]
[-profile-time [<file>]] [-trace-memory [<folder>]]
[-r {0,1}]
MANDATORY ARGUMENTS¶
- -i
Input images
- -d
Destination image
- -w
List of warping fields from input images to destination image
OPTIONAL ARGUMENTS¶
- -x
Interpolation for warping the input images to the destination image.
Default: “linear”
- -o
Output image
Default: “merged_images.nii.gz”
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