## Watershed

An important part of interpretation of an image is to identify and isolate regions of interest, a process called segmentation. The notion of regions-of-interest (ROI) makes it a subjective process, with decisive user interaction determining the outcome. The granularity of segmentation ranges from a voxel by voxel assignment to regions (highly subjective), to choosing one or a few parameters (mildly subjective), such as a threshold. Highly subjective segmentation is rarely justifiable, while a parameter such as a threshold can be justified from estimated volume-inclusion or the presence of certain indicator densities in a map. The emphasis here is therefore on finding ways to segment with having to choose the least number of parameters.

Note: Most segmentation procedures assume that density is positive (i.e., density is white).

### Watershed

The watershed algorithm starts at a threshold where regions are defined by clusters of neighboring voxels. It then proceeds through a series of steps of decreasing threshold, assigning each non-assigned voxel to a region if it is adjacent to another voxel from that region. In cases where a voxel is adjacent to two regions, it is assigned to the region with the highest density value in a neighboring voxel. The assignments stop when the lower threshold is reached. The result is a multi-level mask, where each region is encoded as a unique integer in the image.

The first decision to make is which starting threshold to use. All densities that are disconnected at this threshold will be taken as separate regions. The best way to pick the threshold is to open the map in bshow and use the min and max sliders to find a threshold where the desired regions are disconnected. The second threshold should be above any noise and depends on how far you want to extent the regions.

The output is a multi-level mask where each region has an integer number. One or more of these regions can be picked using the model tool in bshow, and the selected regions can be extracted as a mask. The mask can then be used to isolate specific parts of the original map.

The following map was segmented to separate the main shell and associated proteins:

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

### Peak-associated regions:

An alternative to the watershed algorithm generates regions based on peaks above a threshold. A peak is defined where a voxel is the maximum in a kernel. The kernel is typically 3x3x3. The algorithm actually assigns a pointer to each voxel above the threshold, pointing to the highest density value in the kernel. A peak will therefore automatically point to itself. Each voxel is assigned to a peak by following the pointers until they reach a peak.

bflood -v 7 -peaks 0.05 phi6.map phi6_peakmask.tiff