Spitzer Documentation & Tools
MOPEX User's Guide

8.3            Image Segmentation

8.3.1        Overview

The Detect module performs image segmentation, and computes the centroids for the detected pixel clusters. These clusters may be real astronomical sources or they may be spurious. The module is called at the beginning of both the outlier rejection and point source extraction processes.

 

The program starts by computing the initial threshold based the user specified detection threshold (Detection Threshold). Upon the first pass, the program finds all the pixels above the initial threshold. It creates a list of all contiguous clusters of pixels above the initial threshold. Then it compares the number of pixels with the minimum and maximum allowed sizes of a cluster specified by the user (Detection Max Area and Detection Min Area). If the number of pixels in a particular cluster is less than the minimum number, the cluster is discarded. If the number of pixels in a cluster is greater than the maximum number, the program goes through an iterative process of raising the threshold with the intention of either shrinking the cluster and/or splitting it into smaller clusters.

 

To this end, the program recalculates the threshold for this particular cluster and finds all the pixels above the new threshold. See Figure 8.14 for an illustration of this process. When the iterative procedure is finished, a list of estimated detection locations is created. The centroid is found for each cluster, which is the estimated location of the point source corresponding to this cluster.

 

Figure 8.14: Raising the detection threshold splits a big cluster into two smaller clusters.

 

8.3.2        Thresholding

The calculation of the initial value of the threshold depends on the type of image being processed, which is specified by the user by setting input parameter Input Type. It has two settings: Image Input (default) and SNR Input. The first setting corresponds to a regular data image, the second one is used for the signal-to-noise ratio images. For Image Input, the initial threshold T is computed as follows:

Equation 8.5

where D is the detection threshold (number of sigma), M is the mean signal in the image, and s is the standard deviation of the image. The process is repeated iteratively, with M and s recomputed excluding pixels greater than T, until all pixels used are below T. For SNR Input, the intital threshold is simply set equal to the D parameter.

 

Initial image segmentation is performed. The clusters exceeding Detection Max Area size are subject to further segmentation. At this point the threshold is recalculated, so that the new higher threshold will either shrink the "oversized" clusters or break them into several smaller ones. This new threshold is calculated individually for each cluster.

 

Threshold Type: The way the image segmentation threshold is recalculated is determined by the input parameter Threshold Type, which has three settings: Simple, Combo, and Peak. The threshold type does not depend on the type of input image.

 

·         Threshold Type = Simple. The mean value Mcl and standard deviation scl of all pixels in the cluster are calculated. The cluster specific threshold is

 

Equation 8.6

 

The new threshold is applied to the cluster. If the cluster is shrunk or split, the threshold is recalculated again for each new cluster. If the number of pixels after applying a new threshold doesn’t change, the cluster is passed down for centroid computation, even though the number of pixels in it is greater than Detection Max Area.

 

There are two problems with this simple-minded approach. First, once Tcl fails to reduce the cluster, this is the end of the segmentation process. Second, this approach will very often fail to resolve two or more point sources that end up in one cluster after the initial thresholding. If one of the point sources is significantly brighter than the others it will drive Tcl to be higher than the pixels in the fainter point sources. The two schemes below were designed to alleviate these problems.

 

·         Threshold Type = Combo. The following heuristic formula is used

 

Equation 8.7

 

Here Tmin is the difference between the initial threshold T and the minimum of the whole image. SegLevel is the number of times the threshold for this cluster has been raised without any effect on the cluster. Here is how it works: Initially, for each cluster it is set to 1. Then a new threshold is calculated. If all the pixels in the cluster are higher than the threshold, then the threshold is raised and SegLevel is incremented. This is repeated until some of the pixels in the cluster end up below the threshold. At this point SegLevel is reset to 1. This approach works better then the first one, since the threshold is raised slower and segmentation doesn't stop after the first failure.

 

·         Threshold Type = Peak. This is the most convoluted and is also the most effective one. It is the scheme that has been found to do the best for point source extraction. The condition, that a cluster is split when it is greater than Detection Max Area, is supplemented with one more condition:

 

A cluster is split as long as there is more then one "peak pixel" per cluster or it is greater than Detection Max Area.

 

A peak pixel is any pixel greater than any other pixel within a certain radius. In command-line MOPEX, the namelist parameter Peaks_Radius is used to specify this radius. The GUI uses the default radius of 1, i.e. a pixel greater than the 8 adjacent pixels is declared a peak. If Peaks_Image_Filename is set in the namelist, an image of peak pixels will be written out. For each cluster the value Pmin of the lowest peak is found. Segmentation threshold Tcl is first is set to

 

Equation 8.8

 

If the cluster doesn't change (split or shrink), then the threshold is slowly raised:

 

Equation 8.9

 

This is repeated up to Max_Segmentation_Level times. The value of Max_Segmentation_Level is selectable in command-line MOPEX, but is left to the default (50) in the GUI. After that the centroid is found for the resulting cluster, even though it might have more then one peak in it. There is one provision to prevent the program from splitting wings off of a bright star. If a cluster fails to be split, normally the threshold will be raised, but if the number of pixels in the cluster is greater than Extended Object Area, then this cluster is left the way it is, even though it might have more than one peak in it.

8.3.3        Co-added Images

There is one issue with processing co-added images. Due to the variable coverage, the noise level (being inversely proportional to the square root of the coverage) varies throughout such an image. One way to deal with this problem is to use the Gaussnoise module to produce an SNR image. Gaussnoise produces a local estimate of the noise and therefore the effects of the variable coverage will be reflected in the SNR image. There are two problems with this approach. First, it is time consuming. Second, the process of raising threshold to split/shrink clusters has been designed with the Input Type = Image Input in mind; it is not clear how it will work for SNR Input images. The alternative is to use a coverage map (CoverageMap_Filename). The coverage map is used to attenuate co-added images, i.e. an input co-added image is multiplied by the sqrt(coverage map), if a coverage map is provided.

8.3.4        Probability Images

The parameter Probability Threshold in the APEX settings is used for the so-called PSP images produced by the Point Source Probability module. The PSP images are products of non-linear filtering of regular images. They have the maximum value of 1. They very often have a cluster of pixels with the values saturated very close to 1. If the probability threshold is set, then pixels greater than the probability threshold are excluded from calculation of the initial threshold. Without using it there is a possibility of having the initial threshold greater then 1, which will lead to having no detections.

8.3.5        Passive Deblending

The output of this program is used for point source extraction. Point source extraction performs passive deblending. The detected point sources, determined to be in a close proximity from one another so that their PRFs (see §8.7) overlap, are fitted simultaneously. The Detect module provides the classification of detections as candidates for passive deblending. If a cluster created by the initial thresholding is consequently split into several clusters, the latter are classified as a blend of clusters. There are two columns in the output table that are used for detection blend classification:

 

·         Blendid keeps track of the sequential number of a detection blend in the table.

·         Blendsize gives the number of detections in the blend.

 

The columns have the same values for each detection in a particular blend. For non-blend detections, these columns are set to zero. Figure 8.15 shows an example of image segmentation after the recursive thresholding is performed.

 

Figure 8.15: An example of image segmentation with Detection Min Area = 3; Detection Max Area = 9. A blend of detection with BlendSize = 2 is shown.

8.3.6        Centroid

For all detected clusters the centroid is found:

 

Equation 8.10

The value of the greatest pixel in the cluster is saved as the "flux" in the output table. This quantity can be used only as a guide to the flux of a point source; the Detect module is not meant to compute photometry; the modules Source Estimate or Aperture Photometry should be used for that purpose.