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

pmObjects.h

Go to the documentation of this file.
00001 /** @file  pmObjects.h
00002  *
00003  *  This file will ...
00004  *
00005  *  @author GLG, MHPCC
00006  *
00007  *  @version $Revision: 1.1.1.1 $ $Name:  $
00008  *  @date $Date: 2005/09/14 21:09:15 $
00009  *
00010  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
00011  *
00012  */
00013 
00014 #if !defined(PM_OBJECTS_H)
00015 #define PM_OBJECTS_H
00016 
00017 #if HAVE_CONFIG_H
00018 #include <config.h>
00019 #endif
00020 
00021 #include<stdio.h>
00022 #include<math.h>
00023 #include "pslib.h"
00024 
00025 /** pmPeakType
00026  * 
00027  *  A peak pixel may have several features which may be determined when the
00028  *  peak is found or measured. These are specified by the pmPeakType enum.
00029  *  PM_PEAK_LONE represents a single pixel which is higher than its 8 immediate
00030  *  neighbors.  The PM_PEAK_EDGE represents a peak pixel which touching the image
00031  *  edge. The PM_PEAK_FLAT represents a peak pixel which has more than a specific
00032  *  number of neighbors at the same value, within some tolarence:
00033  * 
00034  */
00035 typedef enum {
00036     PM_PEAK_LONE,                       ///< Isolated peak.
00037     PM_PEAK_EDGE,                       ///< Peak on edge.
00038     PM_PEAK_FLAT,                       ///< Peak has equal-value neighbors.
00039     PM_PEAK_UNDEF                       ///< Undefined.
00040 } pmPeakType;
00041 
00042 /** pmPeak data structure
00043  *  
00044  */
00045 typedef struct
00046 {
00047     int x;                              ///< X-coordinate of peak pixel.
00048     int y;                              ///< Y-coordinate of peak pixel.
00049     float counts;                       ///< Value of peak pixel (above sky?).
00050     pmPeakType class;                   ///< Description of peak.
00051 }
00052 pmPeak;
00053 
00054 /** pmMoments data structure
00055  *  
00056  */
00057 typedef struct
00058 {
00059     float x;                            ///< X-coord of centroid.
00060     float y;                            ///< Y-coord of centroid.
00061     float Sx;                           ///< x-second moment.
00062     float Sy;                           ///< y-second moment.
00063     float Sxy;                          ///< xy cross moment.
00064     float Sum;                          ///< Pixel sum above sky (background).
00065     float Peak;                         ///< Peak counts above sky.
00066     float Sky;                          ///< Sky level (background).
00067     int nPixels;                        ///< Number of pixels used.
00068 }
00069 pmMoments;
00070 
00071 /** pmModelType enumeration
00072  *  
00073  */
00074 typedef enum {
00075     PS_MODEL_GAUSS,                     ///< Regular 2-D Gaussian
00076     PS_MODEL_PGAUSS,                    ///< Psuedo 2-D Gaussian
00077     PS_MODEL_TWIST_GAUSS,               ///< 2-D Twisted Gaussian
00078     PS_MODEL_WAUSS,                     ///< 2-D Waussian
00079     PS_MODEL_SERSIC,                    ///< Sersic
00080     PS_MODEL_SERSIC_CORE,               ///< Sersic Core
00081     PS_MODEL_UNDEFINED                  ///< Undefined
00082 } pmModelType;
00083 
00084 /** pmModel data structure
00085  *  
00086  */
00087 // XXX: The SDRS has the "type" member of type psS32.
00088 typedef struct
00089 {
00090     pmModelType type;                   ///< Model to be used.
00091     psVector *params;                   ///< Paramater values.
00092     psVector *dparams;                  ///< Parameter errors.
00093     float chisq;                        ///< Fit chi-squared.
00094     int nDOF;                           ///< number of degrees of freedom
00095     int nIter;                          ///< number of iterations to reach min
00096 }
00097 pmModel;
00098 
00099 /** pmSourceType enumeration
00100  *  
00101  *  
00102  *  
00103  */
00104 typedef enum {
00105     PS_SOURCE_PSFSTAR,
00106     PS_SOURCE_GALAXY,
00107     PS_SOURCE_DEFECT,
00108     PS_SOURCE_SATURATED,
00109     PS_SOURCE_SATSTAR,
00110     PS_SOURCE_FAINTSTAR,
00111     PS_SOURCE_BRIGHTSTAR,
00112     PS_SOURCE_OTHER
00113 } pmSourceType;
00114 
00115 /** pmSource data structure
00116  *  
00117  *  This source has the capacity for several types of measurements. The
00118  *  simplest measurement of a source is the location and flux of the peak pixel
00119  *  associated with the source:
00120  *  
00121  */
00122 typedef struct
00123 {
00124     pmPeak *peak;                       ///< Description of peak pixel.
00125     psImage *pixels;                    ///< Rectangular region including object pixels.
00126     psImage *mask;                      ///< Mask which marks pixels associated with objects.
00127     pmMoments *moments;                 ///< Basic moments measure for the object.
00128     pmModel *modelPSF;                  ///< PSF model parameters and type
00129     pmModel *modelFLT;                  ///< FLT model parameters and type
00130     pmSourceType type;                  ///< Best identification of object.
00131 }
00132 pmSource;
00133 
00134 /** pmPeak data structure
00135  *  
00136  *  
00137  *  
00138  */
00139 typedef struct
00140 {
00141     psS32 type;                         ///< PSF Model in use
00142     psArray *params;                    ///< Model parameters (psPolynomial2D)
00143     psF32 chisq;                        ///< PSF goodness statistic
00144     psS32 nPSFstars;                    ///< number of stars used to measure PSF
00145 }
00146 pmPSF;
00147 
00148 
00149 
00150 pmPeak *pmPeakAlloc(
00151     int x,                              ///< Row-coordinate in image space
00152     int y,                              ///< Col-coordinate in image space
00153     float counts,                       ///< The value of the peak pixel
00154     pmPeakType class                    ///< The type of peak pixel
00155 );
00156 
00157 pmMoments *pmMomentsAlloc();
00158 pmModel *pmModelAlloc(pmModelType type);
00159 pmSource *pmSourceAlloc();
00160 
00161 /******************************************************************************
00162 pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
00163 above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
00164 the location (x value) of all peaks.
00165  *****************************************************************************/
00166 psVector *pmFindVectorPeaks(
00167     const psVector *vector,             ///< The input vector (float)
00168     float threshold                     ///< Threshold above which to find a peak
00169 );
00170 
00171 /******************************************************************************
00172 pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
00173 above the given threshold.  Returns a psList containing the location (x/y
00174 value) of all peaks.
00175  *****************************************************************************/
00176 psArray *pmFindImagePeaks(
00177     const psImage *image,               ///< The input image where peaks will be found (float)
00178     float threshold                     ///< Threshold above which to find a peak
00179 );
00180 
00181 /******************************************************************************
00182 psCullPeaks(peaks, maxValue, valid): eliminate peaks from the psList that have
00183 a peak value above the given maximum, or fall outside the valid region.
00184  *****************************************************************************/
00185 psList *pmCullPeaks(
00186     psList *peaks,                      ///< The psList of peaks to be culled
00187     float maxValue,                     ///< Cull peaks above this value
00188     const psRegion valid               ///< Cull peaks otside this psRegion
00189 );
00190 
00191 /******************************************************************************
00192 pmSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius):
00193  
00194  *****************************************************************************/
00195 pmSource *pmSourceLocalSky(
00196     const psImage *image,               ///< The input image (float)
00197     const pmPeak *peak,                 ///< The peak for which the psSource struct is created.
00198     psStatsOptions statsOptions,        ///< The statistic used in calculating the background sky
00199     float innerRadius,                  ///< The inner radius of the suqare annulus for calculating sky
00200     float outerRadius                   ///< The outer radius of the suqare annulus for calculating sky
00201 );
00202 
00203 /******************************************************************************
00204  *****************************************************************************/
00205 pmSource *pmSourceMoments(
00206     pmSource *source,                   ///< The input pmSource for which moments will be computed
00207     float radius                        ///< Use a circle of pixels around the peak
00208 );
00209 
00210 /******************************************************************************
00211 pmSourceRoughClass(pmArray *source, psMetaDeta *metadata): make a guess at the
00212 source classification.
00213  *****************************************************************************/
00214 bool pmSourceRoughClass(
00215     psArray *source,                    ///< The input pmSource
00216     psMetadata *metadata                ///< Contains classification parameters
00217 );
00218 /******************************************************************************
00219 pmSourceSetPixelCircle(source, image, radius)
00220  *****************************************************************************/
00221 bool pmSourceSetPixelsCircle(
00222     pmSource *source,                   ///< The input pmSource
00223     const psImage *image,               ///< The input image (float)
00224     float radius                        ///< The radius of the circle
00225 );
00226 
00227 /******************************************************************************
00228  *****************************************************************************/
00229 bool pmSourceModelGuess(
00230     pmSource *source,                   ///< The input pmSource
00231     const psImage *image,               ///< The input image (float)
00232     pmModelType model                   ///< The type of model to be created.
00233 );
00234 
00235 /******************************************************************************
00236  *****************************************************************************/
00237 typedef enum {
00238     PS_CONTOUR_CRUDE,
00239 } pmContourType;
00240 
00241 psArray *pmSourceContour(
00242     pmSource *source,                   ///< The input pmSource
00243     const psImage *image,               ///< The input image (float) (this arg should be removed)
00244     float level,                        ///< The level of the contour
00245     pmContourType mode                  ///< Currently this must be PS_CONTOUR_CRUDE
00246 );
00247 
00248 /******************************************************************************
00249  *****************************************************************************/
00250 bool pmSourceFitModel(
00251     pmSource *source,                   ///< The input pmSource
00252     const psImage *image                ///< The input image (float)
00253 );
00254 
00255 /******************************************************************************
00256  *****************************************************************************/
00257 bool pmSourceAddModel(
00258     psImage *image,                     ///< The opuut image (float)
00259     pmSource *source,                   ///< The input pmSource
00260     bool center                         ///< A boolean flag that determines whether pixels are centered
00261 );
00262 
00263 /******************************************************************************
00264  *****************************************************************************/
00265 bool pmSourceSubModel(
00266     psImage *image,                     ///< The output image (float)
00267     pmSource *source,                   ///< The input pmSource
00268     bool center                         ///< A boolean flag that determines whether pixels are centered
00269 );
00270 
00271 /******************************************************************************
00272 XXX: Why only *x argument?
00273 XXX EAM: psMinimizeLMChi2Func returns psF64, not float
00274  *****************************************************************************/
00275 float pmMinLM_Gauss2D(
00276     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00277     const psVector *params,             ///< A psVector which holds the parameters of this function
00278     const psVector *x                   ///< A psVector which holds the row/col coordinate
00279 );
00280 
00281 /******************************************************************************
00282  *****************************************************************************/
00283 float pmMinLM_PsuedoGauss2D(
00284     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00285     const psVector *params,             ///< A psVector which holds the parameters of this function
00286     const psVector *x                   ///< A psVector which holds the row/col coordinate
00287 );
00288 
00289 /******************************************************************************
00290  *****************************************************************************/
00291 float pmMinLM_Wauss2D(
00292     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00293     const psVector *params,             ///< A psVector which holds the parameters of this function
00294     const psVector *x                   ///< A psVector which holds the row/col coordinate
00295 );
00296 
00297 /******************************************************************************
00298  *****************************************************************************/
00299 float pmMinLM_TwistGauss2D(
00300     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00301     const psVector *params,             ///< A psVector which holds the parameters of this function
00302     const psVector *x                   ///< A psVector which holds the row/col coordinate
00303 );
00304 
00305 /******************************************************************************
00306  *****************************************************************************/
00307 float pmMinLM_Sersic(
00308     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00309     const psVector *params,             ///< A psVector which holds the parameters of this function
00310     const psVector *x                   ///< A psVector which holds the row/col coordinate
00311 );
00312 
00313 /******************************************************************************
00314  *****************************************************************************/
00315 float pmMinLM_SersicCore(
00316     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00317     const psVector *params,             ///< A psVector which holds the parameters of this function
00318     const psVector *x                   ///< A psVector which holds the row/col coordinate
00319 );
00320 
00321 /******************************************************************************
00322  *****************************************************************************/
00323 float pmMinLM_PsuedoSersic(
00324     psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
00325     const psVector *params,             ///< A psVector which holds the parameters of this function
00326     const psVector *x                   ///< A psVector which holds the row/col coordinate
00327 );
00328 
00329 
00330 /**
00331  * 
00332  *  The object model functions are defined to allow for the flexible addition
00333  *  of new object models. Every object model, with parameters represented by
00334  *  pmModel, has an associated set of functions which provide necessary support
00335  *  operations. A set of abstract functions allow the programmer to select the
00336  *  approriate function or property for a specific named object model.
00337  * 
00338  */
00339 
00340 /**
00341  * 
00342  *  This function is the model chi-square minimization function for this model.
00343  * 
00344  */
00345 typedef psMinimizeLMChi2Func pmModelFunc;
00346 
00347 
00348 /**
00349  * 
00350  * This function returns the integrated flux for the given model parameters.
00351  */
00352 typedef psF64 (*pmModelFlux)(const psVector *params);
00353 
00354 
00355 /**
00356  * 
00357  *  This function provides the model guess parameters based on the details of
00358  *   the given source.
00359  * 
00360  */
00361 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
00362 
00363 
00364 /**
00365  * 
00366  *  This function constructs the PSF model for the given source based on the
00367  *  supplied psf and the FLT model for the object.
00368  * 
00369  */
00370 typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelFLT, pmPSF *psf);
00371 
00372 
00373 /**
00374  * 
00375  *  This function returns the radius at which the given model and parameters
00376  *  achieves the given flux.
00377  * 
00378  */
00379 typedef psF64 (*pmModelRadius)(const psVector *params, double flux);
00380 
00381 
00382 /**
00383  * 
00384  *  Each of the function types above has a corresponding function which returns
00385  *  the function given the model type:
00386  * 
00387  */
00388 pmModelFunc pmModelFunc_GetFunction (pmModelType type);
00389 pmModelFlux pmModelFlux_GetFunction (pmModelType type);
00390 pmModelGuessFunc pmModelGuessFunc_GetFunction (pmModelType type);
00391 pmModelFromPSFFunc pmModelFromPSFFunc_GetFunction (pmModelType type);
00392 pmModelRadius pmModelRadius_GetFunction (pmModelType type);
00393 psS32 pmModelParameterCount(pmModelType type);
00394 psS32 pmModelSetType(char *name);
00395 char *pmModelGetType(pmModelType type);
00396 
00397 #endif

Generated on Wed Sep 14 11:09:15 2005 for Pan-STARRS Module Library by  doxygen 1.4.2