create_mask#

create_mask(mask_type, soft_edge_width=0, sigma_decay=None, method='gaussian', **kwargs)[source]#

Creates a mask of the specified type.

Parameters:
mask_typestr

Type of the mask to be created. Can be one of:

box

Box mask (see box_mask())

tube

Cylindrical mask (see tube_mask())

membrane

Membrane mask (see membrane_mask())

ellipse

Ellipsoidal mask (see elliptical_mask())

threshold

Density-based mask (see threshold_mask())

soft_edge_widthfloat, optional

Soft-edge width in voxels, 0 by default (hard edge).

sigma_decayfloat, optional

Deprecated alias for soft_edge_width. If both are given, soft_edge_width takes precedence.

methodstr, optional

Soft-edge method: "gaussian" (default) or "cosine".

kwargsdict

Parameters passed to the individual mask creation functions.

Returns:
NDArray

The created mask.

Raises:
ValueError

If the mask_type is invalid.