IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ticket #386: pmObjects.h

File pmObjects.h, 12.3 KB (added by eugene, 21 years ago)

pmObjects.h to match pmObjects.c above

Line 
1/** @file pmObjects.h
2 *
3 * This file will ...
4 *
5 * @author GLG, MHPCC
6 *
7 * @version $Revision: 1.7.2.1 $ $Name: rel5_1 $
8 * @date $Date: 2005/04/06 19:34:06 $
9 *
10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
11 *
12 */
13
14#if !defined(PM_OBJECTS_H)
15#define PM_OBJECTS_H
16
17#if HAVE_CONFIG_H
18#include <config.h>
19#endif
20
21#include<stdio.h>
22#include<math.h>
23#include "pslib.h"
24
25typedef enum {
26 PM_PEAK_LONE, ///< Isolated peak.
27 PM_PEAK_EDGE, ///< Peak on edge.
28 PM_PEAK_FLAT, ///< Peak has equal-value neighbors.
29 PM_PEAK_UNDEF ///< Undefined.
30} psPeakType;
31
32typedef struct
33{
34 psS32 x; ///< X-coordinate of peak pixel.
35 psS32 y; ///< Y-coordinate of peak pixel.
36 psF32 counts; ///< Value of peak pixel (above sky?).
37 psPeakType class; ///< Description of peak.
38}
39psPeak;
40
41typedef struct
42{
43 psF32 x; ///< X-coord of centroid.
44 psF32 y; ///< Y-coord of centroid.
45 psF32 Sx; ///< x-second moment.
46 psF32 Sy; ///< y-second moment.
47 psF32 Sxy; ///< xy cross moment.
48 psF32 Sum; ///< Pixel sum above sky (background).
49 psF32 Peak; ///< Peak counts above sky.
50 psF32 Sky; ///< Sky level (background).
51 psS32 nPixels; ///< Number of pixels used.
52}
53psMoments;
54
55typedef enum {
56 PS_MODEL_GAUSS, ///< Regular 2-D Gaussian
57 PS_MODEL_PGAUSS, ///< Psuedo 2-D Gaussian
58 PS_MODEL_TWIST_GAUSS, ///< 2-D Twisted Gaussian
59 PS_MODEL_WAUSS, ///< 2-D Waussian
60 PS_MODEL_SERSIC, ///< Sersic
61 PS_MODEL_SERSIC_CORE, ///< Sersic Core
62 PS_MODEL_UNDEFINED ///< Undefined
63} psModelType;
64
65// XXX: It will be better if params, and dparams, were psVectors.
66typedef struct
67{
68 psModelType type; ///< Model to be used.
69 psVector *params; ///< Paramater values.
70 psVector *dparams; ///< Parameter errors.
71 psF32 chisq; ///< Fit chi-squared.
72 psS32 nDOF; ///< number of degrees of freedom
73 psS32 nIter; ///< number of iterations to reach min
74}
75psModel;
76
77// XXX: What is this enum?
78typedef enum {
79 PS_SOURCE_PSFSTAR,
80 PS_SOURCE_GALAXY,
81 PS_SOURCE_DEFECT,
82 PS_SOURCE_SATURATED,
83 PS_SOURCE_SATSTAR,
84 PS_SOURCE_FAINTSTAR,
85 PS_SOURCE_BRIGHTSTAR,
86 PS_SOURCE_OTHER
87} psSourceType;
88
89typedef struct
90{
91 psPeak *peak; ///< Description of peak pixel.
92 psImage *pixels; ///< Rectangular region including object pixels.
93 psImage *mask; ///< Mask which marks pixels associated with objects.
94 psMoments *moments; ///< Basic moments measure for the object.
95 psModel *models; ///< Model parameters and type.
96 psSourceType type; ///< Best identification of object.
97}
98psSource;
99
100psPeak *pmPeakAlloc(psS32 x, ///< Row-coordinate in image space
101 psS32 y, ///< Col-coordinate in image space
102 psF32 counts, ///< The value of the peak pixel
103 psPeakType class ///< The type of peak pixel
104 );
105
106psMoments *pmMomentsAlloc();
107psModel *pmModelAlloc(psModelType type);
108psSource *pmSourceAlloc();
109
110/******************************************************************************
111pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
112above the given threshold. Returns a vector of type PS_TYPE_U32 containing
113the location (x value) of all peaks.
114 *****************************************************************************/
115psVector *pmFindVectorPeaks(const psVector *vector, ///< The input vector (psF32)
116 psF32 threshold ///< Threshold above which to find a peak
117 );
118
119/******************************************************************************
120pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
121above the given threshold. Returns a psList containing the location (x/y
122value) of all peaks.
123 *****************************************************************************/
124psArray *pmFindImagePeaks(const psImage *image, ///< The input image where peaks will be found (psF32)
125 psF32 threshold ///< Threshold above which to find a peak
126 );
127
128/******************************************************************************
129psCullPeaks(peaks, maxValue, valid): eliminate peaks from the psList that have
130a peak value above the given maximum, or fall outside the valid region.
131
132XXX: Do we free the psList elements of those culled peaks?
133 *****************************************************************************/
134psList *pmCullPeaks(psList *peaks, ///< The psList of peaks to be culled
135 psF32 maxValue, ///< Cull peaks above this value
136 const psRegion *valid ///< Cull peaks otside this psRegion
137 );
138
139/******************************************************************************
140psSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius):
141
142 *****************************************************************************/
143psSource *pmSourceLocalSky(const psImage *image, ///< The input image (psF32)
144 const psPeak *peak, ///< The peak for which the psSource struct is created.
145 psStatsOptions statsOptions, ///< The statistic used in calculating the background sky
146 psF32 innerRadius, ///< The inner radius of the suqare annulus for calculating sky
147 psF32 outerRadius ///< The outer radius of the suqare annulus for calculating sky
148 );
149
150/******************************************************************************
151 *****************************************************************************/
152psSource *pmSourceMoments(psSource *source, ///< The input psSource for which moments will be computed
153 psF32 radius ///< Use a circle of pixels around the peak
154 );
155
156/******************************************************************************
157pmSourceRoughClass(pmArray *source, psMetaDeta *metadata): make a guess at the
158source classification.
159 *****************************************************************************/
160bool pmSourceRoughClass(psArray *source, ///< The input psSource
161 psMetadata *metadata ///< Contains classification parameters
162 );
163/******************************************************************************
164pmSourceSetPixelCircle(source, image, radius)
165 *****************************************************************************/
166bool pmSourceSetPixelCircle(psSource *source, ///< The input psSource
167 const psImage *image, ///< The input image (psF32)
168 psF32 radius ///< The radius of the circle
169 );
170
171/******************************************************************************
172 *****************************************************************************/
173bool pmSourceModelGuess(psSource *source, ///< The input psSource
174 const psImage *image, ///< The input image (psF32)
175 psModelType model ///< The type of model to be created.
176 );
177
178/******************************************************************************
179 *****************************************************************************/
180typedef enum {
181 PS_CONTOUR_CRUDE,
182} pmContourType;
183
184psArray *pmSourceContour(psSource *source, ///< The input psSource
185 const psImage *image, ///< The input image (psF32) (this arg should be removed)
186 psF32 level, ///< The level of the contour
187 pmContourType mode ///< Currently this must be PS_CONTOUR_CRUDE
188 );
189
190/******************************************************************************
191 *****************************************************************************/
192bool pmSourceFitModel(psSource *source, ///< The input psSource
193 const psImage *image ///< The input image (psF32)
194 );
195
196/******************************************************************************
197 *****************************************************************************/
198bool pmSourceAddModel(psImage *image, ///< The opuut image (psF32)
199 psSource *source, ///< The input psSource
200 bool center ///< A boolean flag that determines whether pixels are centered
201 );
202
203/******************************************************************************
204 *****************************************************************************/
205bool pmSourceSubModel(psImage *image, ///< The output image (psF32)
206 psSource *source, ///< The input psSource
207 bool center ///< A boolean flag that determines whether pixels are centered
208 );
209
210/******************************************************************************
211XXX: Why only *x argument?
212XXX EAM: psMinimizeLMChi2Func returns psF64, not psF32
213 *****************************************************************************/
214psF64 pmMinLM_Gauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
215 psVector *params, ///< A psVector which holds the parameters of this function
216 psVector *x ///< A psVector which holds the row/col coordinate
217 );
218
219/******************************************************************************
220XXX: Why only *x argument?
221 *****************************************************************************/
222psF64 pmMinLM_PsuedoGauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
223 psVector *params, ///< A psVector which holds the parameters of this function
224 psVector *x ///< A psVector which holds the row/col coordinate
225 );
226
227/******************************************************************************
228 *****************************************************************************/
229psF64 pmMinLM_Wauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
230 psVector *params, ///< A psVector which holds the parameters of this function
231 psVector *x ///< A psVector which holds the row/col coordinate
232 );
233
234/******************************************************************************
235 *****************************************************************************/
236psF64 pmMinLM_TwistGauss2D(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
237 psVector *params, ///< A psVector which holds the parameters of this function
238 psVector *x ///< A psVector which holds the row/col coordinate
239 );
240
241/******************************************************************************
242 *****************************************************************************/
243psF64 pmMinLM_Sersic(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
244 psVector *params, ///< A psVector which holds the parameters of this function
245 psVector *x ///< A psVector which holds the row/col coordinate
246 );
247
248/******************************************************************************
249 *****************************************************************************/
250psF64 pmMinLM_SersicCore(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
251 psVector *params, ///< A psVector which holds the parameters of this function
252 psVector *x ///< A psVector which holds the row/col coordinate
253 );
254
255/******************************************************************************
256 *****************************************************************************/
257psF64 pmMinLM_PsuedoSersic(psVector *deriv, ///< A possibly-NULL structure for the output derivatives
258 psVector *params, ///< A psVector which holds the parameters of this function
259 psVector *x ///< A psVector which holds the row/col coordinate
260 );
261
262
263#endif