Masks and segmentation
A mask defines the segmentation of an image into two or more regions, encoding the interpretation of the content of that image. Combinations and multi-level masks can be used to define all regions of interest in an image.
Types of masks
|Mask type||# regions||Edges||Overlaps||Data type|
Bit or binary mask data consist of only two numbers, usually 0 and 1.
bmask -v 7 -threshold 1.3 phi6.map phi6_mask.map
A fuzzy mask is the same as a bit or binary mask, but with the edges smoothed in some way. The following example uses an averaging filter kernel to smooth the edges.
bfilter -verb 7 -dat f -kernel Avg5.krn phi6_mask.map phi6_mask_a5.map
A bit-level mask encodes each region as a bit in an integer number. Regions can therefore overlap and any voxel may belong to multiple regions, with equal weight for each region.
A multi-level mask encodes each region as a unique integer. Voxels are therefore assigned to regions and overlapping is not allowed. The following mask was generated using the watershed algorithm (also called flooding), and then colorized to show the different regions.
bflood -v 7 -thresh 1,0.05 -fill phi6.map phi6_mask.tiff
bcolour -v 7 -color 1,241 phi6_mask.tiff phi6_mask_col.tiff
Multi-level masks can be added to each other:
baddmask -v 7 -type level -output new_mask.pif mask1.tif mask2.pif
Segmentation with an algorithm such as flooding typically produces many small regions. These can be added to larger regions or deleted if they are disconnected. The user has to decided what is considered a small region, and how large the interface between regions should be to consider merging:
bmultimask -v 7 -interface 70,10 multi_mask.tif new_mask.tif