yss0099 我帮你做了一下检索,我看到了ITK-SNAP的文档 (http://www.itksnap.org/pmwiki/pmwiki.php?n=Convert3D.Doc2 ) 中提及了一个工具 Convert3D
:
Multilabel Images
Multilabel (ML) images are images where each voxel is assigned a label, chosen from a relatively small set of labels. Labels are typically integers, although they can be floating point numbers. For example, labels can be used to identify anatomical structures in an image: label 1 may correspond to the white matter, 2 to the gray matter, 3 to CSF, and 0 to the background.
When processing ML images, one must take certain care to make sure that numerical operations do not blend labels into meaningless values. For instance, smoothing a ML image will create intermediate values at places where two labels are near each other. A similar issue comes up when resampling or reslicing these images. However, convert3d
provides commands that split the ML image into a set of binary images (one for each label), allowing you to perform operations on each label separately. Subsequently, the processed label-wise images can be combined into a new ML image. This is accomplished using commands -split
and -merge.
In addition, the -foreach
… -endfor
command structure allows operations to be applied sequentially to all images on the stack.
这是这个工具的文档(https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md#-oo-output-multiple-images-to-multiple-files )中提及的:
-oo: Output multiple images to multiple files
Syntax: -oo image_list
or -oo image_spec
Write all images on the convert3d stack as multiple files. There are two ways to use this command. The first is to supply a list of file names, separated by spaces:
c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii
In the above example, the image at the end of the stack will be saved as labelC.nii, the image next to the end of the stack will be saved as labelB.nii and so on.
The second way to use the -oo command is to supply a pattern for the output filenames. In this case, all the images on the stack will be written. The format for the pattern is the same as for the C++ printf command. For example, the following command
c3d labelimage.nii -split -oo label%02d.nii
will generate images label00.nii, label01.nii, label02.nii and so on. The image at the end of the stack will have the highest number, and the image at the beginning of the stack will have number 00.
-oomc: Output multiple multi-component images to multiple files
Syntax: -oomc n_comp image_list
or -oomc n_comp image_spec
Write all images on the convert3d stack as multiple multi-component image files. The command is a mixture of the -omc and -oo commands. There must be a multiple of ‘n_comp’ images on the stack. Every consecutive