Skip to content

image_applymask

applymask

Apply a binary mask to a 3D or 4D image.

Keywords : Image, Mask, BET


Format : tuple val(meta), path(image), path(mask)

TypeDescriptionMandatoryPattern
metamapGroovy Map containing sample information e.g. [ id:'sample1', single_end:false ]
True
imagefile3D or 4D image to apply the mask to.True*.nii.gz
maskfileBinary mask to apply to the image.True*.nii.gz

Format : tuple val(meta), path(*masked.nii.gz)

TypeDescriptionMandatoryPattern
metamapGroovy Map containing sample information e.g. [ id:'sample1', single_end:false ]
True
*masked.nii.gzfileMasked 3D or 4D image.True*masked.nii.gz

Format : path(versions.yml)

TypeDescriptionMandatoryPattern
versions.ymlfileFile containing software versionsTrueversions.yml

TypeDescriptionDefaultChoices
first_suffixstringSuffix for the output image file. This will be used as the first part of the suffix, followed by “_masked”.“
single_threadbooleanIf true, the command will be run in single-threaded mode. By default, the command will use multiple threads based on the number of CPUs allocated to the task.False
data_typestringData type for the output image. Use the following format: uint8, int16, int32, int64, float16, float32 or float64. Original type is preserved if data_type is not supplied.
“

DescriptionDOI
MRtrix3MRtrix3 is a software package for various types of diffusion imaging data, including diffusion-weighted, diffusion-tensor, and q-ball imaging.
10.1016/j.neuroimage.2019.116137


Last updated : 2026-09-24