00001 /* @file pmObjects.h 00002 * @brief Functions to define and manipulate object models 00003 * 00004 * @author GLG, MHPCC 00005 * @author EAM, IfA 00006 * 00007 * @version $Revision: 1.6 $ $Name: $ 00008 * @date $Date: 2007/01/24 02:54:15 $ 00009 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 00010 */ 00011 00012 # ifndef PM_MODEL_H 00013 # define PM_MODEL_H 00014 00015 /// @addtogroup Objects Object Detection / Analysis Functions 00016 /// @{ 00017 00018 // type of model carried by the pmModel structure 00019 typedef int pmModelType; 00020 00021 typedef enum { 00022 PM_MODEL_UNTRIED, ///< model fit not yet attempted 00023 PM_MODEL_SUCCESS, ///< model fit succeeded 00024 PM_MODEL_NONCONVERGE, ///< model fit did not converge 00025 PM_MODEL_OFFIMAGE, ///< model fit drove out of range 00026 PM_MODEL_BADARGS ///< model fit called with invalid args 00027 } pmModelStatus; 00028 00029 /** pmModel data structure 00030 * 00031 * Every source may have two types of models: a PSF model and a EXT (extended-source) 00032 * model. The PSF model represents the best fit of the image PSF to the specific 00033 * object. In this case, the PSF-dependent parameters are specified for the 00034 * object by the PSF, not by the fit. The EXT model represents the best fit of 00035 * the given model to the object, with all shape parameters floating in the fit. 00036 * 00037 */ 00038 typedef struct 00039 { 00040 pmModelType type; ///< Model to be used. 00041 psVector *params; ///< Paramater values. 00042 psVector *dparams; ///< Parameter errors. 00043 float chisq; ///< Fit chi-squared. 00044 float chisqNorm; ///< re-normalized fit chi-squared. 00045 int nDOF; ///< number of degrees of freedom 00046 int nIter; ///< number of iterations to reach min 00047 pmModelStatus status; ///< fit status 00048 float radiusFit; ///< fit radius actually used 00049 } 00050 pmModel; 00051 00052 /** Symbolic names for the elements of [d]params 00053 * Note: these are #defines not enums as a given element of [d]params 00054 * may/will correspond to different parameters in different contexts 00055 */ 00056 #define PM_PAR_SKY 0 ///< Sky 00057 #define PM_PAR_I0 1 ///< Central intensity 00058 #define PM_PAR_XPOS 2 ///< X centre of object 00059 #define PM_PAR_YPOS 3 ///< Y centre of object 00060 #define PM_PAR_SXX 4 ///< shape X^2 moment 00061 #define PM_PAR_SYY 5 ///< shape Y^2 moment 00062 #define PM_PAR_SXY 6 ///< shape XY moment 00063 #define PM_PAR_7 7 ///< ??? Unknown parameter 00064 #define PM_PAR_8 8 ///< ??? Unknown parameter 00065 00066 /** pmModelAlloc() 00067 * 00068 */ 00069 pmModel *pmModelAlloc(pmModelType type); 00070 00071 // copy model to a new structure 00072 pmModel *pmModelCopy (pmModel *model); 00073 00074 psF32 pmModelEval(pmModel *model, psImage *image, psS32 col, psS32 row); 00075 00076 /** pmModelAdd() 00077 * 00078 * Add the given source model flux to/from the provided image. The boolean 00079 * option center selects if the source is re-centered to the image center or if 00080 * it is placed at its centroid location. The boolean option sky selects if the 00081 * background sky is applied (TRUE) or not. The pixel range in the target image 00082 * is at most the pixel range specified by the source.pixels image. The success 00083 * status is returned. 00084 * 00085 */ 00086 bool pmModelAdd( 00087 psImage *image, ///< The output image (float) 00088 psImage *mask, ///< The image pixel mask (valid == 0) 00089 pmModel *model, ///< The input pmModel 00090 bool center, ///< A boolean flag that determines whether pixels are centered 00091 bool sky ///< A boolean flag that determines if the sky is subtracted 00092 ); 00093 00094 00095 /** pmModelSub() 00096 * 00097 * Subtract the given source model flux to/from the provided image. The 00098 * boolean option center selects if the source is re-centered to the image center 00099 * or if it is placed at its centroid location. The boolean option sky selects if 00100 * the background sky is applied (TRUE) or not. The pixel range in the target 00101 * image is at most the pixel range specified by the source.pixels image. The 00102 * success status is returned. 00103 * 00104 */ 00105 bool pmModelSub( 00106 psImage *image, ///< The output image (float) 00107 psImage *mask, ///< The image pixel mask (valid == 0) 00108 pmModel *model, ///< The input pmModel 00109 bool center, ///< A boolean flag that determines whether pixels are centered 00110 bool sky ///< A boolean flag that determines if the sky is subtracted 00111 ); 00112 00113 /** pmModelFitStatus() 00114 * 00115 * This function wraps the call to the model-specific function returned by 00116 * pmModelFitStatusFunc_GetFunction. The model-specific function examines the 00117 * model parameters, parameter errors, Chisq, S/N, and other parameters available 00118 * from model to decide if the particular fit was successful or not. 00119 * 00120 * XXX: Must code this. 00121 * 00122 */ 00123 bool pmModelFitStatus( 00124 pmModel *model ///< Model to be used 00125 ); 00126 00127 /// @} 00128 # endif /* PM_MODEL_H */
1.5.1