1 | // Classes image typee
|
---|
2 | // E.Aubourg , E. Lesquoy 01-03/95
|
---|
3 | // Modifs R. Ansari 04/95
|
---|
4 |
|
---|
5 | // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
|
---|
6 |
|
---|
7 | // $Id: cimage.cc,v 1.4 1999-04-27 15:03:01 ansari Exp $
|
---|
8 |
|
---|
9 |
|
---|
10 | #include "machdefs.h"
|
---|
11 | #include <string.h>
|
---|
12 | #include <stdio.h>
|
---|
13 |
|
---|
14 | #include "perrors.h"
|
---|
15 | #include "cimage.h"
|
---|
16 | #include "fct1dfit.h"
|
---|
17 | #include "histos.h"
|
---|
18 | #include "nbconst.h"
|
---|
19 | #include "utils.h"
|
---|
20 |
|
---|
21 | /* .............. Classe Image<T> ............... */
|
---|
22 |
|
---|
23 | //++
|
---|
24 | // Class Image<T>
|
---|
25 | // Lib Images++
|
---|
26 | // include cimage.h
|
---|
27 | //
|
---|
28 | //
|
---|
29 | // Classe descendant (heritier) de la classe *RzImage*, permettant
|
---|
30 | // l'instantiation d'objets image avec un typage fort (entier, reel, ...)
|
---|
31 | //
|
---|
32 | // Des objets de type "Image<uint_1>, Image<uint_2>, Image<int_2>, Image<int_4>"
|
---|
33 | // (entier) et "Image<r_4>" (flottant) peuvent etre crees.
|
---|
34 | // Des typedef (*ImageU1*, *ImageU2*, *ImageI2*, *ImageI4*, *ImageR4*)
|
---|
35 | // facilite l'utilisation de ces classes.
|
---|
36 | //--
|
---|
37 | //++
|
---|
38 | // Links Parents
|
---|
39 | // RzImage
|
---|
40 | //--
|
---|
41 | //++
|
---|
42 | // Links Descendants
|
---|
43 | // FitsImage<T>
|
---|
44 | //--
|
---|
45 | //++
|
---|
46 | // Links Voir aussi
|
---|
47 | // DVList
|
---|
48 | //--
|
---|
49 |
|
---|
50 | //++
|
---|
51 | // Titre Constructeurs
|
---|
52 | //--
|
---|
53 |
|
---|
54 | //++
|
---|
55 | // Image<T>(int sizx, sizy, int zero)
|
---|
56 | // Creation d'une image de type "T", de taille "sizx*sizy" pixels.
|
---|
57 | // Si "zero" non nul, tous les pixels de l'image sont mis a zero.
|
---|
58 | // Image<T>(char* flnm)
|
---|
59 | // Cree une image a partir du fichier "flnm". Celui-ci doit etre
|
---|
60 | // au format "PPF" et cree par la methode "Save() ou "Write()".
|
---|
61 | //--
|
---|
62 |
|
---|
63 | template <class T>
|
---|
64 | Image<T>::Image(int sizx, int sizy, int zero)
|
---|
65 | : RzImage(DataType((T)0), sizx, sizy), imagePtr( (T*) voidP )
|
---|
66 | {
|
---|
67 | if (zero) Zero();
|
---|
68 | END_CONSTRUCTOR
|
---|
69 | }
|
---|
70 |
|
---|
71 | /* --Methode-- */
|
---|
72 | template <class T>
|
---|
73 | Image<T>::Image()
|
---|
74 | : RzImage(DataType((T)0)), imagePtr(0)
|
---|
75 | {
|
---|
76 | END_CONSTRUCTOR
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 | /* --Methode-- */
|
---|
81 | template <class T>
|
---|
82 | void Image<T>::Allocate(int sizx, int sizy, int zero, ImgVectP* pvpsh)
|
---|
83 | {
|
---|
84 | RzImage::Allocate(DataType((T)0), sizx, sizy, pvpsh);
|
---|
85 | imagePtr = (T*) voidP;
|
---|
86 | if (!imagePtr) THROW(allocationErr);
|
---|
87 | if (zero) Zero();
|
---|
88 | }
|
---|
89 |
|
---|
90 | template <class T>
|
---|
91 | void Image<T>::SetPixels(int szx, int szy, T* pim)
|
---|
92 | {
|
---|
93 | RzImage::SetPixels(DataType((T)0), szx, szy, pim);
|
---|
94 | imagePtr = pim;
|
---|
95 | }
|
---|
96 |
|
---|
97 | /* --Methode-- */
|
---|
98 | template <class T>
|
---|
99 | Image<T>::~Image()
|
---|
100 | {}
|
---|
101 |
|
---|
102 |
|
---|
103 | //++
|
---|
104 | // Image<T>(const Image<T>& src, int sharePixels)
|
---|
105 | // Constructeur par copie. Fabrique une image identique a l'image "src".
|
---|
106 | // Si "sharePixels" est non nul, le tableau des pixels est commun
|
---|
107 | // aux deux images ("src" et celle creee)
|
---|
108 | // Image<T>(const Image<T>& src, int orgx, int orgy, int sizx, int sizy)
|
---|
109 | // Construit une image de type "T", a partir des pixels de l'image
|
---|
110 | // "src" (du meme type), de taille "sizx*sizy" et de l'origine
|
---|
111 | // "orgx, orgy" dans "src". Si "orgx" et/ou "orgy" sont negatifs,
|
---|
112 | // la taille de la nouvelle image est automatiquement calculee
|
---|
113 | // pour contenir toute l'image source a partir de l'origine specifiee.
|
---|
114 | // Genere l'exception "sizeMismatchErr" en cas d'incompatibilite
|
---|
115 | // taille/origine.
|
---|
116 | //--
|
---|
117 |
|
---|
118 | /* --Methode-- */
|
---|
119 | template <class T>
|
---|
120 | Image<T>::Image(const Image<T>& src, int sharePixels)
|
---|
121 | : RzImage(src, sharePixels)
|
---|
122 | {
|
---|
123 | imagePtr = (T*) voidP;
|
---|
124 | if (!imagePtr) THROW(allocationErr);
|
---|
125 | END_CONSTRUCTOR
|
---|
126 | }
|
---|
127 |
|
---|
128 | /* --Methode-- */
|
---|
129 | template <class T>
|
---|
130 | Image<T>::Image(const Image<T>& src, int orgx, int orgy, int sizx, int sizy)
|
---|
131 | :RzImage()
|
---|
132 | {
|
---|
133 | // A optimiser...
|
---|
134 | if (sizx < 0) sizx = src.XSize()-orgx;
|
---|
135 | if (sizy < 0) sizy = src.YSize()-orgy;
|
---|
136 | if (orgx+sizx > src.XSize() || orgy+sizy > src.YSize())
|
---|
137 | THROW(sizeMismatchErr);
|
---|
138 |
|
---|
139 | Allocate(sizx, sizy);
|
---|
140 | for (int i=0; i<sizx; i++)
|
---|
141 | for (int j=0; j<sizy; j++)
|
---|
142 | (*this)(i,j) = src(i+orgx, j+orgy);
|
---|
143 |
|
---|
144 | SetOrg(src.XOrg()+orgx, src.YOrg()+orgy);
|
---|
145 | SetPxSize(src.XPxSize(), src.YPxSize());
|
---|
146 | END_CONSTRUCTOR
|
---|
147 | }
|
---|
148 |
|
---|
149 | //++
|
---|
150 | // LaTeX Pour contrer un mauvais espacement des paragraphes de LaTeX
|
---|
151 | // \newpage
|
---|
152 | //--
|
---|
153 | //++
|
---|
154 | // Image<T>()
|
---|
155 | // Creation d'une image de type "T" sans allocation du tableau des pixels.
|
---|
156 | // Le tableau des pixels devra etre ensuite alloue par la methode "Allocate()"
|
---|
157 | //--
|
---|
158 |
|
---|
159 | //++
|
---|
160 | // Image<T>(const RzImage& rzimg)
|
---|
161 | // Permet de construire une image typee a partir d'une RzImage ("rzimg")
|
---|
162 | // Le tableau des pixels est commun aux deux images.
|
---|
163 | // Les pixels de l'image "rzimg" doivent etre du type "T", sinon
|
---|
164 | // l'exception "typeMismatchErr" est generee.
|
---|
165 | //--
|
---|
166 | /* --Methode-- */
|
---|
167 | template <class T>
|
---|
168 | Image<T>::Image(const RzImage& rzimg)
|
---|
169 | :RzImage(rzimg,1)
|
---|
170 | {
|
---|
171 |
|
---|
172 | if (rzimg.PixelType() != DataType((T)0))
|
---|
173 | THROW(typeMismatchErr);
|
---|
174 | imagePtr = (T*) voidP;
|
---|
175 | if (!imagePtr) THROW(allocationErr);
|
---|
176 |
|
---|
177 | END_CONSTRUCTOR
|
---|
178 | }
|
---|
179 |
|
---|
180 | //++
|
---|
181 | // void Allocate(int sizx, int sizy, int zero=1, ImgVectP* pvpsh=NULL)
|
---|
182 | // Alloue le tableau des pixels.
|
---|
183 | //--
|
---|
184 | //++
|
---|
185 | // ~Image<T>
|
---|
186 | // Destructeur. supprime le tableau des pixels en memoire si celui-ci
|
---|
187 | // n'est pas utilise par d'autres objets image.
|
---|
188 | //--
|
---|
189 |
|
---|
190 | /* --Methode-- */
|
---|
191 | template <class T>
|
---|
192 | Image<T>::Image(char *flnm)
|
---|
193 | :RzImage(flnm)
|
---|
194 | {
|
---|
195 | imagePtr = (T*) voidP;
|
---|
196 | if (!imagePtr) THROW(allocationErr);
|
---|
197 |
|
---|
198 | END_CONSTRUCTOR
|
---|
199 | }
|
---|
200 |
|
---|
201 |
|
---|
202 | /* --Methode-- */
|
---|
203 | template <class T>
|
---|
204 | void Image<T>::ReadSelf(PInPersist& s)
|
---|
205 | {
|
---|
206 | RzImage::ReadSelf(s);
|
---|
207 | imagePtr = (T*) voidP;
|
---|
208 | }
|
---|
209 |
|
---|
210 | //++
|
---|
211 | // Titre Operateurs
|
---|
212 | // Un grand nombre des operations pouvant etre effectuees sur un
|
---|
213 | // tableau de nombre ont ete defini pour les objets "Image<T>"
|
---|
214 | // Dans les operations faisant intervenir deux images, l'exception
|
---|
215 | // "sizeMismatchErr" est generee si les tailles (en X ou en Y) des
|
---|
216 | // deux images ne sont pas identiques.
|
---|
217 | //--
|
---|
218 |
|
---|
219 | //++
|
---|
220 | // Image<T>& operator= (const Image<T>& rhs)
|
---|
221 | // Copie le contenu (valeurs des pixels) de l'image "rhs".
|
---|
222 | // Si l'image destination (membre gauche de =) n'a pas son
|
---|
223 | // tableau de pixels alloue, celui-ci est cree a une taille
|
---|
224 | // identique a celle de "rhs"
|
---|
225 | // Image<T>& operator= (T val)
|
---|
226 | // Met tous les pixels de l'image a la valeur "val"
|
---|
227 | //--
|
---|
228 |
|
---|
229 | /* --Methode-- */
|
---|
230 | template <class T>
|
---|
231 | Image<T>& Image<T>::operator = (const Image<T>& src)
|
---|
232 | {
|
---|
233 | if (imagePtr) {
|
---|
234 | if (siz_x != src.siz_x || siz_y != src.siz_y)
|
---|
235 | THROW(sizeMismatchErr);
|
---|
236 | } else
|
---|
237 | Allocate(src.siz_x, src.siz_y);
|
---|
238 |
|
---|
239 | (RzImage)(*this) = (RzImage)src;
|
---|
240 | return *this;
|
---|
241 | }
|
---|
242 |
|
---|
243 | /* --Methode-- */
|
---|
244 | template <class T>
|
---|
245 | Image<T>& Image<T>::operator = (T a)
|
---|
246 | {
|
---|
247 | T* pDst = imagePtr;
|
---|
248 | int nPix = siz_x * siz_y;
|
---|
249 |
|
---|
250 | for (int i=0; i<nPix; i++, pDst++)
|
---|
251 | *pDst = a;
|
---|
252 |
|
---|
253 | return *this;
|
---|
254 | }
|
---|
255 |
|
---|
256 | /* --Methode-- */
|
---|
257 | template <class T>
|
---|
258 | void Image<T>::Zero()
|
---|
259 | {
|
---|
260 | memset(imagePtr,0,siz_x * siz_y * sizeof(T));
|
---|
261 | }
|
---|
262 |
|
---|
263 | /* --Methode-- */
|
---|
264 | #if 0 // a la mort de RzImage
|
---|
265 | template <class T>
|
---|
266 | void Image<T>::Clear()
|
---|
267 | {
|
---|
268 | if (imagePtr) {
|
---|
269 | delete[] imagePtr;
|
---|
270 | imagePtr = 0;
|
---|
271 | siz_x = 0;
|
---|
272 | siz_y = 0;
|
---|
273 | }
|
---|
274 | }
|
---|
275 | #endif
|
---|
276 |
|
---|
277 | /* --Methode-- */
|
---|
278 | template <class T>
|
---|
279 | Image<T>& Image<T>::operator+= (Image<T> const& a)
|
---|
280 | {
|
---|
281 | if (siz_x != a.siz_x || siz_y != a.siz_y)
|
---|
282 | THROW(sizeMismatchErr);
|
---|
283 | T* pSrc = a.imagePtr;
|
---|
284 | T* pDst = imagePtr;
|
---|
285 | int nPix = siz_x * siz_y;
|
---|
286 |
|
---|
287 | for (int i=0; i<nPix; i++, pSrc++, pDst++)
|
---|
288 | *pDst = PutInRange((double)*pSrc + (double)*pDst, *pDst);
|
---|
289 |
|
---|
290 | return *this;
|
---|
291 | }
|
---|
292 |
|
---|
293 |
|
---|
294 | /* --Methode-- */
|
---|
295 | template <class T>
|
---|
296 | Image<T>& Image<T>::operator-= (Image<T> const& a)
|
---|
297 | {
|
---|
298 | if (siz_x != a.siz_x || siz_y != a.siz_y)
|
---|
299 | THROW(sizeMismatchErr);
|
---|
300 | T* pSrc = a.imagePtr;
|
---|
301 | T* pDst = imagePtr;
|
---|
302 | int nPix = siz_x * siz_y;
|
---|
303 |
|
---|
304 | for (int i=0; i<nPix; i++, pSrc++, pDst++)
|
---|
305 | *pDst = PutInRange((double)*pDst - (double)*pSrc, *pDst);
|
---|
306 |
|
---|
307 | return *this;
|
---|
308 | }
|
---|
309 |
|
---|
310 | /* --Methode-- */
|
---|
311 | template <class T>
|
---|
312 | Image<T>& Image<T>::operator*= (Image<T> const& a)
|
---|
313 | {
|
---|
314 | if (siz_x != a.siz_x || siz_y != a.siz_y)
|
---|
315 | THROW(sizeMismatchErr);
|
---|
316 | T* pSrc = a.imagePtr;
|
---|
317 | T* pDst = imagePtr;
|
---|
318 | int nPix = siz_x * siz_y;
|
---|
319 |
|
---|
320 | for (int i=0; i<nPix; i++, pSrc++, pDst++)
|
---|
321 | *pDst = PutInRange((double)*pDst * (double)*pSrc, *pDst);
|
---|
322 |
|
---|
323 | return *this;
|
---|
324 | }
|
---|
325 |
|
---|
326 | /* --Methode-- */
|
---|
327 | template <class T>
|
---|
328 | Image<T>& Image<T>::operator/= (Image<T> const& a)
|
---|
329 | {
|
---|
330 | if (siz_x != a.siz_x || siz_y != a.siz_y)
|
---|
331 | THROW(sizeMismatchErr);
|
---|
332 | T* pSrc = a.imagePtr;
|
---|
333 | T* pDst = imagePtr;
|
---|
334 | int nPix = siz_x * siz_y;
|
---|
335 |
|
---|
336 | for (int i=0; i<nPix; i++, pSrc++, pDst++)
|
---|
337 | if (*pSrc)
|
---|
338 | *pDst = PutInRange((double)*pDst / (double)*pSrc, *pDst);
|
---|
339 | else *pDst = (T) MaxRange(*pDst);
|
---|
340 |
|
---|
341 | return *this;
|
---|
342 | }
|
---|
343 |
|
---|
344 | //++
|
---|
345 | // Image<T>& operator += -= *= /= (Image<T> const& rhs)
|
---|
346 | // Ajoute (+=), soustrait(-=), multiplie(*=), divise(/=) les valeurs des pixels
|
---|
347 | // de l'image a gauche de l'operateur par les pixels correspondants
|
---|
348 | // de l'image a droite de l'operateur ("rhs")
|
---|
349 | // Image<T>& operator += -= *= /= (double crhs)
|
---|
350 | // Ajoute (+=), soustrait(-=), multiplie(*=), divise(/=) les valeurs des pixels
|
---|
351 | // de l'image a gauche de l'operateur par la constante "crhs"
|
---|
352 | //--
|
---|
353 |
|
---|
354 |
|
---|
355 | /* --Methode-- */
|
---|
356 | template <class T>
|
---|
357 | Image<T>& Image<T>::operator+= (double a)
|
---|
358 | {
|
---|
359 | T* pDst = imagePtr;
|
---|
360 | int nPix = siz_x * siz_y;
|
---|
361 |
|
---|
362 | for (int i=0; i<nPix; i++, pDst++)
|
---|
363 | *pDst = PutInRange((double)*pDst + a, *pDst);
|
---|
364 |
|
---|
365 | return *this;
|
---|
366 | }
|
---|
367 |
|
---|
368 | /* --Methode-- */
|
---|
369 | template <class T>
|
---|
370 | Image<T>& Image<T>::operator-= (double a)
|
---|
371 | {
|
---|
372 | T* pDst = imagePtr;
|
---|
373 | int nPix = siz_x * siz_y;
|
---|
374 |
|
---|
375 | for (int i=0; i<nPix; i++, pDst++)
|
---|
376 | *pDst = PutInRange((double)*pDst - a, *pDst);
|
---|
377 |
|
---|
378 | return *this;
|
---|
379 | }
|
---|
380 |
|
---|
381 | /* --Methode-- */
|
---|
382 | template <class T>
|
---|
383 | Image<T>& Image<T>::operator*= (double a)
|
---|
384 | {
|
---|
385 | T* pDst = imagePtr;
|
---|
386 | int nPix = siz_x * siz_y;
|
---|
387 |
|
---|
388 | for (int i=0; i<nPix; i++, pDst++)
|
---|
389 | *pDst = PutInRange((double)*pDst * a, *pDst);
|
---|
390 |
|
---|
391 | return *this;
|
---|
392 | }
|
---|
393 |
|
---|
394 |
|
---|
395 | /* --Methode-- */
|
---|
396 | template <class T>
|
---|
397 | Image<T>& Image<T>::operator/= (double a)
|
---|
398 | {
|
---|
399 | T* pDst = imagePtr;
|
---|
400 | int nPix = siz_x * siz_y;
|
---|
401 |
|
---|
402 | for (int i=0; i<nPix; i++, pDst++)
|
---|
403 | *pDst = PutInRange((double)*pDst / a, *pDst);
|
---|
404 |
|
---|
405 | return *this;
|
---|
406 | }
|
---|
407 |
|
---|
408 |
|
---|
409 |
|
---|
410 | //++
|
---|
411 | // Image<T> operator + - * / (Image<T> const& a, Image<T> const& b)
|
---|
412 | // Ajoute, soustrait, multiplie, divise les pixels des deux
|
---|
413 | // images "a" et "b" et l'affecte a gauche de l'operateur egal.
|
---|
414 | // operator + - * / (Image<T> const& a, double cb)
|
---|
415 | // Ajoute, soustrait, multiplie, divise le contenu de l'image "a"
|
---|
416 | // par la constante "cb" et l'affecte a l'image a gauche de l'operateur = .
|
---|
417 | //
|
---|
418 | // Il est preferable d'utiliser dans la mesure du possible, les
|
---|
419 | // operateurs "+=", "-=", "*=", "/=" afin d'eviter des copies
|
---|
420 | // inutiles.
|
---|
421 | //
|
---|
422 | // *Exemples:*
|
---|
423 | //| // Creation des images
|
---|
424 | //| ImageR4 ai(200,300), bi, ci;
|
---|
425 | //| // Tous les pixels a 238.5
|
---|
426 | //| ai = 238.5;
|
---|
427 | //| // Image bi meme taille, meme valeurs de pixels que ai
|
---|
428 | //| bi = ai;
|
---|
429 | //| // On soustrait 13.2 a tous les pixels de ai
|
---|
430 | //| ai -= 13.2;
|
---|
431 | //| // Je divise bi par ai (pixel par pixel) qu'on affecte a bi
|
---|
432 | //| bi /= ai;
|
---|
433 | //| // On somme ai et bi (pixel par pixel) qu'on affecte a ci
|
---|
434 | //| ci = ai + bi;
|
---|
435 | //--
|
---|
436 |
|
---|
437 |
|
---|
438 | /* --Methode-- */
|
---|
439 | template <class T>
|
---|
440 | Image<T> Image<T>::WhereNonZero()
|
---|
441 | {
|
---|
442 | Image<T> c(*this);
|
---|
443 | for (int i=0; i<XSize(); i++)
|
---|
444 | for (int j=0; j<YSize(); j++)
|
---|
445 | c(i,j) = c(i,j) ? 1 : 0;
|
---|
446 | return c;
|
---|
447 | }
|
---|
448 |
|
---|
449 | //++
|
---|
450 | // void PrintImage(ostream& os) const
|
---|
451 | // Envoie le contenu de l'image (formatte, texte) sur le
|
---|
452 | // flot (stream) de sortie "os".
|
---|
453 | // Attention: Ca peut faire beaucoup de ligne !
|
---|
454 | // void PrintImage() const
|
---|
455 | // Appel a PrintImage(cout) - Sortie sur cout .
|
---|
456 | //--
|
---|
457 |
|
---|
458 |
|
---|
459 | /* --Methode-- */
|
---|
460 | template <class T>
|
---|
461 | void Image<T>::PrintImage(ostream& os) const
|
---|
462 | // Impression de tout le contenu de l'image
|
---|
463 | {
|
---|
464 | #define PrPvLn 10
|
---|
465 | #define PrSize 6
|
---|
466 | int i,j,k,ido,ideb,ifin;
|
---|
467 | int siz_x,siz_y;
|
---|
468 |
|
---|
469 | siz_x= XSize();
|
---|
470 | siz_y= YSize();
|
---|
471 |
|
---|
472 | os << " Image::PrintImage: type pixel " ;
|
---|
473 | os << DataName(dataType) ;
|
---|
474 | os << ", NbPix=("<<siz_x<<","<<siz_y<<") \n";
|
---|
475 |
|
---|
476 |
|
---|
477 | /* segmentation avec des lignes de PrPvLn valeurs */
|
---|
478 |
|
---|
479 | ido = (siz_x-1) / PrPvLn + 1;
|
---|
480 |
|
---|
481 | char buff[256];
|
---|
482 |
|
---|
483 | for(k=0;k<ido;k++)
|
---|
484 | {
|
---|
485 | ideb = k*PrPvLn;
|
---|
486 | ifin = ideb + PrPvLn;
|
---|
487 | if ( ifin >siz_x ) ifin = siz_x ;
|
---|
488 | sprintf(buff, " ---- colonnes %d a %d ----\n",ideb,ifin-1);
|
---|
489 | os << buff ;
|
---|
490 | for(j=0; j<siz_y; j++)
|
---|
491 | {
|
---|
492 | sprintf(buff, "%3d - ",j);
|
---|
493 | os << buff;
|
---|
494 | for (i=ideb; i<ifin; i++)
|
---|
495 | {
|
---|
496 | os.width(PrSize);
|
---|
497 | // les uint_1 sont traites comme characteres par les ostream ...
|
---|
498 | if (PixelType() == kuint_1) os << ((int)((*this)(i,j))) << " ";
|
---|
499 | else os << (*this)(i,j) << " ";
|
---|
500 | }
|
---|
501 | os << endl;
|
---|
502 | }
|
---|
503 | }
|
---|
504 |
|
---|
505 | return;
|
---|
506 | }
|
---|
507 |
|
---|
508 |
|
---|
509 | //++
|
---|
510 | // Titre Acces aux pixels
|
---|
511 | //--
|
---|
512 | //++
|
---|
513 | // T& operator() (int x, int y)
|
---|
514 | // Acces au pixel "(x,y)" de l'image (lecture/ecriture)
|
---|
515 | // T& operator[] (int i)
|
---|
516 | // Acces au pixel numero "i" de l'image (lecture/ecriture)
|
---|
517 | //
|
---|
518 | //| ImageU2 img(100,100);
|
---|
519 | //| int i,j,k;
|
---|
520 | //| // Remplissage de la moitie de l'image
|
---|
521 | //| for(k=0; k<100*50; k++) img[k] = k%500;
|
---|
522 | //| img(50, 10); // Valeur du pixel (50, 10)
|
---|
523 | //
|
---|
524 | // T* ImagePtr()
|
---|
525 | // Renvoie un pointeur du type "T (uint_2, r_4, ...)" sur le
|
---|
526 | // tableau des pixels de l'image. A n'utiliser que si un reelle
|
---|
527 | // optimisation de l'acces aux pixels peut etre effectuee.
|
---|
528 | //--
|
---|
529 |
|
---|
530 |
|
---|
531 |
|
---|
532 | //++
|
---|
533 | // Titre Traitements simples
|
---|
534 | //--
|
---|
535 | //++
|
---|
536 | // int CheckDyn(double min=-9.e19, double max=9.e19)
|
---|
537 | // Cette methode retourne le nombre de pixels hors dynamique "( <min ou >max )"
|
---|
538 | // Met a jour les donnees membres "min/maxPix nbNul/Sat".
|
---|
539 | // Calcule aussi la moyenne et le sigma des pixels -> "moyPix, sigPix"
|
---|
540 | // Implementation plus efficace de la methode "RzImage::CheckDyn()"
|
---|
541 | //--
|
---|
542 |
|
---|
543 | /* --Methode-- */
|
---|
544 | template <class T>
|
---|
545 | int Image<T>::CheckDyn(double min, double max)
|
---|
546 |
|
---|
547 | /* Cette methode retourne le nombre de pixels hors dynamique */
|
---|
548 | /* ds le pave ( <min ou >max ) */
|
---|
549 | /* Met a jour la structure image Min/MaxPix nbNul/Sat */
|
---|
550 | /* Calcule aussi la moyenne et le sigma des pixels, met a jour */
|
---|
551 | /* moypix et sigpix dans la structure */
|
---|
552 |
|
---|
553 | {
|
---|
554 | T pixv=0;
|
---|
555 | double dv;
|
---|
556 |
|
---|
557 | T minadu = PutInRange(min, pixv);
|
---|
558 | T maxadu = PutInRange(max, pixv);
|
---|
559 | T minpix = PutInRange(maxadu+1, pixv);
|
---|
560 | T maxpix = PutInRange(minadu-1, pixv);
|
---|
561 |
|
---|
562 | double m = 0.;
|
---|
563 | double s = 0.;
|
---|
564 | int n9 = 0;
|
---|
565 | int n0 = 0;
|
---|
566 | int n = XSize()*YSize();
|
---|
567 | for(int i=0; i<n; i++)
|
---|
568 | {
|
---|
569 | pixv = imagePtr[i];
|
---|
570 | if (pixv <= maxadu && pixv >= minadu)
|
---|
571 | {
|
---|
572 | if (pixv < minpix) minpix = pixv;
|
---|
573 | else if (pixv > maxpix) maxpix = pixv;
|
---|
574 | dv = (double)pixv;
|
---|
575 | m += dv; s += (dv*dv);
|
---|
576 | }
|
---|
577 | else
|
---|
578 | {
|
---|
579 | if (pixv > maxadu) n9++;
|
---|
580 | if (pixv < minadu) n0++;
|
---|
581 | }
|
---|
582 | }
|
---|
583 |
|
---|
584 | nbNul = n0;
|
---|
585 | nbSat = n9;
|
---|
586 | minPix = minpix;
|
---|
587 | maxPix = maxpix;
|
---|
588 |
|
---|
589 | n -= (n0+n9);
|
---|
590 | if (n > 0)
|
---|
591 | { dv = (double)n; m /= dv; s = s/dv - m*m;
|
---|
592 | if (s>0.) s = sqrt(s); else s = 0.;
|
---|
593 | moyPix = m; sigPix = s; }
|
---|
594 | else { moyPix = 0.; sigPix = -1.; }
|
---|
595 |
|
---|
596 | return(n0+n9);
|
---|
597 | }
|
---|
598 |
|
---|
599 | //++
|
---|
600 | // SeuilBas(double seuil, double val)
|
---|
601 | // Met les pixels en dessous du "seuil" (< seuil) a la valeur "val".
|
---|
602 | // SeuilBas(double seuil)
|
---|
603 | // Met les pixels en dessous du "seuil" (< seuil) a zero
|
---|
604 | // SeuilHaut(double seuil, double val)
|
---|
605 | // Met les pixels au dessus du "seuil" (> seuil) a la valeur "val".
|
---|
606 | // SeuilHaut(double seuil)
|
---|
607 | // Met les pixels au dessus du "seuil" (> seuil) a zero
|
---|
608 | //--
|
---|
609 |
|
---|
610 | /* --Methode-- */
|
---|
611 | template <class T>
|
---|
612 | void Image<T>::SeuilBas(double seuil, double val)
|
---|
613 |
|
---|
614 | /* Met a une valeur definie tous les pixels */
|
---|
615 | /* en dessous du seuil */
|
---|
616 |
|
---|
617 | {
|
---|
618 | if (!ImagePtr()) THROW(nullPtrErr);
|
---|
619 | T* PtPix=ImagePtr();
|
---|
620 | int nPix=XSize()*YSize();
|
---|
621 | for(int i=0 ; i<nPix;i++,PtPix++) {if(*PtPix < (T) seuil) *PtPix = (T) val;};
|
---|
622 | }
|
---|
623 |
|
---|
624 | /* --Methode-- */
|
---|
625 | template <class T>
|
---|
626 | void Image<T>::SeuilHaut(double seuil, double val)
|
---|
627 |
|
---|
628 | /* Met a une valeur definie tous les pixels */
|
---|
629 | /* en dessus du seuil */
|
---|
630 |
|
---|
631 | {
|
---|
632 | if (!ImagePtr()) THROW(nullPtrErr);
|
---|
633 | T* PtPix=ImagePtr();
|
---|
634 | int nPix=XSize()*YSize();
|
---|
635 | for(int i=0 ; i<nPix;i++,PtPix++) {if(*PtPix > (T) seuil) *PtPix = (T) val;};
|
---|
636 | }
|
---|
637 |
|
---|
638 | /* --Methode-- */
|
---|
639 | template <class T>
|
---|
640 | void Image<T>::SeuilBas(double seuil)
|
---|
641 | {
|
---|
642 | SeuilBas(seuil,seuil);
|
---|
643 | }
|
---|
644 |
|
---|
645 | /* --Methode-- */
|
---|
646 | template <class T>
|
---|
647 | void Image<T>::SeuilHaut(double seuil)
|
---|
648 | {
|
---|
649 | SeuilHaut(seuil,seuil);
|
---|
650 | }
|
---|
651 |
|
---|
652 | /* --Methode-- (cmv 23/09/96) */
|
---|
653 | template <class T>
|
---|
654 | //++
|
---|
655 | void Image<T>::HBinInt(int& nbin,float& xmin,float& xmax)
|
---|
656 | //
|
---|
657 | // Valeur pour avoir un bin entier quand on fait un
|
---|
658 | // histogramme 1D des pixels (pour les images entieres).
|
---|
659 | //--
|
---|
660 | {
|
---|
661 | if( PixelType()<kuint_2 || PixelType()>kint_4 ) return;
|
---|
662 | double binw = (xmax-xmin)/nbin;
|
---|
663 | binw = (double) ( (int)(binw+0.5) );
|
---|
664 | if( binw <= 0. ) binw = 1.;
|
---|
665 | xmin = (float) ( (int) xmin );
|
---|
666 | xmax = (float) ( (int) (xmax + binw) );
|
---|
667 | nbin = (int)( (xmax-xmin)/binw + 0.1 );
|
---|
668 | }
|
---|
669 |
|
---|
670 | /* --Methode-- (cmv 23/09/96) */
|
---|
671 | template <class T>
|
---|
672 | //++
|
---|
673 | int Image<T>::EstimeFdSg(float& xbmax,float& sgbmax
|
---|
674 | ,float nbsig,float frac,float lowbad,float highbad,int deb)
|
---|
675 | //
|
---|
676 | // Pour donner une estimation du fond de ciel et du sigma ciel.
|
---|
677 | // Il est conseille de faire ceci sur une image partielle.
|
---|
678 | // Une premiere estimation du fond et du sigma est faite en nettoyant
|
---|
679 | // iterativement (cf MoySigmaIter).
|
---|
680 | // Puis un histogramme est rempli et rebinne jusqu'a ce que son maximum
|
---|
681 | // soit statistiquement significatif. Le fond et le sigma sont ensuite
|
---|
682 | // calcules par les methodes `FitMax' et `EstimeWidthS' de la classe Histo.
|
---|
683 | //| xbmax = position du maximum
|
---|
684 | //| sgbmax = valeur du sigma
|
---|
685 | //| nbsig = dimensionnement de l'histo de depart en nombre
|
---|
686 | //| de sigma autour de la valeur maximum
|
---|
687 | //| frac = valeur maximum principale / maximum secondaire a partir
|
---|
688 | //| de laquelle on considere qu'elle a une signification
|
---|
689 | //| statistique.
|
---|
690 | //| lowbad,highbad = dynamique utile de l'image traitee
|
---|
691 | //| deb = niveau de debug
|
---|
692 | //| Return : 0 = OK, -1 = echec MoySigmaIter, -2 = echec FitMax,
|
---|
693 | //| -3 = echec FindWidth
|
---|
694 | //--
|
---|
695 | {
|
---|
696 | T pixv=0;
|
---|
697 | T minadu = PutInRange((double) lowbad , pixv);
|
---|
698 | T maxadu = PutInRange((double) highbad, pixv);
|
---|
699 | bool testl = (lowbad<highbad) ? true : false;
|
---|
700 | lowbad = (float) minadu; highbad = (float) maxadu;
|
---|
701 |
|
---|
702 | if(deb<0) deb=0;
|
---|
703 | int envd = 0;
|
---|
704 | GetIntEnv("PDEBUG_FOND", envd);
|
---|
705 | if (deb < envd) deb = envd;
|
---|
706 |
|
---|
707 | // moyenne et sigma bruts (iteratifs)
|
---|
708 | int rc;
|
---|
709 | float fd,sg;
|
---|
710 | rc = MoySigmaIter(fd,sg,lowbad,highbad,1,5,0.1,3.5,deb-1);
|
---|
711 | if(deb>0) cout<<"EstimeFdSg: MoySigmaIter rc="<<rc<<" fd="<<fd<<" sg="<<sg<<endl;
|
---|
712 | if(rc<=0) return -1;
|
---|
713 |
|
---|
714 | // remplissage histogramme avec beaucoup de bins
|
---|
715 | int nbin;
|
---|
716 | float xmin,xmax;
|
---|
717 | xmin = fd - nbsig*sg; if(testl && xmin<lowbad ) xmin = lowbad;
|
---|
718 | xmax = fd + nbsig*sg; if(testl && xmax>highbad) xmax = highbad;
|
---|
719 | nbin = XSize()*YSize()/20; if(nbin>2000) nbin=2000;
|
---|
720 | Histo H(xmin,xmax,nbin);
|
---|
721 | for(int i=0;i<XSize()*YSize();i++) H.Add((float) (*this)[i],1.);
|
---|
722 |
|
---|
723 | // redimensionnement de l'histo pour avoir une bonne signification stat.
|
---|
724 | for(;;) {
|
---|
725 | float max1,max2;
|
---|
726 | int imax1,imax2;
|
---|
727 | rc = H.MaxiLocal(max1,imax1,max2,imax2);
|
---|
728 | float rap = 1.;
|
---|
729 | if( max1 != 0. ) rap = max2/max1;
|
---|
730 | // if(nbin<100) H.Print(80);
|
---|
731 | if(deb>1)
|
---|
732 | cout<<"nbin="<<nbin
|
---|
733 | <<" maxloc="<<rc
|
---|
734 | <<" maxi="<<max1<<" imax="<<imax1<<" xmax="<<H.BinCenter(imax1)
|
---|
735 | <<" maxn="<<max2<<" imaxn="<<imax2<<" xmaxn="<<H.BinCenter(imax2)
|
---|
736 | <<" -> "<<rap<<endl;
|
---|
737 | if( rap<frac || nbin<=10 ) break;
|
---|
738 | nbin = (int)(nbin/1.5);
|
---|
739 | H.HRebin(nbin);
|
---|
740 | }
|
---|
741 | if(deb>1) { if(nbin<250) H.Print(80); else H.Print(80,-1.,1.,-1);}
|
---|
742 |
|
---|
743 | TRY {
|
---|
744 | xbmax = H.FitMax(2,0.5f,deb-2);
|
---|
745 | if(deb>1) cout<<"H.FitMax = "<<xbmax<<endl;
|
---|
746 | } CATCHALL {
|
---|
747 | if(deb) cout<< "Echec H.FitMax"<< endl;
|
---|
748 | return(-2);
|
---|
749 | } ENDTRY
|
---|
750 |
|
---|
751 | TRY {
|
---|
752 | float sdroit = -2.;
|
---|
753 | H.EstimeWidthS(0.5f,sgbmax,sdroit);
|
---|
754 | if(sgbmax<=0.) sgbmax = H.FindWidth(0.5f,deb-2);
|
---|
755 | sgbmax /= 2.36;
|
---|
756 | if(deb>1) cout<<"H.FindWidth = "<<sgbmax<<" (droit="<<sdroit<<")"<<endl;
|
---|
757 | } CATCHALL {
|
---|
758 | cout<< "Echec H.FindWidth"<< endl;
|
---|
759 | return(-3);
|
---|
760 | } ENDTRY
|
---|
761 |
|
---|
762 | return 0;
|
---|
763 | }
|
---|
764 |
|
---|
765 | /* --Methode-- (cmv 23/09/96) */
|
---|
766 | template <class T>
|
---|
767 | //++
|
---|
768 | float Image<T>::FondCiel(int nbin,float bin_low,float bin_high
|
---|
769 | ,int degre,float frac,int modu,int deb)
|
---|
770 | //
|
---|
771 | // Calcul du fond de ciel:
|
---|
772 | // Remplissage d'un histogramme avec le contenu des pixels du pave,
|
---|
773 | // recherche du bin contenant le maximum,
|
---|
774 | // recheche des limites a frac% de chaque cote du maximum
|
---|
775 | // et fit d'un polynome du 2sd ou 3ieme degre dans cette zone.
|
---|
776 | //| Input:
|
---|
777 | //| nbin,bin_low,bin_high : definition de l'histogramme
|
---|
778 | //| degre : degre du fit (2 ou 3)
|
---|
779 | //| frac : definition de la zone de fit a frac% du maximum
|
---|
780 | //| modu : on prend 1 px sur modu
|
---|
781 | //| deb : debug flag
|
---|
782 | //| Output: renvoie le maximum de l'histogramme (fond de ciel)
|
---|
783 | //| et update le membre protected fond (si succes)
|
---|
784 | //--
|
---|
785 | {
|
---|
786 | T pixv;
|
---|
787 |
|
---|
788 | if(modu<=0) modu = 1;
|
---|
789 | if(frac<=0.) frac = 0.5;
|
---|
790 | if(degre<2 || degre>3) degre = 2;
|
---|
791 | if(deb>0)
|
---|
792 | printf("Image::FondCiel: nbin=%d dyn=%g,%g deg=%d frac=%g modu=%d\n"
|
---|
793 | ,nbin,bin_low,bin_high,degre,frac,modu);
|
---|
794 | if(nbin<=degre) THROW(inconsistentErr);
|
---|
795 |
|
---|
796 | TRY {
|
---|
797 |
|
---|
798 | Histo tab(bin_low,bin_high,nbin);
|
---|
799 | double sum = 0.;
|
---|
800 | volatile int n = 0, nsum = 0;
|
---|
801 | for(int i=0;i<XSize()*YSize();i++) {
|
---|
802 | n++;
|
---|
803 | if( n%modu != 0 ) continue;
|
---|
804 | pixv = imagePtr[i];
|
---|
805 | tab.Add( (float) pixv );
|
---|
806 | sum += (double) pixv;
|
---|
807 | nsum++;
|
---|
808 | }
|
---|
809 | if(deb>1) { int im = tab.IMax();
|
---|
810 | tab.Print(80,1.,-1.,0,im-50,im+50); }
|
---|
811 |
|
---|
812 | float xf = 0.;
|
---|
813 | // tout dans moins de degre bins
|
---|
814 | if( tab.BinNonNul() <= degre ) {
|
---|
815 | if(nsum<=0) THROW(inconsistentErr);
|
---|
816 | xf = sum / (double) nsum;
|
---|
817 | if(deb>0) printf("%d bins <= %d -> Succes Mean = %g\n"
|
---|
818 | ,tab.BinNonNul(),degre,xf);
|
---|
819 | fond = xf;
|
---|
820 | RETURN(xf);
|
---|
821 | }
|
---|
822 |
|
---|
823 | TRY {
|
---|
824 | xf = tab.FitMax(degre,frac,deb-1);
|
---|
825 | if(deb>0) printf("Succes tab.FitMax = %g\n",xf);
|
---|
826 | fond = xf;
|
---|
827 | RETURN(xf);
|
---|
828 | } CATCHALL {
|
---|
829 | if(deb>0)
|
---|
830 | printf("Echec tab.FitMax BinNonNul=%d\n",tab.BinNonNul());
|
---|
831 | THROW(inconsistentErr);
|
---|
832 | } ENDTRY
|
---|
833 |
|
---|
834 | } CATCHALL {
|
---|
835 | THROW_SAME;
|
---|
836 | } ENDTRY
|
---|
837 | }
|
---|
838 |
|
---|
839 | /* --Methode-- (cmv 23/09/96) */
|
---|
840 | template <class T>
|
---|
841 | //++
|
---|
842 | float Image<T>::SigmaCiel(int nbin,float bin_low,float bin_high
|
---|
843 | ,float& means,float lowbad,float highbad
|
---|
844 | ,float nsig,int modu,int deb)
|
---|
845 | //
|
---|
846 | // Calcul du sigma du fond de ciel:
|
---|
847 | // Remplissage d'un histogramme avec px-<px8> pour les pixels
|
---|
848 | // entre lowbad et highbad (px=valeur du pixel etudie,
|
---|
849 | // <px8>=moyenne des 8 pixels qui lui sont contigus).
|
---|
850 | // Une premiere estimation du sigma (s1) et realisee en cherchant
|
---|
851 | // la largeur a mi-hauteur de cet histogramme. Puis un fit non-lineaire
|
---|
852 | // d'une gaussienne est effectue dans +/- nsig*s1
|
---|
853 | //| Input:
|
---|
854 | //| nbin,bin_low,bin_high : definition de l'histogramme
|
---|
855 | //| lowbad,highbad : limites des pixels a utiliser
|
---|
856 | //| nsig : la zone de fit est definie a +/- nsig*sigma du maximum
|
---|
857 | //| modu : on prend 1 px sur modu
|
---|
858 | //| deb : debug flag
|
---|
859 | //| Output:
|
---|
860 | //| means = moyenne fittee de l'histogramme (normalement -> 0)
|
---|
861 | //| renvoie le sigma du fond de ciel
|
---|
862 | //| et update le membre protected sigmaFond (si succes)
|
---|
863 | //--
|
---|
864 | {
|
---|
865 | T pixv=0;
|
---|
866 | T minadu = PutInRange((double) lowbad , pixv);
|
---|
867 | T maxadu = PutInRange((double) highbad, pixv);
|
---|
868 | volatile bool testl = (lowbad<highbad) ? true : false;
|
---|
869 |
|
---|
870 | if(nbin<5) THROW(inconsistentErr);
|
---|
871 | if(nsig<=0.) nsig = 4.;
|
---|
872 | if(modu<=0) modu = 1;
|
---|
873 | means = 0.;
|
---|
874 | if(deb>0)
|
---|
875 | cout << "SigmaCiel( nbin=" << nbin
|
---|
876 | << ", bin_low=" << bin_low
|
---|
877 | << ", bin_high=" << bin_high
|
---|
878 | << ", lowbad=" << lowbad
|
---|
879 | << ", highbad=" << highbad
|
---|
880 | << ", nsig=" << nsig
|
---|
881 | << ", modu=" << modu
|
---|
882 | << ", deb=" << deb << endl;
|
---|
883 |
|
---|
884 | // coeff pour corriger le sigma de (S-<S8>) par rapport au sigma de S
|
---|
885 | // sigma(S) = sigma(S-<S8>) * 1/sqrt(1+1/8) = 2*sqrt(2)/3
|
---|
886 | double coeff = 2.*Rac2/3.;
|
---|
887 |
|
---|
888 | TRY {
|
---|
889 |
|
---|
890 | Histo tab(bin_low,bin_high,nbin);
|
---|
891 | tab.Errors();
|
---|
892 |
|
---|
893 | int nmod = 0, nsum = 0;
|
---|
894 | double sum= 0., sum2 = 0.;
|
---|
895 | for(int j=1;j<YSize()-1;j++) for(int i=1;i<XSize()-1;i++) {
|
---|
896 | nmod++;
|
---|
897 | if( nmod%modu != 0 ) continue;
|
---|
898 | pixv = (*this)(i,j);
|
---|
899 | if ( testl && (pixv < minadu || pixv > maxadu) ) continue;
|
---|
900 | double vp = (double) pixv;
|
---|
901 | double pxv = 0.;
|
---|
902 | volatile int n = 0;
|
---|
903 | for(int j1=j-1;j1<=j+1;j1++) for(int i1=i-1;i1<=i+1;i1++) {
|
---|
904 | if ( i1 == i && j1 == j ) continue;
|
---|
905 | pixv = (*this)(i1,j1);
|
---|
906 | if ( testl && (pixv < minadu || pixv > maxadu) ) continue;
|
---|
907 | pxv += (double) pixv;
|
---|
908 | n++;
|
---|
909 | }
|
---|
910 | if ( n != 8 ) continue;
|
---|
911 | vp = vp - pxv/(double) n;
|
---|
912 | tab.Add( (float) vp );
|
---|
913 | nsum++;
|
---|
914 | sum += vp;
|
---|
915 | sum2 += vp*vp;
|
---|
916 | }
|
---|
917 |
|
---|
918 | float ms = tab.BinCenter( tab.IMax() );
|
---|
919 | volatile float sg = 0.;
|
---|
920 | if( tab.BinNonNul() == 1 ) {
|
---|
921 | if(deb>0) cout << tab.BinNonNul()
|
---|
922 | << " bins non nul dans l'histogramme" << endl;
|
---|
923 | if(nsum<=1) THROW(inconsistentErr);
|
---|
924 | sum /= (double) nsum;
|
---|
925 | sum2 = sum2/(double) nsum - sum*sum;
|
---|
926 | if(sum2<0.) THROW(inconsistentErr);
|
---|
927 | means = sum;
|
---|
928 | sum2 = sqrt(sum2) * coeff;
|
---|
929 | sigmaFond = sum2;
|
---|
930 | RETURN((float) sum2);
|
---|
931 | } else {
|
---|
932 | TRY {
|
---|
933 | sg = tab.FindWidth(0.5,deb-1) / 2.36;
|
---|
934 | } CATCHALL {
|
---|
935 | THROW_SAME;
|
---|
936 | } ENDTRY
|
---|
937 | }
|
---|
938 | double h = tab.VMax();
|
---|
939 | if(deb>0) cout << "from histo: ms=" << ms
|
---|
940 | << " sg=" << sg
|
---|
941 | << " h=" << h << endl;
|
---|
942 |
|
---|
943 | float xmin = ms - nsig*sg;
|
---|
944 | float xmax = ms + nsig*sg;
|
---|
945 | int imin = tab.FindBin(xmin);
|
---|
946 | int imax = tab.FindBin(xmax);
|
---|
947 | if( imax-imin+1 < 4 ) {imax++; imin--;}
|
---|
948 | if(imin<0) imin=0;
|
---|
949 | if(imax>=tab.NBins()) imax=tab.NBins()-1;
|
---|
950 | int nb = imax-imin+1;
|
---|
951 | if( nb < 4 ) THROW(inconsistentErr);
|
---|
952 | if(deb>0) printf("xrange=[%g,%g] irange=[%d,%d] nb=%d\n"
|
---|
953 | ,xmin,xmax,imin,imax,nb);
|
---|
954 | if(deb>2) tab.Print(80,1.,-1.,0,imin,imax);
|
---|
955 |
|
---|
956 | Gauss1DPol myfunc;
|
---|
957 | GeneralFit myfit(&myfunc);
|
---|
958 | GeneralFitData mydata(1,nb);
|
---|
959 | for(int i=imin;i<=imax;i++) {
|
---|
960 | float e = tab.Error(i);
|
---|
961 | if( e <= 0. ) e = 1.;
|
---|
962 | mydata.AddData1(tab.BinCenter(i),tab(i),e);
|
---|
963 | }
|
---|
964 |
|
---|
965 | myfit.SetData(&mydata);
|
---|
966 | myfit.SetParam(0,h,h/50.);
|
---|
967 | myfit.SetParam(1,ms,sg/10.);
|
---|
968 | myfit.SetParam(2,sg,sg/10.);
|
---|
969 | myfit.SetBound(2,0.,sg*5.);
|
---|
970 | int rc = myfit.Fit();
|
---|
971 | if(rc<0) THROW(inconsistentErr);
|
---|
972 | if(deb>1) myfit.PrintFit();
|
---|
973 |
|
---|
974 | means = myfit.GetParm(1);
|
---|
975 | sum2 = myfit.GetParm(2) * coeff;
|
---|
976 | sigmaFond = sum2;
|
---|
977 | RETURN((float) sum2);
|
---|
978 |
|
---|
979 | } CATCHALL {
|
---|
980 | THROW_SAME;
|
---|
981 | } ENDTRY
|
---|
982 |
|
---|
983 | }
|
---|
984 |
|
---|
985 |
|
---|
986 | /* --Methode-- (cmv 23/09/96) */
|
---|
987 | template <class T>
|
---|
988 | //++
|
---|
989 | int Image<T>::MoySigma(float& mean,float& sigma,float lowbad,float highbad,int modu)
|
---|
990 | //
|
---|
991 | // Calcul de la moyenne (mean) et du sigma (sigma) dans un pave
|
---|
992 | // en ne considerant que les pixels compris entre lowbad et highbad.
|
---|
993 | // Seul 1 px sur modu est utilise.
|
---|
994 | // La fonction retourne le nombre de pixels utilises pour le calcul.
|
---|
995 | //--
|
---|
996 | {
|
---|
997 | T pixv=0;
|
---|
998 | T minadu = PutInRange((double) lowbad , pixv);
|
---|
999 | T maxadu = PutInRange((double) highbad, pixv);
|
---|
1000 | bool testl = (lowbad<highbad) ? true : false;
|
---|
1001 |
|
---|
1002 | if(modu<=0) modu = 1;
|
---|
1003 | mean = sigma = 0.;
|
---|
1004 |
|
---|
1005 | int rc = 0, n = 0;
|
---|
1006 | double m = 0., s = 0., mm, ss, v;
|
---|
1007 |
|
---|
1008 | for(int j=0;j<YSize();j++) {
|
---|
1009 | mm = ss = 0.;
|
---|
1010 | for(int i=0;i<XSize();i++) {
|
---|
1011 | n++;
|
---|
1012 | if( n%modu != 0 ) continue;
|
---|
1013 | pixv = (*this)(i,j);
|
---|
1014 | if( testl && (pixv < minadu || pixv > maxadu) ) continue;
|
---|
1015 | v = (double) pixv;
|
---|
1016 | rc++;
|
---|
1017 | mm += v;
|
---|
1018 | ss += v*v;
|
---|
1019 | }
|
---|
1020 | m += mm;
|
---|
1021 | s += ss;
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | if(rc==0) return(-1);
|
---|
1025 |
|
---|
1026 | m /= (double) rc;
|
---|
1027 | s = s/(double) rc - m*m;
|
---|
1028 | if(s<0.) return(-2);
|
---|
1029 |
|
---|
1030 | mean = (float) m;
|
---|
1031 | sigma = (float) sqrt(s);
|
---|
1032 |
|
---|
1033 | moyPix = mean; // Mise a jour de la structure
|
---|
1034 | sigPix = sigma;
|
---|
1035 |
|
---|
1036 | return rc;
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | /* --Methode-- (cmv 23/09/96) */
|
---|
1040 | template <class T>
|
---|
1041 | //++
|
---|
1042 | int Image<T>::MoySigmaIter(float& mean,float& sigma,float lowbad,float highbad
|
---|
1043 | ,int modu,int nitermx,float perdiff,float scut,int deb)
|
---|
1044 | //
|
---|
1045 | // Calcul de moyenne et sigma iterativement:
|
---|
1046 | //| lowbad,highbad = dynamique permise pour la valeur
|
---|
1047 | //| des pixels en ADU
|
---|
1048 | //| modu = 1 px sur modu est utilise
|
---|
1049 | //| nitermx = nombre maximum d'iterations permises
|
---|
1050 | //| perdiff = condition d'arret en pourcent sur la variation du sigma
|
---|
1051 | //| scut = coupure en nombre de sigma courant pour l'iteration suivante
|
---|
1052 | //| mean = moyenne retournee
|
---|
1053 | //| sigma = sigma retourne
|
---|
1054 | //| return <= 0 probleme, sinon (>0) nombre de pixels utilises
|
---|
1055 | //--
|
---|
1056 | {
|
---|
1057 | if( scut<=0. || nitermx<=0 || perdiff<=0. ) return 0;
|
---|
1058 | if(modu<=0) modu = 1;
|
---|
1059 | bool testl = (lowbad<highbad) ? true : false;
|
---|
1060 |
|
---|
1061 | mean = sigma = 0.;
|
---|
1062 | float sigmaold = 0;
|
---|
1063 | float xmin = lowbad;
|
---|
1064 | float xmax = highbad;
|
---|
1065 | int rc = 0;
|
---|
1066 |
|
---|
1067 | for(int it=0;it<nitermx;it++) {
|
---|
1068 | rc = MoySigma(mean,sigma,xmin,xmax,modu);
|
---|
1069 | if(deb>0) cout<<"MoySigmaIter mean="<<mean<<" sigma="<<sigma
|
---|
1070 | <<" npix="<<rc<<" entre "<<xmin<<","<<xmax<<endl;
|
---|
1071 | if( rc <= 0 ) return rc;
|
---|
1072 | if( it>=1 && fabs((double)(sigma-sigmaold))/sigma < perdiff ) break;
|
---|
1073 | xmin = mean - scut*sigma; if(testl && xmin<lowbad ) xmin = lowbad;
|
---|
1074 | xmax = mean + scut*sigma; if(testl && xmax>highbad) xmax = highbad;
|
---|
1075 | sigmaold = sigma;
|
---|
1076 | }
|
---|
1077 |
|
---|
1078 | return rc;
|
---|
1079 | }
|
---|
1080 |
|
---|
1081 | /* --Methode-- (cmv 23/09/96) */
|
---|
1082 | template <class T>
|
---|
1083 | //++
|
---|
1084 | int Image<T>::FondSigmaCiel(float lowbad,float highbad,int pvsz
|
---|
1085 | ,float nbsig1,float nbsig2,float nbsig3
|
---|
1086 | ,float binsg,float frac,int modu,int deb)
|
---|
1087 | //
|
---|
1088 | // Calcul automatique du fond de ciel et du sigma ciel en utilisant
|
---|
1089 | // les methodes precedentes et en calculant au mieux le binning.
|
---|
1090 | //| lowbad,highbad: dynamoque utile de l'image (ADU)
|
---|
1091 | //| pvsz : taille du pave a traiter (centre au milieu de l'image)
|
---|
1092 | //| nbsig1 : pour EstimeFdSg -> calcul sgbmax (def=3.5).
|
---|
1093 | //| nbsig2 : pour FondCiel (histo entre X maxi +/- nbsig2*sgbmax
|
---|
1094 | //| nbin = 2.*nbsig2*binsg) (def=5).
|
---|
1095 | //| nbsig3 : pour SigmaCiel (histo entre 0 +/- nbsig3*sgbmax
|
---|
1096 | //| nbin = 2.*nbsig3*binsg) (def=5).
|
---|
1097 | //| binsg : taille du bin pour les histos de FondCiel et SigmaCiel
|
---|
1098 | //| (def=0.33)
|
---|
1099 | //| frac : pour EstimeFdSg(...,frac,...) (def=0.33)
|
---|
1100 | //--
|
---|
1101 | {
|
---|
1102 | if(pvsz<=0) pvsz = 100;
|
---|
1103 | if(nbsig1<=0) nbsig1 = 3.5;
|
---|
1104 | if(nbsig2<=0) nbsig2 = 5.0;
|
---|
1105 | if(nbsig3<=0) nbsig3 = 5.0;
|
---|
1106 | if(binsg<=0) binsg = 0.33; binsg = 1./binsg;
|
---|
1107 | if(frac<=0.) frac = 0.33;
|
---|
1108 | if(deb<0) deb=0;
|
---|
1109 | int lpdb = (deb>=3) ? deb-2 : 0;
|
---|
1110 | int envd = 0;
|
---|
1111 | GetIntEnv("PDEBUG_FOND", envd);
|
---|
1112 | if (lpdb < envd) lpdb = envd;
|
---|
1113 | if (deb < envd) deb = envd;
|
---|
1114 | float xbmax = 0., sgbmax = 0.;
|
---|
1115 | int nbin,rc;
|
---|
1116 | float xmin,xmax,binw,means;
|
---|
1117 |
|
---|
1118 | // creation sous image
|
---|
1119 | int pvsx = pvsz, pvsy = pvsz;
|
---|
1120 | if( pvsx > XSize() ) pvsx = XSize();
|
---|
1121 | if( pvsy > YSize() ) pvsy = YSize();
|
---|
1122 | Image<T> *ssima = NULL;
|
---|
1123 | bool cree = false;
|
---|
1124 | if( pvsx == XSize() && pvsy == YSize() ) {
|
---|
1125 | ssima = this;
|
---|
1126 | } else {
|
---|
1127 | int orgx = XSize()/2 - pvsx/2; if( orgx < 0 ) orgx = 0;
|
---|
1128 | int orgy = YSize()/2 - pvsy/2; if( orgy < 0 ) orgy = 0;
|
---|
1129 | if( orgx + pvsx > XSize() ) pvsx = XSize() - orgx;
|
---|
1130 | if( orgy + pvsy > YSize() ) pvsy = YSize() - orgy;
|
---|
1131 | ssima = new Image<T>(pvsx,pvsy);
|
---|
1132 | cree = true;
|
---|
1133 | CopieImageF(*ssima,*this,orgx,orgy,pvsx,pvsy,0,0,0.,0.);
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 | // moyenne et sigma approches sur sous-image
|
---|
1137 | rc = ssima->EstimeFdSg(xbmax,sgbmax,nbsig1,frac,lowbad,highbad,deb-1);
|
---|
1138 | if( cree ) delete ssima;
|
---|
1139 | if(rc<0) return -2;
|
---|
1140 | fond = xbmax;
|
---|
1141 | sigmaFond = sgbmax;
|
---|
1142 |
|
---|
1143 | // bin entier... pas forcement necessaire.
|
---|
1144 | xmin = xbmax - nbsig2*sgbmax;
|
---|
1145 | xmax = xbmax + nbsig2*sgbmax;
|
---|
1146 | nbin = (int)(2.*nbsig2*binsg); if(nbin<5) nbin=5;
|
---|
1147 | binw = (xmax-xmin)/nbin;
|
---|
1148 | if(deb>0) cout<<"bin auto: xmin="<<xmin<<" xmax="<<xmax
|
---|
1149 | <<" nbin="<<nbin<<" binw="<<binw<<endl;
|
---|
1150 | HBinInt(nbin,xmin,xmax);
|
---|
1151 | binw = (xmax-xmin)/nbin;
|
---|
1152 | if(deb>0) cout<<"bin auto entier: nbin="<<nbin<<" binw="<<binw
|
---|
1153 | <<" entre "<<xmin<<","<<xmax<<endl;
|
---|
1154 |
|
---|
1155 | // Optimisation de modu
|
---|
1156 | if( modu <= 0 ) {
|
---|
1157 | // 4 fois plus de pixels que dans le pre-pave
|
---|
1158 | int npv = 4*pvsz*pvsz;
|
---|
1159 | int nima = XSize()*YSize();
|
---|
1160 | if( npv >= nima || nima < 10000 ) modu = 1;
|
---|
1161 | else modu = (int)( (float) nima / (float) npv );
|
---|
1162 | if(deb) cout<<"modulo choisi a "<<modu<<endl;
|
---|
1163 | }
|
---|
1164 |
|
---|
1165 | // moyenne evoluee
|
---|
1166 | TRY {
|
---|
1167 | fond = FondCiel(nbin,xmin,xmax,3,0.5,modu,lpdb);
|
---|
1168 | if(deb>0) cout <<"Fond de ciel = "<<fond<< endl;
|
---|
1169 | } CATCHALL {
|
---|
1170 | if(deb>0) cout << "Echec FondCiel" << endl;
|
---|
1171 | return(-3);
|
---|
1172 | } ENDTRY
|
---|
1173 |
|
---|
1174 | // sigma evolue
|
---|
1175 | TRY {
|
---|
1176 | float dyn = nbsig3*sgbmax;
|
---|
1177 | int nbins = (int) (2.*nbsig3*binsg);
|
---|
1178 | float binws = (2.*dyn)/nbins;
|
---|
1179 | sigmaFond = SigmaCiel(nbins,-dyn,dyn,means,lowbad,highbad,4.,modu,lpdb);
|
---|
1180 | if(deb>0) cout <<"Sigma fond de ciel = "<<sigmaFond
|
---|
1181 | <<" (ms="<<means<<") sur "<<nbins
|
---|
1182 | <<" bins de largeur "<<binws<< endl;
|
---|
1183 | } CATCHALL {
|
---|
1184 | if(deb>0) cout << "Echec SigmaCiel" << endl;
|
---|
1185 | return(-4);
|
---|
1186 | } ENDTRY
|
---|
1187 |
|
---|
1188 | // Impression finale
|
---|
1189 | if(deb) cout <<"ImgSigmaCiel: fond= "<<xbmax<<" / "<< fond
|
---|
1190 | <<" sigma= "<<sgbmax<<" / "<<sigmaFond<<endl;
|
---|
1191 |
|
---|
1192 | return 0;
|
---|
1193 | }
|
---|
1194 |
|
---|
1195 |
|
---|
1196 |
|
---|
1197 | /* ....................................................... */
|
---|
1198 | /* Fonctions de copie d'images et de paves */
|
---|
1199 | /* ....................................................... */
|
---|
1200 |
|
---|
1201 |
|
---|
1202 | /* Nouvelle-Fonction */
|
---|
1203 | template <class T2, class T1>
|
---|
1204 | void CopieImageF(Image<T2>& copie, Image<T1> const& pim,
|
---|
1205 | int org_pim_x, int org_pim_y, /* origine pave a copier */
|
---|
1206 | int pim_lpav_x, int pim_lpav_y, /* largeur pave a copier */
|
---|
1207 | int org_copie_x, int org_copie_y, /* origine copie */
|
---|
1208 | double cutmin, double cutmax) /* coupure pour max range*/
|
---|
1209 |
|
---|
1210 | /* Copie d'une image (pim) ds l'autre (copie) a partir d'un */
|
---|
1211 | /* offset specifie en pixel */
|
---|
1212 | /* attention: pas d'offset -> org_x = org_y = 0 */
|
---|
1213 | {
|
---|
1214 | int i,j;
|
---|
1215 | int x,y;
|
---|
1216 | const T1* pt_pim;
|
---|
1217 | T2* pt_copie;
|
---|
1218 | double pim_pix;
|
---|
1219 | int l_copie_x,l_copie_y;
|
---|
1220 | int step_copie_x;
|
---|
1221 | int step_pim_x;
|
---|
1222 | int pim_siz_x, pim_siz_y;
|
---|
1223 | int copie_siz_x, copie_siz_y;
|
---|
1224 | int switch_copie;
|
---|
1225 |
|
---|
1226 | pim_siz_x=pim.XSize();
|
---|
1227 | pim_siz_y=pim.YSize();
|
---|
1228 | if((org_pim_x < 0) || (org_pim_x > pim_siz_x))
|
---|
1229 | { cout<< "CopieImage_erreure : org_pim_x: " <<org_pim_x<<" < 0 ou > a "<<pim_siz_x<<"\n\n";
|
---|
1230 | THROW(rangeCheckErr);}
|
---|
1231 | if((org_pim_y < 0) || (org_pim_y > pim_siz_y))
|
---|
1232 | { cout<< "CopieImage_erreure : org_pim_y: " <<org_pim_y<<" < 0 ou > a "<<pim_siz_y<<"\n\n";
|
---|
1233 | THROW(rangeCheckErr);}
|
---|
1234 |
|
---|
1235 | copie_siz_x=copie.XSize();
|
---|
1236 | copie_siz_y=copie.YSize();
|
---|
1237 | if((org_copie_x < 0) || (org_copie_x > copie_siz_x))
|
---|
1238 | { cout<< "CopieImage_erreure : org_copie_x: " <<org_copie_x<<" < 0 ou > a "<<copie_siz_x<<"\n\n";
|
---|
1239 | THROW(rangeCheckErr);}
|
---|
1240 | if((org_copie_y < 0) || (org_copie_y > copie_siz_y))
|
---|
1241 | { cout<< "CopieImage_erreure : org_copie_y: " <<org_copie_y<<" < 0 ou > a "<<copie_siz_y<<"\n\n";
|
---|
1242 | THROW(rangeCheckErr);}
|
---|
1243 |
|
---|
1244 | x=pim_lpav_x;
|
---|
1245 | if(x > (pim_siz_x-org_pim_x)) x=pim_siz_x-org_pim_x;
|
---|
1246 | step_pim_x = pim_siz_x-x;
|
---|
1247 |
|
---|
1248 | if(x < copie_siz_x)
|
---|
1249 | {
|
---|
1250 | l_copie_x=x;
|
---|
1251 | step_copie_x=copie_siz_x-x;
|
---|
1252 | }
|
---|
1253 | else
|
---|
1254 | {
|
---|
1255 | l_copie_x=copie_siz_x;
|
---|
1256 | step_copie_x=0;
|
---|
1257 | step_pim_x=step_pim_x+x-copie_siz_x;
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | if(org_copie_x > 0 )
|
---|
1261 | {
|
---|
1262 | int x=copie_siz_x-org_copie_x;
|
---|
1263 | if(x < l_copie_x )
|
---|
1264 | {
|
---|
1265 | step_pim_x=step_pim_x+l_copie_x-x;
|
---|
1266 | l_copie_x=x;
|
---|
1267 | step_copie_x=org_copie_x;
|
---|
1268 | }
|
---|
1269 | else
|
---|
1270 | {
|
---|
1271 | step_copie_x=copie_siz_x-l_copie_x;
|
---|
1272 | }
|
---|
1273 | }
|
---|
1274 |
|
---|
1275 | y=pim_lpav_y;
|
---|
1276 | if(y > (pim_siz_y-org_pim_y)) y=pim_siz_y-org_pim_y;
|
---|
1277 |
|
---|
1278 | if(y < copie_siz_y)
|
---|
1279 | {
|
---|
1280 | l_copie_y=y;
|
---|
1281 | }
|
---|
1282 | else
|
---|
1283 | {
|
---|
1284 | l_copie_y=copie_siz_y;
|
---|
1285 | }
|
---|
1286 |
|
---|
1287 | pt_pim = pim.ImagePtr()+org_pim_y*pim_siz_x+org_pim_x;
|
---|
1288 | pt_copie=copie.ImagePtr()+org_copie_y*copie_siz_x+org_copie_x;
|
---|
1289 |
|
---|
1290 | switch((int)ConvType(*pt_pim,*pt_copie)) {
|
---|
1291 | case t_same: case t_up:
|
---|
1292 | switch_copie=0;
|
---|
1293 | break;
|
---|
1294 | case t_spe: case t_down:
|
---|
1295 | switch_copie=1;
|
---|
1296 | break;
|
---|
1297 | }
|
---|
1298 |
|
---|
1299 | if(cutmin < cutmax) switch_copie *= 2;
|
---|
1300 |
|
---|
1301 | switch(switch_copie) {
|
---|
1302 | case 0:
|
---|
1303 | for (j=0; j< l_copie_y; j++)
|
---|
1304 | {
|
---|
1305 | for(i=0; i< l_copie_x; i++)
|
---|
1306 | {
|
---|
1307 | *pt_copie++ =(T2)*pt_pim++;
|
---|
1308 | }
|
---|
1309 | pt_pim += step_pim_x;
|
---|
1310 | pt_copie += step_copie_x;
|
---|
1311 | }
|
---|
1312 | break;
|
---|
1313 | case 1:
|
---|
1314 | for (j=0; j< l_copie_y; j++)
|
---|
1315 | {
|
---|
1316 | for(i=0; i< l_copie_x; i++)
|
---|
1317 | {
|
---|
1318 | pim_pix = *pt_pim++;
|
---|
1319 | *pt_copie++ = PutInRange(pim_pix, *pt_copie);
|
---|
1320 | }
|
---|
1321 | pt_pim += step_pim_x;
|
---|
1322 | pt_copie += step_copie_x;
|
---|
1323 | }
|
---|
1324 | break;
|
---|
1325 | case 2:
|
---|
1326 | for (j=0; j< l_copie_y; j++)
|
---|
1327 | {
|
---|
1328 | for(i=0; i< l_copie_x; i++)
|
---|
1329 | {
|
---|
1330 | pim_pix = *pt_pim++;
|
---|
1331 | *pt_copie++ = (T2)SharePix(pim_pix,*pt_copie,cutmin,cutmax);
|
---|
1332 | }
|
---|
1333 | pt_pim += step_pim_x;
|
---|
1334 | pt_copie += step_copie_x;
|
---|
1335 | }
|
---|
1336 | break;
|
---|
1337 | }
|
---|
1338 |
|
---|
1339 | copie.SetOrg( pim.XOrg()+org_pim_x-org_copie_x, pim.YOrg()+org_pim_y-org_copie_y);
|
---|
1340 | }
|
---|
1341 |
|
---|
1342 |
|
---|
1343 | /* Nouvelle-Fonction */
|
---|
1344 | template <class T2, class T1>
|
---|
1345 | void CopieImage(Image<T2>& copie , Image<T1> const& pim)
|
---|
1346 | {
|
---|
1347 | if (!pim.ImagePtr()) THROW(nullPtrErr);
|
---|
1348 | if (!copie.ImagePtr()) copie.Allocate(pim.XSize(),pim.YSize());
|
---|
1349 |
|
---|
1350 | CopieImageF(copie, pim,0,0,pim.XSize(),pim.YSize(),0,0,0., 0.);
|
---|
1351 | }
|
---|
1352 |
|
---|
1353 | /* Nouvelle-Fonction */
|
---|
1354 | template <class T2, class T1>
|
---|
1355 | void CopieImage(Image<T2>& copie , Image<T1> const& pim,
|
---|
1356 | int org_pim_x , int org_pim_y,
|
---|
1357 | int pim_lpav_x , int pim_lpav_y,
|
---|
1358 | int org_copie_x , int org_copie_y,
|
---|
1359 | double cutmin , double cutmax )
|
---|
1360 | {
|
---|
1361 | if (!pim.ImagePtr()) THROW(nullPtrErr);
|
---|
1362 | if (!copie.ImagePtr()) THROW(nullPtrErr);
|
---|
1363 | copie.SetOrg(org_pim_x,org_pim_y);
|
---|
1364 |
|
---|
1365 | /* $CHECK$ Reza 28/04/95 : Je protege pour le moment contre les pave en
|
---|
1366 | dehors de l'image, mais je veux pouvoir copier des paves decale par
|
---|
1367 | rapport aux bornes de l'image source Re- $CHECK$ CMV+Reza 30/09/96 */
|
---|
1368 | if ( (org_pim_x < 0) || (org_pim_y < 0) ||
|
---|
1369 | (org_pim_x >= pim.XSize() ) || (org_pim_y >= pim.YSize() ) ||
|
---|
1370 | ((org_pim_x+copie.XSize()) > pim.XSize()) ||
|
---|
1371 | ((org_pim_y+copie.YSize()) > pim.YSize()) ) copie.Zero();
|
---|
1372 | if ( (org_pim_x < 0) || (org_pim_y < 0) ||
|
---|
1373 | (org_pim_x >= pim.XSize() ) || (org_pim_y >= pim.YSize() )) return;
|
---|
1374 | /* Fin de $CHECK$ */
|
---|
1375 |
|
---|
1376 | if((pim_lpav_x <= 0) || (pim_lpav_x > pim.XSize())) pim_lpav_x=pim.XSize();
|
---|
1377 | if((pim_lpav_y <= 0) || (pim_lpav_y > pim.YSize())) pim_lpav_y=pim.YSize();
|
---|
1378 | TRY {
|
---|
1379 | CopieImageF(copie, pim,org_pim_x,org_pim_y,
|
---|
1380 | pim_lpav_x, pim_lpav_y,
|
---|
1381 | org_copie_x,org_copie_y,cutmin,cutmax);
|
---|
1382 | } catch(RangeCheckError) {
|
---|
1383 | // if (merr != rangeCheckErr) THROW(merr); Re- $CHECK$ CMV+Reza 30/09/96
|
---|
1384 | } ENDTRY
|
---|
1385 | }
|
---|
1386 |
|
---|
1387 |
|
---|
1388 | /* Nouvelle-Fonction */
|
---|
1389 | template <class T2, class T1>
|
---|
1390 | void CopiePave ( Image<T2>& pave , Image<T1> const& pim,
|
---|
1391 | float xc, float yc,
|
---|
1392 | double cutmin, double cutmax)
|
---|
1393 | {
|
---|
1394 | int ix, iy;
|
---|
1395 |
|
---|
1396 | xc -= 0.5 * (float)(pave.XSize()-1);
|
---|
1397 | yc -= 0.5 * (float)(pave.YSize()-1);
|
---|
1398 | // CopiePave tient compte de l'origine de l'image de depart Reza 18/9/96
|
---|
1399 | xc -= pim.XOrg(); yc -= pim.YOrg();
|
---|
1400 |
|
---|
1401 | if ( xc >= 0.) ix = (int)xc;
|
---|
1402 | else ix = (int)(xc-1.0);
|
---|
1403 | if ( yc >= 0.) iy = (int)yc;
|
---|
1404 | else iy = (int)(yc-1.0);
|
---|
1405 | CopieImage(pave, pim, ix, iy, 0, 0, 0, 0, cutmin, cutmax ) ;
|
---|
1406 | }
|
---|
1407 |
|
---|
1408 |
|
---|
1409 | /* Nouvelle-Fonction */
|
---|
1410 | template <class T>
|
---|
1411 | void RzCopieImage(Image<T>& copie, RzImage const& pim,
|
---|
1412 | int org_pim_x , int org_pim_y,
|
---|
1413 | int pim_lpav_x, int pim_lpav_y,
|
---|
1414 | int org_copie_x, int org_copie_y,
|
---|
1415 | double cutmin , double cutmax)
|
---|
1416 | {
|
---|
1417 | switch (pim.PixelType()) {
|
---|
1418 | case kuint_2: {
|
---|
1419 | ImageU2 src((RzImage&)pim);
|
---|
1420 | CopieImage(copie, src, org_pim_x , org_pim_y,
|
---|
1421 | pim_lpav_x, pim_lpav_y, org_copie_x,
|
---|
1422 | org_copie_y, cutmin, cutmax );
|
---|
1423 | break;
|
---|
1424 | }
|
---|
1425 | case kint_2: {
|
---|
1426 | ImageI2 src((RzImage&)pim);
|
---|
1427 | CopieImage(copie, src, org_pim_x , org_pim_y,
|
---|
1428 | pim_lpav_x, pim_lpav_y, org_copie_x,
|
---|
1429 | org_copie_y, cutmin, cutmax );
|
---|
1430 | break;
|
---|
1431 | }
|
---|
1432 | case kint_4: {
|
---|
1433 | ImageI4 src((RzImage&)pim);
|
---|
1434 | CopieImage(copie, src, org_pim_x , org_pim_y,
|
---|
1435 | pim_lpav_x, pim_lpav_y, org_copie_x,
|
---|
1436 | org_copie_y, cutmin, cutmax );
|
---|
1437 | break;
|
---|
1438 | }
|
---|
1439 | case kr_4: {
|
---|
1440 | ImageR4 src((RzImage&)pim);
|
---|
1441 | CopieImage(copie, src, org_pim_x , org_pim_y,
|
---|
1442 | pim_lpav_x, pim_lpav_y, org_copie_x,
|
---|
1443 | org_copie_y, cutmin, cutmax );
|
---|
1444 | break;
|
---|
1445 | }
|
---|
1446 | case kr_8:
|
---|
1447 | case kuint_4:
|
---|
1448 | case kuint_1:
|
---|
1449 | case kint_1:
|
---|
1450 | cerr << " RzCopieImage(...) / Error, Unsupported image type (kr_8/ kuint_4/ kuint_1/ kint_1) "
|
---|
1451 | << (int)pim.PixelType() << "\n";
|
---|
1452 | break;
|
---|
1453 | default:
|
---|
1454 | cerr << " RzCopieImage(...) / Error, Unknown image type !" << (int)pim.PixelType() << "\n";
|
---|
1455 | break;
|
---|
1456 | }
|
---|
1457 | }
|
---|
1458 |
|
---|
1459 |
|
---|
1460 | /* Nouvelle-Fonction */
|
---|
1461 | template <class T>
|
---|
1462 | void RzCopieImage(Image<T>& copie, RzImage const& pim)
|
---|
1463 | {
|
---|
1464 | switch (pim.PixelType()) {
|
---|
1465 | case kuint_2: {
|
---|
1466 | ImageU2 src((RzImage&)pim);
|
---|
1467 | CopieImage(copie, src);
|
---|
1468 | break;
|
---|
1469 | }
|
---|
1470 | case kint_2: {
|
---|
1471 | ImageI2 src((RzImage&)pim);
|
---|
1472 | CopieImage(copie, src);
|
---|
1473 | break;
|
---|
1474 | }
|
---|
1475 | case kint_4: {
|
---|
1476 | ImageI4 src((RzImage&)pim);
|
---|
1477 | CopieImage(copie, src);
|
---|
1478 | break;
|
---|
1479 | }
|
---|
1480 | case kr_4: {
|
---|
1481 | ImageR4 src((RzImage&)pim);
|
---|
1482 | CopieImage(copie, src);
|
---|
1483 | break;
|
---|
1484 | }
|
---|
1485 | case kr_8:
|
---|
1486 | case kuint_4:
|
---|
1487 | case kuint_1:
|
---|
1488 | case kint_1:
|
---|
1489 | cerr << " RzCopieImage() / Error, Unsupported image type (kr_8/ kuint_4/ kuint_1/ kint_1) "
|
---|
1490 | << (int)pim.PixelType() << "\n";
|
---|
1491 | break;
|
---|
1492 | default:
|
---|
1493 | cerr << " RzCopieImage() / Error, Unknown image type ! " << (int)pim.PixelType() << "\n";
|
---|
1494 | break;
|
---|
1495 | }
|
---|
1496 | }
|
---|
1497 |
|
---|
1498 | /* Nouvelle-Fonction */
|
---|
1499 | template <class T>
|
---|
1500 | void RzCopiePave(Image<T> & pave, RzImage const & pim,
|
---|
1501 | float xc, float yc,
|
---|
1502 | double cutmin, double cutmax)
|
---|
1503 | {
|
---|
1504 | int ix, iy;
|
---|
1505 |
|
---|
1506 | xc -= 0.5 * (float)(pave.XSize()-1);
|
---|
1507 | yc -= 0.5 * (float)(pave.YSize()-1);
|
---|
1508 | // RzCopiePave tient compte de l'origine de l'image de depart Reza 18/9/96
|
---|
1509 | xc -= pim.XOrg(); yc -= pim.YOrg();
|
---|
1510 |
|
---|
1511 | if ( xc >= 0.) ix = (int)xc;
|
---|
1512 | else ix = (int)(xc-1.0);
|
---|
1513 | if ( yc >= 0.) iy = (int)yc;
|
---|
1514 | else iy = (int)(yc-1.0);
|
---|
1515 |
|
---|
1516 | RzCopieImage(pave, pim, ix, iy, 0, 0, 0, 0, cutmin, cutmax) ;
|
---|
1517 | }
|
---|
1518 |
|
---|
1519 |
|
---|
1520 | /* Nouvelle-Fonction */
|
---|
1521 | void RzPrintImage(RzImage & img)
|
---|
1522 | {
|
---|
1523 | switch (img.PixelType())
|
---|
1524 | {
|
---|
1525 | case kuint_1:
|
---|
1526 | {
|
---|
1527 | ImageU1 src((RzImage&)img);
|
---|
1528 | cout << src ;
|
---|
1529 | break;
|
---|
1530 | }
|
---|
1531 | case kuint_2:
|
---|
1532 | {
|
---|
1533 | ImageU2 src((RzImage&)img);
|
---|
1534 | cout << src ;
|
---|
1535 | break;
|
---|
1536 | }
|
---|
1537 | case kint_2:
|
---|
1538 | {
|
---|
1539 | ImageI2 src((RzImage&)img);
|
---|
1540 | cout << src ;
|
---|
1541 | break;
|
---|
1542 | }
|
---|
1543 | case kint_4:
|
---|
1544 | {
|
---|
1545 | ImageI4 src((RzImage&)img);
|
---|
1546 | cout << src ;
|
---|
1547 | break;
|
---|
1548 | }
|
---|
1549 | case kr_4:
|
---|
1550 | {
|
---|
1551 | ImageR4 src((RzImage&)img);
|
---|
1552 | cout << src ;
|
---|
1553 | break;
|
---|
1554 | }
|
---|
1555 | case kr_8:
|
---|
1556 | case kuint_4:
|
---|
1557 | case kint_1:
|
---|
1558 | cerr << " RzPrintImage() / Error, Unsupported image type (kr_8/kuint_4/ kint_1) "
|
---|
1559 | << (int)img.PixelType() << "\n";
|
---|
1560 | break;
|
---|
1561 | default:
|
---|
1562 | cerr << " RzPrintImage() / Error, Unknown image type " << (int)img.PixelType() << "\n";
|
---|
1563 | break;
|
---|
1564 | }
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 |
|
---|
1568 | // ********** INSTANCES
|
---|
1569 | #if defined(__xlC) || defined(__aCC__)
|
---|
1570 | void instancetempcimage(int n)
|
---|
1571 | {
|
---|
1572 | // #pragma define_template
|
---|
1573 | /* Cette fonction sert uniquement a forcer le compilo a instancier les
|
---|
1574 | classes/fonctions template */
|
---|
1575 |
|
---|
1576 | int m = n-50;
|
---|
1577 | ImageU1 iu1(n,n), xiu1(m,m);
|
---|
1578 | ImageU2 iu2(n,n), xiu2(m,m);
|
---|
1579 | ImageI2 ii2(n,n), xii2(m,m);
|
---|
1580 | ImageI4 ii4(n,n), xii4(m,m);
|
---|
1581 | ImageR4 ir4(n,n), xir4(m,m);
|
---|
1582 | RzImage rzi(kr_4, n, n);
|
---|
1583 |
|
---|
1584 | cout << iu1;
|
---|
1585 | cout << iu2;
|
---|
1586 | cout << ii2;
|
---|
1587 | cout << ii4;
|
---|
1588 | cout << ir4;
|
---|
1589 |
|
---|
1590 | CopieImageF(iu2, xiu2, 50, 50);
|
---|
1591 | CopieImageF(iu2, xii2, 50, 50);
|
---|
1592 | CopieImageF(iu2, xii4, 50, 50);
|
---|
1593 | CopieImageF(iu2, xir4, 50, 50);
|
---|
1594 | CopieImageF(ii2, xiu2, 50, 50);
|
---|
1595 | CopieImageF(ii2, xii2, 50, 50);
|
---|
1596 | CopieImageF(ii2, xii4, 50, 50);
|
---|
1597 | CopieImageF(ii2, xir4, 50, 50);
|
---|
1598 | CopieImageF(ii4, xiu2, 50, 50);
|
---|
1599 | CopieImageF(ii4, xii2, 50, 50);
|
---|
1600 | CopieImageF(ii4, xii4, 50, 50);
|
---|
1601 | CopieImageF(ii4, xir4, 50, 50);
|
---|
1602 | CopieImageF(ir4, xiu2, 50, 50);
|
---|
1603 | CopieImageF(ir4, xii2, 50, 50);
|
---|
1604 | CopieImageF(ir4, xii4, 50, 50);
|
---|
1605 | CopieImageF(ir4, xir4, 50, 50);
|
---|
1606 |
|
---|
1607 | CopieImage(iu2, xiu2);
|
---|
1608 | CopieImage(iu2, xii2);
|
---|
1609 | CopieImage(iu2, xii4);
|
---|
1610 | CopieImage(iu2, xir4);
|
---|
1611 | CopieImage(ii2, xiu2);
|
---|
1612 | CopieImage(ii2, xii2);
|
---|
1613 | CopieImage(ii2, xii4);
|
---|
1614 | CopieImage(ii2, xir4);
|
---|
1615 | CopieImage(ii4, xiu2);
|
---|
1616 | CopieImage(ii4, xii2);
|
---|
1617 | CopieImage(ii4, xii4);
|
---|
1618 | CopieImage(ii4, xir4);
|
---|
1619 | CopieImage(ir4, xiu2);
|
---|
1620 | CopieImage(ir4, xii2);
|
---|
1621 | CopieImage(ir4, xii4);
|
---|
1622 | CopieImage(ir4, xir4);
|
---|
1623 |
|
---|
1624 | CopieImage(iu2, xiu2, 50, 50);
|
---|
1625 | CopieImage(iu2, xii2, 50, 50);
|
---|
1626 | CopieImage(iu2, xii4, 50, 50);
|
---|
1627 | CopieImage(iu2, xir4, 50, 50);
|
---|
1628 | CopieImage(ii2, xiu2, 50, 50);
|
---|
1629 | CopieImage(ii2, xii2, 50, 50);
|
---|
1630 | CopieImage(ii2, xii4, 50, 50);
|
---|
1631 | CopieImage(ii2, xir4, 50, 50);
|
---|
1632 | CopieImage(ii4, xiu2, 50, 50);
|
---|
1633 | CopieImage(ii4, xii2, 50, 50);
|
---|
1634 | CopieImage(ii4, xii4, 50, 50);
|
---|
1635 | CopieImage(ii4, xir4, 50, 50);
|
---|
1636 | CopieImage(ir4, xiu2, 50, 50);
|
---|
1637 | CopieImage(ir4, xii2, 50, 50);
|
---|
1638 | CopieImage(ir4, xii4, 50, 50);
|
---|
1639 | CopieImage(ir4, xir4, 50, 50);
|
---|
1640 |
|
---|
1641 | CopiePave(iu2, xiu2, (float)25., (float)25.);
|
---|
1642 | CopiePave(iu2, xii2, (float)25., (float)25.);
|
---|
1643 | CopiePave(iu2, xii4, (float)25., (float)25.);
|
---|
1644 | CopiePave(iu2, xir4, (float)25., (float)25.);
|
---|
1645 | CopiePave(ii2, xiu2, (float)25., (float)25.);
|
---|
1646 | CopiePave(ii2, xii2, (float)25., (float)25.);
|
---|
1647 | CopiePave(ii2, xii4, (float)25., (float)25.);
|
---|
1648 | CopiePave(ii2, xir4, (float)25., (float)25.);
|
---|
1649 | CopiePave(ii4, xiu2, (float)25., (float)25.);
|
---|
1650 | CopiePave(ii4, xii2, (float)25., (float)25.);
|
---|
1651 | CopiePave(ii4, xii4, (float)25.,(float) 25.);
|
---|
1652 | CopiePave(ii4, xir4, (float)25., (float)25.);
|
---|
1653 | CopiePave(ir4, xiu2, (float)25., (float)25.);
|
---|
1654 | CopiePave(ir4, xii2, (float)25., (float)25.);
|
---|
1655 | CopiePave(ir4, xii4, (float)25., (float)25.);
|
---|
1656 | CopiePave(ir4, xir4, (float)25., (float)25.);
|
---|
1657 |
|
---|
1658 | RzCopieImage(iu2, rzi, 50, 50);
|
---|
1659 | RzCopieImage(ii2, rzi, 50, 50);
|
---|
1660 | RzCopieImage(ii4, rzi, 50, 50);
|
---|
1661 | RzCopieImage(ir4, rzi, 50, 50);
|
---|
1662 |
|
---|
1663 | RzCopieImage(iu2, rzi);
|
---|
1664 | RzCopieImage(ii2, rzi);
|
---|
1665 | RzCopieImage(ii4, rzi);
|
---|
1666 | RzCopieImage(ir4, rzi);
|
---|
1667 |
|
---|
1668 | RzCopiePave(iu2, rzi, (float)25., (float)25.);
|
---|
1669 | RzCopiePave(ii2, rzi, (float)25., (float)25.);
|
---|
1670 | RzCopiePave(ii4, rzi, (float)25., (float)25.);
|
---|
1671 | RzCopiePave(ir4, rzi, (float)25., (float)25.);
|
---|
1672 |
|
---|
1673 | return;
|
---|
1674 | }
|
---|
1675 |
|
---|
1676 | #endif
|
---|
1677 |
|
---|
1678 | #ifdef __CXX_PRAGMA_TEMPLATES__
|
---|
1679 | #pragma define_template Image<uint_1>
|
---|
1680 | #pragma define_template Image<uint_2>
|
---|
1681 | #pragma define_template Image<int_2>
|
---|
1682 | #pragma define_template Image<int_4>
|
---|
1683 | #pragma define_template Image<r_4>
|
---|
1684 |
|
---|
1685 | // pour supprimer les message Warning: Unresolved:
|
---|
1686 | // __ls__XR7ostreamRC10Image__TUc
|
---|
1687 |
|
---|
1688 | ostream& operator << (ostream& s, ImageU1 const& pim)
|
---|
1689 | {
|
---|
1690 | cout << "operator << (ostream, ImageU1) Not implemented ..." << endl;
|
---|
1691 | return(s);
|
---|
1692 | }
|
---|
1693 |
|
---|
1694 | // CopieImageF
|
---|
1695 | #pragma define_template CopieImageF < uint_1 , uint_1 >
|
---|
1696 | #pragma define_template CopieImageF < uint_1 , uint_2 >
|
---|
1697 | #pragma define_template CopieImageF < uint_1 , int_2 >
|
---|
1698 | #pragma define_template CopieImageF < uint_1 , int_4 >
|
---|
1699 | #pragma define_template CopieImageF < uint_1 , r_4 >
|
---|
1700 |
|
---|
1701 | #pragma define_template CopieImageF < uint_2 , uint_2 >
|
---|
1702 | #pragma define_template CopieImageF < uint_2 , int_2 >
|
---|
1703 | #pragma define_template CopieImageF < uint_2 , int_4 >
|
---|
1704 | #pragma define_template CopieImageF < uint_2 , r_4 >
|
---|
1705 |
|
---|
1706 | #pragma define_template CopieImageF < int_2 , uint_2 >
|
---|
1707 | #pragma define_template CopieImageF < int_2 , int_2 >
|
---|
1708 | #pragma define_template CopieImageF < int_2 , int_4 >
|
---|
1709 | #pragma define_template CopieImageF < int_2 , r_4 >
|
---|
1710 |
|
---|
1711 | #pragma define_template CopieImageF < int_4 , uint_2 >
|
---|
1712 | #pragma define_template CopieImageF < int_4 , int_2 >
|
---|
1713 | #pragma define_template CopieImageF < int_4 , int_4 >
|
---|
1714 | #pragma define_template CopieImageF < int_4 , r_4 >
|
---|
1715 |
|
---|
1716 | #pragma define_template CopieImageF < r_4 , uint_2 >
|
---|
1717 | #pragma define_template CopieImageF < r_4 , int_2 >
|
---|
1718 | #pragma define_template CopieImageF < r_4 , int_4 >
|
---|
1719 | #pragma define_template CopieImageF < r_4 , r_4 >
|
---|
1720 |
|
---|
1721 | // CopieImage
|
---|
1722 | #pragma define_template CopieImage < uint_2 , uint_2 >
|
---|
1723 | #pragma define_template CopieImage < uint_2 , int_2 >
|
---|
1724 | #pragma define_template CopieImage < uint_2 , int_4 >
|
---|
1725 | #pragma define_template CopieImage < uint_2 , r_4 >
|
---|
1726 |
|
---|
1727 | #pragma define_template CopieImage < int_2 , uint_2 >
|
---|
1728 | #pragma define_template CopieImage < int_2 , int_2 >
|
---|
1729 | #pragma define_template CopieImage < int_2 , int_4 >
|
---|
1730 | #pragma define_template CopieImage < int_2 , r_4 >
|
---|
1731 |
|
---|
1732 | #pragma define_template CopieImage < int_4 , uint_2 >
|
---|
1733 | #pragma define_template CopieImage < int_4 , int_2 >
|
---|
1734 | #pragma define_template CopieImage < int_4 , int_4 >
|
---|
1735 | #pragma define_template CopieImage < int_4 , r_4 >
|
---|
1736 |
|
---|
1737 | #pragma define_template CopieImage < r_4 , uint_2 >
|
---|
1738 | #pragma define_template CopieImage < r_4 , int_2 >
|
---|
1739 | #pragma define_template CopieImage < r_4 , int_4 >
|
---|
1740 | #pragma define_template CopieImage < r_4 , r_4 >
|
---|
1741 |
|
---|
1742 | // CopiePave
|
---|
1743 | #pragma define_template CopiePave < uint_2 , uint_2 >
|
---|
1744 | #pragma define_template CopiePave < uint_2 , int_2 >
|
---|
1745 | #pragma define_template CopiePave < uint_2 , int_4 >
|
---|
1746 | #pragma define_template CopiePave < uint_2 , r_4 >
|
---|
1747 |
|
---|
1748 | #pragma define_template CopiePave < int_2 , uint_2 >
|
---|
1749 | #pragma define_template CopiePave < int_2 , int_2 >
|
---|
1750 | #pragma define_template CopiePave < int_2 , int_4 >
|
---|
1751 | #pragma define_template CopiePave < int_2 , r_4 >
|
---|
1752 |
|
---|
1753 | #pragma define_template CopiePave < int_4 , uint_2 >
|
---|
1754 | #pragma define_template CopiePave < int_4 , int_2 >
|
---|
1755 | #pragma define_template CopiePave < int_4 , int_4 >
|
---|
1756 | #pragma define_template CopiePave < int_4 , r_4 >
|
---|
1757 |
|
---|
1758 | #pragma define_template CopiePave < r_4 , uint_2 >
|
---|
1759 | #pragma define_template CopiePave < r_4 , int_2 >
|
---|
1760 | #pragma define_template CopiePave < r_4 , int_4 >
|
---|
1761 | #pragma define_template CopiePave < r_4 , r_4 >
|
---|
1762 |
|
---|
1763 | //RzCopieImage
|
---|
1764 | #pragma define_template RzCopieImage < uint_2 >
|
---|
1765 | #pragma define_template RzCopieImage < int_2 >
|
---|
1766 | #pragma define_template RzCopieImage < int_4 >
|
---|
1767 | #pragma define_template RzCopieImage < r_4 >
|
---|
1768 |
|
---|
1769 | //RzCopiePave
|
---|
1770 | #pragma define_template RzCopiePave < uint_2 >
|
---|
1771 | #pragma define_template RzCopiePave < int_2 >
|
---|
1772 | #pragma define_template RzCopiePave < int_4 >
|
---|
1773 | #pragma define_template RzCopiePave < r_4 >
|
---|
1774 |
|
---|
1775 |
|
---|
1776 | #endif
|
---|
1777 |
|
---|
1778 |
|
---|
1779 | #if defined(ANSI_TEMPLATES)
|
---|
1780 | template class Image<uint_1>;
|
---|
1781 | template class Image<uint_2>;
|
---|
1782 | template class Image<int_2>;
|
---|
1783 | template class Image<int_4>;
|
---|
1784 | template class Image<r_4>;
|
---|
1785 |
|
---|
1786 | #if !defined(__aCC__) // HP - aCC a du mal avec les fonctions templates
|
---|
1787 |
|
---|
1788 | template void CopieImageF<uint_2, uint_2>(Image<uint_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1789 | template void CopieImageF<uint_2, int_2>(Image<uint_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1790 | template void CopieImageF<uint_2, int_4>(Image<uint_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1791 | template void CopieImageF<uint_2, r_4>(Image<uint_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1792 | template void CopieImageF< int_2, uint_2>(Image< int_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1793 | template void CopieImageF< int_2, int_2>(Image< int_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1794 | template void CopieImageF< int_2, int_4>(Image< int_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1795 | template void CopieImageF< int_2, r_4>(Image< int_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1796 | template void CopieImageF< int_4, uint_2>(Image< int_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1797 | template void CopieImageF< int_4, int_2>(Image< int_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1798 | template void CopieImageF< int_4, int_4>(Image< int_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1799 | template void CopieImageF< int_4, r_4>(Image< int_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1800 | template void CopieImageF< r_4, uint_2>(Image< r_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1801 | template void CopieImageF< r_4, int_2>(Image< r_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1802 | template void CopieImageF< r_4, int_4>(Image< r_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1803 | template void CopieImageF< r_4, r_4>(Image< r_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1804 |
|
---|
1805 | template void CopieImage<uint_2, uint_2>(Image<uint_2>&, Image<uint_2> const&);
|
---|
1806 | template void CopieImage<uint_2, int_2>(Image<uint_2>&, Image< int_2> const&);
|
---|
1807 | template void CopieImage<uint_2, int_4>(Image<uint_2>&, Image< int_4> const&);
|
---|
1808 | template void CopieImage<uint_2, r_4>(Image<uint_2>&, Image< r_4> const&);
|
---|
1809 | template void CopieImage< int_2, uint_2>(Image< int_2>&, Image<uint_2> const&);
|
---|
1810 | template void CopieImage< int_2, int_2>(Image< int_2>&, Image< int_2> const&);
|
---|
1811 | template void CopieImage< int_2, int_4>(Image< int_2>&, Image< int_4> const&);
|
---|
1812 | template void CopieImage< int_2, r_4>(Image< int_2>&, Image< r_4> const&);
|
---|
1813 | template void CopieImage< int_4, uint_2>(Image< int_4>&, Image<uint_2> const&);
|
---|
1814 | template void CopieImage< int_4, int_2>(Image< int_4>&, Image< int_2> const&);
|
---|
1815 | template void CopieImage< int_4, int_4>(Image< int_4>&, Image< int_4> const&);
|
---|
1816 | template void CopieImage< int_4, r_4>(Image< int_4>&, Image< r_4> const&);
|
---|
1817 | template void CopieImage< r_4, uint_2>(Image< r_4>&, Image<uint_2> const&);
|
---|
1818 | template void CopieImage< r_4, int_2>(Image< r_4>&, Image< int_2> const&);
|
---|
1819 | template void CopieImage< r_4, int_4>(Image< r_4>&, Image< int_4> const&);
|
---|
1820 | template void CopieImage< r_4, r_4>(Image< r_4>&, Image< r_4> const&);
|
---|
1821 |
|
---|
1822 | template void CopieImage<uint_2, uint_2>(Image<uint_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1823 | template void CopieImage<uint_2, int_2>(Image<uint_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1824 | template void CopieImage<uint_2, int_4>(Image<uint_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1825 | template void CopieImage<uint_2, r_4>(Image<uint_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1826 | template void CopieImage< int_2, uint_2>(Image< int_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1827 | template void CopieImage< int_2, int_2>(Image< int_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1828 | template void CopieImage< int_2, int_4>(Image< int_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1829 | template void CopieImage< int_2, r_4>(Image< int_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1830 | template void CopieImage< int_4, uint_2>(Image< int_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1831 | template void CopieImage< int_4, int_2>(Image< int_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1832 | template void CopieImage< int_4, int_4>(Image< int_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1833 | template void CopieImage< int_4, r_4>(Image< int_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1834 | template void CopieImage< r_4, uint_2>(Image< r_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1835 | template void CopieImage< r_4, int_2>(Image< r_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1836 | template void CopieImage< r_4, int_4>(Image< r_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1837 | template void CopieImage< r_4, r_4>(Image< r_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1838 |
|
---|
1839 | template void CopiePave<uint_2, uint_2>(Image<uint_2>&, Image<uint_2> const&, float, float, double, double);
|
---|
1840 | template void CopiePave<uint_2, int_2>(Image<uint_2>&, Image< int_2> const&, float, float, double, double);
|
---|
1841 | template void CopiePave<uint_2, int_4>(Image<uint_2>&, Image< int_4> const&, float, float, double, double);
|
---|
1842 | template void CopiePave<uint_2, r_4>(Image<uint_2>&, Image< r_4> const&, float, float, double, double);
|
---|
1843 | template void CopiePave< int_2, uint_2>(Image< int_2>&, Image<uint_2> const&, float, float, double, double);
|
---|
1844 | template void CopiePave< int_2, int_2>(Image< int_2>&, Image< int_2> const&, float, float, double, double);
|
---|
1845 | template void CopiePave< int_2, int_4>(Image< int_2>&, Image< int_4> const&, float, float, double, double);
|
---|
1846 | template void CopiePave< int_2, r_4>(Image< int_2>&, Image< r_4> const&, float, float, double, double);
|
---|
1847 | template void CopiePave< int_4, uint_2>(Image< int_4>&, Image<uint_2> const&, float, float, double, double);
|
---|
1848 | template void CopiePave< int_4, int_2>(Image< int_4>&, Image< int_2> const&, float, float, double, double);
|
---|
1849 | template void CopiePave< int_4, int_4>(Image< int_4>&, Image< int_4> const&, float, float, double, double);
|
---|
1850 | template void CopiePave< int_4, r_4>(Image< int_4>&, Image< r_4> const&, float, float, double, double);
|
---|
1851 | template void CopiePave< r_4, uint_2>(Image< r_4>&, Image<uint_2> const&, float, float, double, double);
|
---|
1852 | template void CopiePave< r_4, int_2>(Image< r_4>&, Image< int_2> const&, float, float, double, double);
|
---|
1853 | template void CopiePave< r_4, int_4>(Image< r_4>&, Image< int_4> const&, float, float, double, double);
|
---|
1854 | template void CopiePave< r_4, r_4>(Image< r_4>&, Image< r_4> const&, float, float, double, double);
|
---|
1855 |
|
---|
1856 |
|
---|
1857 | template void RzCopieImage<uint_2>(Image<uint_2> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1858 | template void RzCopieImage< int_2>(Image< int_2> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1859 | template void RzCopieImage< int_4>(Image< int_4> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1860 | template void RzCopieImage< r_4>(Image< r_4> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1861 |
|
---|
1862 | template void RzCopieImage<uint_2>(Image<uint_2> &, RzImage const &);
|
---|
1863 | template void RzCopieImage< int_2>(Image< int_2> &, RzImage const &);
|
---|
1864 | template void RzCopieImage< int_4>(Image< int_4> &, RzImage const &);
|
---|
1865 | template void RzCopieImage< r_4>(Image< r_4> &, RzImage const &);
|
---|
1866 |
|
---|
1867 | template void RzCopiePave<uint_2>(Image<uint_2> &, RzImage const &, float, float, double, double);
|
---|
1868 | template void RzCopiePave< int_2>(Image< int_2> &, RzImage const &, float, float, double, double);
|
---|
1869 | template void RzCopiePave< int_4>(Image< int_4> &, RzImage const &, float, float, double, double);
|
---|
1870 | template void RzCopiePave< r_4>(Image< r_4> &, RzImage const &, float, float, double, double);
|
---|
1871 |
|
---|
1872 | #endif // Pb avec HP aCC
|
---|
1873 |
|
---|
1874 | #endif
|
---|
1875 |
|
---|
1876 |
|
---|
1877 | #ifdef __GNU_TEMPLATES__
|
---|
1878 | template class Image<bool>;
|
---|
1879 | template class Image<uint_1>;
|
---|
1880 | template class Image<uint_2>;
|
---|
1881 | template class Image<int_2>;
|
---|
1882 | template class Image<int_4>;
|
---|
1883 | template class Image<r_4>;
|
---|
1884 |
|
---|
1885 |
|
---|
1886 | template void CopieImageF(Image<uint_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1887 | template void CopieImageF(Image<uint_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1888 | template void CopieImageF(Image<uint_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1889 | template void CopieImageF(Image<uint_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1890 | template void CopieImageF(Image< int_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1891 | template void CopieImageF(Image< int_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1892 | template void CopieImageF(Image< int_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1893 | template void CopieImageF(Image< int_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1894 | template void CopieImageF(Image< int_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1895 | template void CopieImageF(Image< int_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1896 | template void CopieImageF(Image< int_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1897 | template void CopieImageF(Image< int_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1898 | template void CopieImageF(Image< r_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1899 | template void CopieImageF(Image< r_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1900 | template void CopieImageF(Image< r_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1901 | template void CopieImageF(Image< r_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1902 |
|
---|
1903 | template void CopieImage(Image<uint_2>&, Image<uint_2> const&);
|
---|
1904 | template void CopieImage(Image<uint_2>&, Image< int_2> const&);
|
---|
1905 | template void CopieImage(Image<uint_2>&, Image< int_4> const&);
|
---|
1906 | template void CopieImage(Image<uint_2>&, Image< r_4> const&);
|
---|
1907 | template void CopieImage(Image< int_2>&, Image<uint_2> const&);
|
---|
1908 | template void CopieImage(Image< int_2>&, Image< int_2> const&);
|
---|
1909 | template void CopieImage(Image< int_2>&, Image< int_4> const&);
|
---|
1910 | template void CopieImage(Image< int_2>&, Image< r_4> const&);
|
---|
1911 | template void CopieImage(Image< int_4>&, Image<uint_2> const&);
|
---|
1912 | template void CopieImage(Image< int_4>&, Image< int_2> const&);
|
---|
1913 | template void CopieImage(Image< int_4>&, Image< int_4> const&);
|
---|
1914 | template void CopieImage(Image< int_4>&, Image< r_4> const&);
|
---|
1915 | template void CopieImage(Image< r_4>&, Image<uint_2> const&);
|
---|
1916 | template void CopieImage(Image< r_4>&, Image< int_2> const&);
|
---|
1917 | template void CopieImage(Image< r_4>&, Image< int_4> const&);
|
---|
1918 | template void CopieImage(Image< r_4>&, Image< r_4> const&);
|
---|
1919 |
|
---|
1920 | template void CopieImage(Image<uint_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1921 | template void CopieImage(Image<uint_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1922 | template void CopieImage(Image<uint_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1923 | template void CopieImage(Image<uint_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1924 | template void CopieImage(Image< int_2>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1925 | template void CopieImage(Image< int_2>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1926 | template void CopieImage(Image< int_2>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1927 | template void CopieImage(Image< int_2>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1928 | template void CopieImage(Image< int_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1929 | template void CopieImage(Image< int_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1930 | template void CopieImage(Image< int_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1931 | template void CopieImage(Image< int_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1932 | template void CopieImage(Image< r_4>&, Image<uint_2> const&, int, int, int, int, int, int, double, double);
|
---|
1933 | template void CopieImage(Image< r_4>&, Image< int_2> const&, int, int, int, int, int, int, double, double);
|
---|
1934 | template void CopieImage(Image< r_4>&, Image< int_4> const&, int, int, int, int, int, int, double, double);
|
---|
1935 | template void CopieImage(Image< r_4>&, Image< r_4> const&, int, int, int, int, int, int, double, double);
|
---|
1936 |
|
---|
1937 | template void CopiePave(Image<uint_2>&, Image<uint_2> const&, float, float, double, double);
|
---|
1938 | template void CopiePave(Image<uint_2>&, Image< int_2> const&, float, float, double, double);
|
---|
1939 | template void CopiePave(Image<uint_2>&, Image< int_4> const&, float, float, double, double);
|
---|
1940 | template void CopiePave(Image<uint_2>&, Image< r_4> const&, float, float, double, double);
|
---|
1941 | template void CopiePave(Image< int_2>&, Image<uint_2> const&, float, float, double, double);
|
---|
1942 | template void CopiePave(Image< int_2>&, Image< int_2> const&, float, float, double, double);
|
---|
1943 | template void CopiePave(Image< int_2>&, Image< int_4> const&, float, float, double, double);
|
---|
1944 | template void CopiePave(Image< int_2>&, Image< r_4> const&, float, float, double, double);
|
---|
1945 | template void CopiePave(Image< int_4>&, Image<uint_2> const&, float, float, double, double);
|
---|
1946 | template void CopiePave(Image< int_4>&, Image< int_2> const&, float, float, double, double);
|
---|
1947 | template void CopiePave(Image< int_4>&, Image< int_4> const&, float, float, double, double);
|
---|
1948 | template void CopiePave(Image< int_4>&, Image< r_4> const&, float, float, double, double);
|
---|
1949 | template void CopiePave(Image< r_4>&, Image<uint_2> const&, float, float, double, double);
|
---|
1950 | template void CopiePave(Image< r_4>&, Image< int_2> const&, float, float, double, double);
|
---|
1951 | template void CopiePave(Image< r_4>&, Image< int_4> const&, float, float, double, double);
|
---|
1952 | template void CopiePave(Image< r_4>&, Image< r_4> const&, float, float, double, double);
|
---|
1953 |
|
---|
1954 |
|
---|
1955 | template void RzCopieImage(Image<uint_2> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1956 | template void RzCopieImage(Image< int_2> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1957 | template void RzCopieImage(Image< int_4> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1958 | template void RzCopieImage(Image< r_4> &, RzImage const &, int, int, int, int, int, int, double, double);
|
---|
1959 |
|
---|
1960 | template void RzCopieImage(Image<uint_2> &, RzImage const &);
|
---|
1961 | template void RzCopieImage(Image< int_2> &, RzImage const &);
|
---|
1962 | template void RzCopieImage(Image< int_4> &, RzImage const &);
|
---|
1963 | template void RzCopieImage(Image< r_4> &, RzImage const &);
|
---|
1964 |
|
---|
1965 | template void RzCopiePave(Image<uint_2> &, RzImage const &, float, float, double, double);
|
---|
1966 | template void RzCopiePave(Image< int_2> &, RzImage const &, float, float, double, double);
|
---|
1967 | template void RzCopiePave(Image< int_4> &, RzImage const &, float, float, double, double);
|
---|
1968 | template void RzCopiePave(Image< r_4> &, RzImage const &, float, float, double, double);
|
---|
1969 |
|
---|
1970 | #endif
|
---|
1971 |
|
---|