Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

pmPeaks.h

Go to the documentation of this file.
00001 /** @file  pmPeaks.h
00002  *
00003  * The process of finding, measuring, and classifying astronomical sources on
00004  * images is one of the critical tasks of the IPP or any astronomical software
00005  * system. This file will define structures and functions related to the task
00006  * of source detection and measurement. The elements defined in this section
00007  * are generally low-level components which can be connected together to
00008  * construct a complete object measurement suite.
00009  *
00010  *  @author GLG, MHPCC
00011  *
00012  *  @version $Revision: 1.3 $ $Name: rel12 $
00013  *  @date $Date: 2006/06/03 01:02:08 $
00014  *
00015  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
00016  *
00017  */
00018 
00019 # ifndef PM_PEAKS_H
00020 # define PM_PEAKS_H
00021 
00022 /** pmPeakType
00023  *
00024  *  A peak pixel may have several features which may be determined when the
00025  *  peak is found or measured. These are specified by the pmPeakType enum.
00026  *  PM_PEAK_LONE represents a single pixel which is higher than its 8 immediate
00027  *  neighbors.  The PM_PEAK_EDGE represents a peak pixel which touching the image
00028  *  edge. The PM_PEAK_FLAT represents a peak pixel which has more than a specific
00029  *  number of neighbors at the same value, within some tolarence:
00030  *
00031  */
00032 typedef enum {
00033     PM_PEAK_LONE,                       ///< Isolated peak.
00034     PM_PEAK_EDGE,                       ///< Peak on edge.
00035     PM_PEAK_FLAT,                       ///< Peak has equal-value neighbors.
00036     PM_PEAK_UNDEF                       ///< Undefined.
00037 } pmPeakType;
00038 
00039 
00040 /** pmPeak data structure
00041  *
00042  *  A source has the capacity for several types of measurements. The
00043  *  simplest measurement of a source is the location and flux of the peak pixel
00044  *  associated with the source:
00045  *
00046  */
00047 typedef struct
00048 {
00049     const int id;   ///< Unique ID for object
00050     int x;                              ///< X-coordinate of peak pixel.
00051     int y;                              ///< Y-coordinate of peak pixel.
00052     float counts;                       ///< Value of peak pixel (above sky?).
00053     pmPeakType type;                   ///< Description of peak.
00054 }
00055 pmPeak;
00056 
00057 
00058 /** pmPeakAlloc()
00059  *
00060  *  @return pmPeak*    newly allocated pmPeak with all internal pointers set to NULL
00061  */
00062 pmPeak *pmPeakAlloc(
00063     int x,    ///< Row-coordinate in image space
00064     int y,    ///< Col-coordinate in image space
00065     float counts,   ///< The value of the peak pixel
00066     pmPeakType type   ///< The type of peak pixel
00067 );
00068 
00069 bool pmIsPeak(const psPtr ptr);
00070 
00071 /** pmFindVectorPeaks()
00072  *
00073  * Find all local peaks in the given vector above the given threshold. A peak
00074  * is defined as any element with a value greater than its two neighbors and with
00075  * a value above the threshold. Two types of special cases must be addressed.
00076  * Equal value elements: If an element has the same value as the following
00077  * element, it is not considered a peak. If an element has the same value as the
00078  * preceding element (but not the following), then it is considered a peak. Note
00079  * that this rule (arbitrarily) identifies flat regions by their trailing edge.
00080  * Edge cases: At start of the vector, the element must be higher than its
00081  * neighbor. At the end of the vector, the element must be higher or equal to its
00082  * neighbor. These two rules again places the peak associated with a flat region
00083  * which touches the image edge at the image edge. The result of this function is
00084  * a vector containing the coordinates (element number) of the detected peaks
00085  * (type psU32).
00086  *
00087  */
00088 psVector *pmFindVectorPeaks(
00089     const psVector *vector,  ///< The input vector (float)
00090     float threshold   ///< Threshold above which to find a peak
00091 );
00092 
00093 
00094 /** pmFindImagePeaks()
00095  *
00096  * Find all local peaks in the given image above the given threshold. This
00097  * function should find all row peaks using pmFindVectorPeaks, then test each row
00098  * peak and exclude peaks which are not local peaks. A peak is a local peak if it
00099  * has a higher value than all 8 neighbors. If the peak has the same value as its
00100  * +y neighbor or +x neighbor, it is NOT a local peak. If any other neighbors
00101  * have an equal value, the peak is considered a valid peak. Note two points:
00102  * first, the +x neighbor condition is already enforced by pmFindVectorPeaks.
00103  * Second, these rules have the effect of making flat-topped regions have single
00104  * peaks at the (+x,+y) corner. When selecting the peaks, their type must also be
00105  * set. The result of this function is an array of pmPeak entries.
00106  *
00107  */
00108 psArray *pmFindImagePeaks(
00109     const psImage *image,  ///< The input image where peaks will be found (float)
00110     float threshold   ///< Threshold above which to find a peak
00111 );
00112 
00113 
00114 /** pmCullPeaks()
00115  *
00116  * Eliminate peaks from the psList that have a peak value above the given
00117  * maximum, or fall outside the valid region.
00118  *
00119  */
00120 psList *pmCullPeaks(
00121     psList *peaks,   ///< The psList of peaks to be culled
00122     float maxValue,   ///< Cull peaks above this value
00123     const psRegion valid                ///< Cull peaks otside this psRegion
00124 );
00125 
00126 
00127 /** pmPeaksSubset()
00128  *
00129  * Create a new peaks array, removing certain types of peaks from the input
00130  * array of peaks based on the given criteria. Peaks should be eliminated if they
00131  * have a peak value above the given maximum value limit or if the fall outside
00132  * the valid region.  The result of the function is a new array with a reduced
00133  * number of peaks.
00134  *
00135  */
00136 psArray *pmPeaksSubset(
00137     psArray *peaks,                     ///< Add comment.
00138     float maxvalue,                     ///< Add comment.
00139     const psRegion valid                ///< Add comment.
00140 );
00141 
00142 int pmPeaksCompareAscend (const void **a, const void **b);
00143 int pmPeaksCompareDescend (const void **a, const void **b);
00144 
00145 # endif /* PM_PEAKS_H */

Generated on Mon Jul 3 14:24:27 2006 for Pan-STARRS Module Library by  doxygen 1.4.4