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/06/15 21:07:27 $ 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 typedef enum { 00026 PM_PEAK_LONE, ///< Isolated peak. 00027 PM_PEAK_EDGE, ///< Peak on edge. 00028 PM_PEAK_FLAT, ///< Peak has equal-value neighbors. 00029 PM_PEAK_UNDEF ///< Undefined. 00030 } psPeakType; 00031 00032 typedef struct 00033 { 00034 psS32 x; ///< X-coordinate of peak pixel. 00035 psS32 y; ///< Y-coordinate of peak pixel. 00036 psF32 counts; ///< Value of peak pixel (above sky?). 00037 psPeakType class; ///< Description of peak. 00038 } 00039 psPeak; 00040 00041 typedef struct 00042 { 00043 psF32 x; ///< X-coord of centroid. 00044 psF32 y; ///< Y-coord of centroid. 00045 psF32 Sx; ///< x-second moment. 00046 psF32 Sy; ///< y-second moment. 00047 psF32 Sxy; ///< xy cross moment. 00048 psF32 Sum; ///< Pixel sum above sky (background). 00049 psF32 Peak; ///< Peak counts above sky. 00050 psF32 Sky; ///< Sky level (background). 00051 psS32 nPixels; ///< Number of pixels used. 00052 } 00053 psMoments; 00054 00055 typedef enum { 00056 PS_MODEL_GAUSS, ///< Regular 2-D Gaussian 00057 PS_MODEL_PGAUSS, ///< Psuedo 2-D Gaussian 00058 PS_MODEL_TWIST_GAUSS, ///< 2-D Twisted Gaussian 00059 PS_MODEL_WAUSS, ///< 2-D Waussian 00060 PS_MODEL_SERSIC, ///< Sersic 00061 PS_MODEL_SERSIC_CORE, ///< Sersic Core 00062 PS_MODEL_UNDEFINED ///< Undefined 00063 } psModelType; 00064 00065 // XXX: It will be better if params, and dparams, were psVectors. 00066 typedef struct 00067 { 00068 psModelType type; ///< Model to be used. 00069 psVector *params; ///< Paramater values. 00070 psVector *dparams; ///< Parameter errors. 00071 psF32 chisq; ///< Fit chi-squared. 00072 psS32 nDOF; ///< number of degrees of freedom 00073 psS32 nIter; ///< number of iterations to reach min 00074 } 00075 psModel; 00076 00077 typedef enum { 00078 PS_SOURCE_PSFSTAR, 00079 PS_SOURCE_GALAXY, 00080 PS_SOURCE_DEFECT, 00081 PS_SOURCE_SATURATED, 00082 PS_SOURCE_SATSTAR, 00083 PS_SOURCE_FAINTSTAR, 00084 PS_SOURCE_BRIGHTSTAR, 00085 PS_SOURCE_OTHER 00086 } psSourceType; 00087 00088 typedef struct 00089 { 00090 psPeak *peak; ///< Description of peak pixel. 00091 psImage *pixels; ///< Rectangular region including object pixels. 00092 psImage *mask; ///< Mask which marks pixels associated with objects. 00093 psMoments *moments; ///< Basic moments measure for the object. 00094 psModel *models; ///< Model parameters and type. 00095 psSourceType type; ///< Best identification of object. 00096 } 00097 psSource; 00098 00099 psPeak *pmPeakAlloc(psS32 x, ///< Row-coordinate in image space 00100 psS32 y, ///< Col-coordinate in image space 00101 psF32 counts, ///< The value of the peak pixel 00102 psPeakType class ///< The type of peak pixel 00103 ); 00104 00105 psMoments *pmMomentsAlloc(); 00106 psModel *pmModelAlloc(psModelType type); 00107 psSource *pmSourceAlloc(); 00108 00109 /****************************************************************************** 00110 pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector 00111 above the given threshold. Returns a vector of type PS_TYPE_U32 containing 00112 the location (x value) of all peaks. 00113 *****************************************************************************/ 00114 psVector *pmFindVectorPeaks(const psVector *vector, ///< The input vector (psF32) 00115 psF32 threshold ///< Threshold above which to find a peak 00116 ); 00117 00118 /****************************************************************************** 00119 pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage 00120 above the given threshold. Returns a psList containing the location (x/y 00121 value) of all peaks. 00122 *****************************************************************************/ 00123 psArray *pmFindImagePeaks(const psImage *image, ///< The input image where peaks will be found (psF32) 00124 psF32 threshold ///< Threshold above which to find a peak 00125 ); 00126 00127 /****************************************************************************** 00128 psCullPeaks(peaks, maxValue, valid): eliminate peaks from the psList that have 00129 a peak value above the given maximum, or fall outside the valid region. 00130 *****************************************************************************/ 00131 psList *pmCullPeaks(psList *peaks, ///< The psList of peaks to be culled 00132 psF32 maxValue, ///< Cull peaks above this value 00133 const psRegion *valid ///< Cull peaks otside this psRegion 00134 ); 00135 00136 /****************************************************************************** 00137 psSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius): 00138 00139 *****************************************************************************/ 00140 psSource *pmSourceLocalSky(const psImage *image, ///< The input image (psF32) 00141 const psPeak *peak, ///< The peak for which the psSource struct is created. 00142 psStatsOptions statsOptions, ///< The statistic used in calculating the background sky 00143 psF32 innerRadius, ///< The inner radius of the suqare annulus for calculating sky 00144 psF32 outerRadius ///< The outer radius of the suqare annulus for calculating sky 00145 ); 00146 00147 /****************************************************************************** 00148 *****************************************************************************/ 00149 psSource *pmSourceMoments(psSource *source, ///< The input psSource for which moments will be computed 00150 psF32 radius ///< Use a circle of pixels around the peak 00151 ); 00152 00153 /****************************************************************************** 00154 pmSourceRoughClass(pmArray *source, psMetaDeta *metadata): make a guess at the 00155 source classification. 00156 *****************************************************************************/ 00157 bool pmSourceRoughClass(psArray *source, ///< The input psSource 00158 psMetadata *metadata ///< Contains classification parameters 00159 ); 00160 /****************************************************************************** 00161 pmSourceSetPixelCircle(source, image, radius) 00162 *****************************************************************************/ 00163 bool pmSourceSetPixelsCircle(psSource *source, ///< The input psSource 00164 const psImage *image, ///< The input image (psF32) 00165 psF32 radius ///< The radius of the circle 00166 ); 00167 00168 /****************************************************************************** 00169 *****************************************************************************/ 00170 bool pmSourceModelGuess(psSource *source, ///< The input psSource 00171 const psImage *image, ///< The input image (psF32) 00172 psModelType model ///< The type of model to be created. 00173 ); 00174 00175 /****************************************************************************** 00176 *****************************************************************************/ 00177 typedef enum { 00178 PS_CONTOUR_CRUDE, 00179 } pmContourType; 00180 00181 psArray *pmSourceContour(psSource *source, ///< The input psSource 00182 const psImage *image, ///< The input image (psF32) (this arg should be removed) 00183 psF32 level, ///< The level of the contour 00184 pmContourType mode ///< Currently this must be PS_CONTOUR_CRUDE 00185 ); 00186 00187 /****************************************************************************** 00188 *****************************************************************************/ 00189 bool pmSourceFitModel(psSource *source, ///< The input psSource 00190 const psImage *image ///< The input image (psF32) 00191 ); 00192 00193 /****************************************************************************** 00194 *****************************************************************************/ 00195 bool pmSourceAddModel(psImage *image, ///< The opuut image (psF32) 00196 psSource *source, ///< The input psSource 00197 bool center ///< A boolean flag that determines whether pixels are centered 00198 ); 00199 00200 /****************************************************************************** 00201 *****************************************************************************/ 00202 bool pmSourceSubModel(psImage *image, ///< The output image (psF32) 00203 psSource *source, ///< The input psSource 00204 bool center ///< A boolean flag that determines whether pixels are centered 00205 ); 00206 00207 /****************************************************************************** 00208 XXX: Why only *x argument? 00209 XXX EAM: psMinimizeLMChi2Func returns psF64, not psF32 00210 *****************************************************************************/ 00211 psF64 pmMinLM_Gauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00212 psVector *params, ///< A psVector which holds the parameters of this function 00213 psVector *x ///< A psVector which holds the row/col coordinate 00214 ); 00215 00216 /****************************************************************************** 00217 *****************************************************************************/ 00218 psF64 pmMinLM_PsuedoGauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00219 psVector *params, ///< A psVector which holds the parameters of this function 00220 psVector *x ///< A psVector which holds the row/col coordinate 00221 ); 00222 00223 /****************************************************************************** 00224 *****************************************************************************/ 00225 psF64 pmMinLM_Wauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00226 psVector *params, ///< A psVector which holds the parameters of this function 00227 psVector *x ///< A psVector which holds the row/col coordinate 00228 ); 00229 00230 /****************************************************************************** 00231 *****************************************************************************/ 00232 psF64 pmMinLM_TwistGauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00233 psVector *params, ///< A psVector which holds the parameters of this function 00234 psVector *x ///< A psVector which holds the row/col coordinate 00235 ); 00236 00237 /****************************************************************************** 00238 *****************************************************************************/ 00239 psF64 pmMinLM_Sersic(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00240 psVector *params, ///< A psVector which holds the parameters of this function 00241 psVector *x ///< A psVector which holds the row/col coordinate 00242 ); 00243 00244 /****************************************************************************** 00245 *****************************************************************************/ 00246 psF64 pmMinLM_SersicCore(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00247 psVector *params, ///< A psVector which holds the parameters of this function 00248 psVector *x ///< A psVector which holds the row/col coordinate 00249 ); 00250 00251 /****************************************************************************** 00252 *****************************************************************************/ 00253 psF64 pmMinLM_PsuedoSersic(psVector *deriv, ///< A possibly-NULL structure for the output derivatives 00254 psVector *params, ///< A psVector which holds the parameters of this function 00255 psVector *x ///< A psVector which holds the row/col coordinate 00256 ); 00257 00258 00259 #endif
1.4.1