Kstars

extract.h
1/*
2 This file is part of SEP
3
4 SPDX-FileCopyrightText: 1993-2011 Emmanuel Bertin -- IAP /CNRS/UPMC
5 SPDX-FileCopyrightText: 2014 SEP developers
6
7 SPDX-License-Identifier: LGPL-3.0-or-later
8*/
9
10
11#define UNKNOWN -1 /* flag for LUTZ */
12#define CLEAN_ZONE 10.0 /* zone (in sigma) to consider for processing */
13#define CLEAN_STACKSIZE 3000 /* replaces prefs.clean_stacksize */
14 /* (MEMORY_OBJSTACK in sextractor inputs) */
15#define CLEAN_MARGIN 0 /* replaces prefs.cleanmargin which was set based */
16 /* on stuff like apertures and vignet size */
17#define MARGIN_SCALE 2.0 /* Margin / object height */
18#define MARGIN_OFFSET 4.0 /* Margin offset (pixels) */
19#define MAXDEBAREA 3 /* max. area for deblending (must be >= 1)*/
20#define MAXPICSIZE 1048576 /* max. image size in any dimension */
21
22/* plist-related macros */
23#define PLIST(ptr, elem) (((pbliststruct *)(ptr))->elem)
24#define PLISTEXIST(elem) (plistexist_##elem)
25#define PLISTPIX(ptr, elem) (*((PIXTYPE *)((ptr)+plistoff_##elem)))
26#define PLISTFLAG(ptr, elem) (*((FLAGTYPE *)((ptr)+plistoff_##elem)))
27
28/* Extraction status */
29typedef enum {COMPLETE, INCOMPLETE, NONOBJECT, OBJECT} pixstatus;
30
31/* Temporary object parameters during extraction */
32typedef struct structinfo
33{
34 LONG pixnb; /* Number of pixels included */
35 LONG firstpix; /* Pointer to first pixel of pixlist */
36 LONG lastpix; /* Pointer to last pixel of pixlist */
37 short flag; /* Extraction flag */
38} infostruct;
39
40typedef char pliststruct; /* Dummy type for plist */
41
42typedef struct
43{
44 int nextpix;
45 int x, y;
46 PIXTYPE value;
47} pbliststruct;
48
49/* array buffer struct */
50typedef struct
51{
52 BYTE *dptr; /* pointer to original data, can be any supported type */
53 int dtype; /* data type of original data */
54 int dw, dh; /* original data width, height */
55 PIXTYPE *bptr; /* buffer pointer (self-managed memory) */
56 int bw, bh; /* buffer width, height (bufw can be larger than w due */
57 /* to padding). */
58 PIXTYPE *midline; /* "middle" line in buffer (at index bh/2) */
59 PIXTYPE *lastline; /* last line in buffer */
60 array_converter readline; /* function to read a data line into buffer */
61 int elsize; /* size in bytes of one element in original data */
62 int yoff; /* line index in original data corresponding to bufptr */
63} arraybuffer;
64
65
66/* globals */
67extern int plistexist_cdvalue, plistexist_thresh, plistexist_var;
68extern int plistoff_value, plistoff_cdvalue, plistoff_thresh, plistoff_var;
69extern int plistsize;
70
71typedef struct
72{
73 /* thresholds */
74 float thresh; /* detect threshold (ADU) */
75 float mthresh; /* max. threshold (ADU) */
76
77 /* # pixels */
78 int fdnpix; /* nb of extracted pix */
79 int dnpix; /* nb of pix above thresh */
80 int npix; /* "" in measured frame */
81 int nzdwpix; /* nb of zero-dweights around */
82 int nzwpix; /* nb of zero-weights inside */
83
84 /* position */
85 int xpeak, ypeak; /* pos of brightest pix */
86 int xcpeak,ycpeak; /* pos of brightest pix */
87 double mx, my; /* barycenter */
88 int xmin,xmax,ymin,ymax,ycmin,ycmax; /* x,y limits */
89
90 /* shape */
91 double mx2,my2,mxy; /* variances and covariance */
92 float a, b, theta, abcor; /* moments and angle */
93 float cxx,cyy,cxy; /* ellipse parameters */
94 double errx2, erry2, errxy; /* Uncertainties on the variances */
95
96 /* flux */
97 float fdflux; /* integrated ext. flux */
98 float dflux; /* integrated det. flux */
99 float flux; /* integrated mes. flux */
100 float fluxerr; /* integrated variance */
101 PIXTYPE fdpeak; /* peak intensity (ADU) */
102 PIXTYPE dpeak; /* peak intensity (ADU) */
103 PIXTYPE peak; /* peak intensity (ADU) */
104
105 /* flags */
106 short flag; /* extraction flags */
107
108 /* accessing individual pixels in plist*/
109 int firstpix; /* ptr to first pixel */
110 int lastpix; /* ptr to last pixel */
111} objstruct;
112
113typedef struct
114{
115 int nobj; /* number of objects in list */
116 objstruct *obj; /* pointer to the object array */
117 int npix; /* number of pixels in pixel-list */
118 pliststruct *plist; /* pointer to the pixel-list */
119 PIXTYPE thresh; /* detection threshold */
120} objliststruct;
121
122
123int analysemthresh(int objnb, objliststruct *objlist, int minarea,
124 PIXTYPE thresh);
125void preanalyse(int, objliststruct *);
126void analyse(int, objliststruct *, int, double);
127
128int lutzalloc(int, int);
129void lutzfree(void);
130int lutz(pliststruct *plistin,
131 int *objrootsubmap, int subx, int suby, int subw,
132 objstruct *objparent, objliststruct *objlist, int minarea);
133
134void update(infostruct *, infostruct *, pliststruct *);
135
136int allocdeblend(int);
137void freedeblend(void);
138int deblend(objliststruct *, int, objliststruct *, int, double, int);
139
140/*int addobjshallow(objstruct *, objliststruct *);
141int rmobjshallow(int, objliststruct *);
142void mergeobjshallow(objstruct *, objstruct *);
143*/
144int addobjdeep(int, objliststruct *, objliststruct *);
145
146int convolve(arraybuffer *buf, int y, float *conv, int convw, int convh,
147 PIXTYPE *out);
148int matched_filter(arraybuffer *imbuf, arraybuffer *nbuf, int y,
149 float *conv, int convw, int convh,
150 PIXTYPE *work, PIXTYPE *out, int noise_type);
void update(Part *part, const QByteArray &data, qint64 dataSize)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.