File: vmifutypes.h

package info (click to toggle)
cpl-plugin-vimos 4.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 28,228 kB
  • sloc: ansic: 169,271; cpp: 16,177; sh: 4,344; python: 3,678; makefile: 1,138; perl: 10
file content (304 lines) | stat: -rw-r--r-- 8,143 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/* $Id: vmifutypes.h,v 1.2 2013-03-25 11:43:04 cgarcia Exp $
 *
 * This file is part of the VIMOS Pipeline
 * Copyright (C) 2002-2004 European Southern Observatory
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/*
 * $Author: cgarcia $
 * $Date: 2013-03-25 11:43:04 $
 * $Revision: 1.2 $
 * $Name: not supported by cvs2svn $
 */

#ifndef VM_IFUTYPES_H
#define VM_IFUTYPES_H

#include <pilmacros.h>

#include <vmimage.h>


PIL_BEGIN_DECLS

/* THESE FUNCTIONS & C. ARE STILL TO BE TESTED */

/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  These are functions for thresholding and detecting adjacent
  pixels on ifu images (Eclipse- like)

------------------------------------------------------------------------------
*/


/* 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  structure VimosPixelData

  Description:
  Linked list structure that contains coords and intensity of a pixel in 
  a region. 
  Created for thresholding an IFU image and looking for adjacent
  "IFU pixels" (VmIfuCalPhot function).
  Original from Eclipse: pixel_position

  Layout:
  int x;
  int y;
  float value;
  VimosPixelData *prev;
  VimosPixelData *next;

  Updates:
  15 Feb 00: Created (AZ)

-------------------------------------------------------------------------------
*/

typedef struct _VIMOS_PIXEL_DATA_ {
  int x;
  int y;
  float value;
  struct _VIMOS_PIXEL_DATA_ *prev;
  struct _VIMOS_PIXEL_DATA_ *next;
} VimosPixelData;



/*
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


  structure VimosPixelList

  Description:
  Linked list structure that stores pixels from a region. 
  Created to be used when thresholding an IFU image and looking for adjacent
  "IFU pixels" (VmIfuCalPhot).
  Original from Eclipse: pixel_list

  Layout:
  int numPixInRegion
  float totIntensity
  VimosPixelData *pixelData
  VimosPixelList *prev;
  VimosPixelList *next;

  Updates:
  15 Feb 00: Created (AZ)

-------------------------------------------------------------------------------
*/

typedef struct _VIMOS_PIXEL_LIST_ {
  int numPixInRegion;
  float totIntensity;
  VimosPixelData *pixelData;
  struct _VIMOS_PIXEL_LIST_ *prev;
  struct _VIMOS_PIXEL_LIST_ *next;
} VimosPixelList;



/* 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  structure VimosPixelRegion

  Description:
  Linked list structure that contains regions of pixels.
  Created to be used when thresholding an IFU image and looking for adjacent
  "IFU pixels".
  More than one region detected above threshold is allowed: just in case two 
  stars fall in the same image, we don't want to lose the right (reference 
  fibre) one.
  Needed by VmIfuCalPhot.

  Layout:
  int numRegions
  VimosPixelList *pixelList
 
  Updates:
  15 Feb 00: Created (AZ)

-------------------------------------------------------------------------------
*/

typedef struct _VIMOS_PIXEL_REGION_ {
  int numRegions;
  VimosPixelList *pixelList;
  struct _VIMOS_PIXEL_REGION_ *prev;
  struct _VIMOS_PIXEL_REGION_ *next;
} VimosPixelRegion;


/* 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  structure VimosPixelAcc

  Description:
  The following structure contains all information necessary for
  recursive search of consistent zones of pixels.  see the functions
  below to have an idea of how it is used. floodfill_from_pixel() is
  recursive get_pixelrank_if_valid() is the checking function is for
  recursive evals.
  Original from Eclipse: pixel_accumulator

  Layout:
  float      accIntensity            accumulated pixelvalues

  int        PixelsInCurrentBlock    number of pixels accumulated so far in 
				     the current consistent block of pixels

  int        imWidth                 image width, necessary to compute 
				     positions in the image 

  int        CurrentRank             rank of the current pixel being examined
				     mostly used to optimize speed 

  int        Total1Pixels            total number of pixels set to 1 in the 
				     currently examined pixel_map 

  int        RemainingPixels         number of pixels which still have to be 
				     examined 

  VimosBool    *ValidPixels          flag per pixel set to 1 in the pixel_map
				     a flag set to TRUE means the pixel has not
				     been associated to a zone which has been 
				     found. If it is set to FALSE, the pixel
				     has already been associated with a white 
				     zone 

  VimosUlong32    *pos               array contains all the positions of the 
				     white pixels in the input image. Positions
				     are not referenced by a couple (x,y) but 
				     by a single number POS = x + ImWidth*y 

  VimosImage *refImage               input image 

  Updates:
  15 Feb 00: Created (AZ)

-------------------------------------------------------------------------------
*/

typedef struct _VIMOS_PIXEL_ACC_
{
  float          accIntensity;
  int            PixelsInCurrentBlock;
  int            imWidth;
  int            CurrentRank;
  int            Total1Pixels;
  int            RemainingPixels;
  VimosBool     *ValidPixels;
  VimosUlong32  *pos;
  VimosImage    *refImage;
} VimosPixelAcc;


VimosPixelData *newPixelData();
void deletePixelData(VimosPixelData *aPixelData);

VimosPixelList *newPixelList();
void deletePixelList(VimosPixelList *aPixelList);

VimosPixelRegion *newPixelRegion();
void deletePixelRegion(VimosPixelRegion *aPixelRegion);






/*
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

   void  thresholdImage(VimosImage *ifuImage, float threshold, 
                     VimosImage *ifuMask, int *ngood)

   Description:
   Write a mask image with only pixels above threshold value.
   Needed for IFU.

   ORIGINAL FROM ECLIPSE: thresh_image_to_pixelmap

   Input: 
   VimosImage ifuImage
   Starting image to be thresholded

   float threshold
   Threshold value

   int ngood
   Number of pixels on the mask above the threshold value
   
   Output:
   VimosImage ifuMask
   Image with "bad" pixels (below threshold) set to "ZERO"

   Return Value:
   void
   
   Updates:
   14 Feb 00: Created (AZ)
-------------------------------------------------------------------------------
*/
void  thresholdImage(VimosImage *ifuImage, float threshold, 
                     VimosImage *ifuMask, int *ngood);



/* 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  VimosPixelRegion *findRegionsOnPixelMap(VimosImage *refImage, 
                                          VimosImage *ifuMask,
                                          VimosPixelRegion *pixRegion,
                                          int ngoodpix)
  Description:
  Find regions of "connected" pixels and store them in a PixelRegion structure.
 
  ORIGINAL FROM ECLIPSE: find_centers_on_pixelmap()

  Input:
  VimosImage *refImage

  VimosImage *ifuMask
  Image with "bad" pixels (below threshold) set to "ZERO"

  VimosPixelRegion *pixRegion

  int ngoodpix

  Updates:
  15 Feb 00: Created (AZ)

-------------------------------------------------------------------------------
*/

VimosPixelRegion *findRegionsOnPixelMap(VimosImage *refImage, 
                                        VimosImage *ifuMask,
                                        VimosPixelRegion *pixRegion,
                                        int ngoodpix);

PIL_END_DECLS

#endif /* VM_IFUTYPES_H */