## Thresholding

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).

The simplest segmentation on a gray-scale density map is thresholding. When generating an isosurface representation of a map, the implicit segmentation is between foreground (density), and background (everything else). The choice of threshold is important, because the isosurface reflects the amount and location of density, but only if it exceeds the threshold. The aim of the user further determines how the threshold level will be justified.

### Case 1: Included volume

The user wants to visualize the map such that the volume within the isosurface corresponds to the volume of all the constituents of the particle. The appropriate threshold can then be calculated from the estimated molecular weight:

bsegment -v 7 -mass 23.5m map.pif

The inverse can also be calculated (e.g., to calculate how much difference a change in threshold will make to the included volume):

bsegment -v 7 -threshold 1.45 map.pif

Similar information can be extracted from the histogram of the map:

bhisto -v 7 -bins 200 map.pif

### Case 2: Differentiating parts of the structure

More often than not, parts of a map has lower occupancy than others due to conformational flexibility or compositional variability. A threshold can be chosen visually to include or exclude these lower-occupancy regions.

In proteins, the alpha helices have the highest density. In maps of sufficient resolution, the helices can be identified and visualized by choosing a high threshold.

### Generating a binary mask

A threshold can be used to simply generate a mask that distinguished foreground from background:

bmask -v 7 -threshold 1.3 map.pif mask.tif

## Multi-region segmentation

In a gray scale map, the density variations provide the only information for defining the location and extent of regions. The regions are typically associated with local peaks, and their extend limited to a threshold defining the distinction between foreground and background.