GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
pixelmap.h
1//
2// pixelmap.h
3// GLAMER
4//
5// Created by Robert Benton Metcalf on 26/04/24.
6//
7
8#ifndef pixelmap_h
9#define pixelmap_h
10
11#include <vector>
12#include <tuple>
13#include <type_traits>
14
15#include "utilities_slsim.h"
16#include "point.h"
17#include "cpfits.h"
18
19struct Grid;
20struct GridMap;
21class Source;
22
23
25enum class PixelMapUnits {
26 ndef // not defined
27 ,surfb // ergs / s / cm**2
28 ,count_per_sec
29 ,ADU // Analogue-to-Digital Units
30 ,mass
31 ,mass_density
32};
33
34std::string to_string(PixelMapUnits unit);
35
40template <typename T=double>
42{
43
44 static_assert( std::is_same<T, float>::value || std::is_same<T, double>::value
45 , "PixeMap can only be instantated with a double or float template argument");
46
47public:
48 PixelMap(const PixelMap<T>& pmap, double res_ratio);
49 PixelMap();
50 PixelMap(const PixelMap<T>& other);
51 PixelMap(PixelMap<T>&& other);
52 PixelMap(const PixelMap<T>& pmap, const double* center, std::size_t Npixels);
53 PixelMap(const PixelMap<T>& pmap,long nx,long ny, std::size_t Npixels);
54 PixelMap(const double* center, std::size_t Npixels
55 ,double resolution
56 ,PixelMapUnits u = PixelMapUnits::ndef);
57 PixelMap(const double* center, std::size_t Nx, std::size_t Ny
58 ,double resolution
59 ,PixelMapUnits u = PixelMapUnits::ndef);
60
61 PixelMap(std::string fitsfilename
62 ,double my_res=-1
63 ,PixelMapUnits u = PixelMapUnits::ndef
64 ,std::string extension = ""
65 );
66
67 // for conversion from double to float
68 template<typename OtherT>
70
71 ~PixelMap(){
72 map.resize(0);
73 };
74
75
76 PixelMap<T>& operator=(const PixelMap<T> &other);
77 PixelMap<T>& operator=(PixelMap<T> &&other);
78
79 void ChangeUnits(PixelMapUnits u){units=u;}
80 PixelMapUnits getUnits() const {return units;}
81
82 inline bool valid() const { return map.size(); };
83 inline std::size_t size() const { return map.size(); };
84
85 inline std::size_t getNx() const { return Nx; }
86 inline std::size_t getNy() const { return Ny; }
87 inline double getRangeX() const { return rangeX; }
88 inline double getRangeY() const { return rangeY; }
89 //inline double* getCenter() const{ return &center[0]; }
90 void const getCenter(Point_2d &c) const{ c[0]=center[0]; c[1]=center[1];}
91 Point_2d getCenter() const{
92 Point_2d c(center[0],center[1]);
93 return c;
94 }
95 inline double getResolution() const { return resolution; }
96
97 // coordinates of lower left corner
98 inline Point_2d getLLBoundary() const{ return Point_2d(map_boundary_p1[0],map_boundary_p1[1]); }
99
101 double getRA(){return RA;}
103 double getDEC(){return DEC;}
104
106 void setRAandDec(double RAin,double DECin){
107 RA = RAin;
108 DEC = DECin;
109 }
110
111 // Zero the whole map
112 void Clean(){for(auto &a : map) a = 0;}
113
114 void AddImages(ImageInfo *imageinfo,int Nimages,float rescale = 1.);
115 void AddImages(std::vector<ImageInfo> &imageinfo,int Nimages,float rescale = 1.);
117 void AddGridBrightness(Grid &grid);
119 void AddGridMapBrightness(const GridMap &grid);
120 void AddUniformImages(ImageInfo *imageinfo,int Nimages,T value);
121 PosType AddSource(Source &source);
123 PosType AddSource(Source &source,int oversample);
124 void AddPointSource(const Point_2d &x,T flux);
125
132 void copy_in(const PixelMap& pmap);
133
142 void paste(const PixelMap& pmap);
143
145 void paste(const PixelMap& pmap,long nx,long ny);
146
154 PixelMap<T> convolve(const PixelMap<T> &kernel);
155 PixelMap<T> convolve2(const PixelMap<T> &kernel);
156
157
163 PixelMap<T> cutout(long xmin,long xmax,long ymin,long ymax);
164
169 void duplicate(const PixelMap& pmap);
170
172 template <typename S>
173 PosType AddSource_parallel(S &source,int oversample){
174 Point_2d s_center;
175 source.getTheta(s_center);
176
177 if( (s_center[0] + source.getRadius() ) < map_boundary_p1[0] ) return 0.0;
178 if( (s_center[0] - source.getRadius() ) > map_boundary_p2[0] ) return 0.0;
179 if( (s_center[1] + source.getRadius() ) < map_boundary_p1[1] ) return 0.0;
180 if( (s_center[1] - source.getRadius() ) > map_boundary_p2[1] ) return 0.0;
181
182 int nthreads = Utilities::GetNThreads();
183 PosType totals[nthreads];
184 std::vector<std::thread> thr;
185
186 size_t block = map.size()/nthreads;
187 for(int i = 0; i < nthreads ;++i){
188 thr.push_back(std::thread(&PixelMap<T>::addsource_<S>,this
189 ,i*block,std::min((i+1)*block-1,map.size()-1)
190 ,oversample,std::ref(source)
191 ,std::ref(totals[i])));
192 }
193
194 for(int ii=0;ii < nthreads;++ii) thr[ii].join();
195
196 PosType total =0;
197 for(int ii=0;ii < nthreads;++ii) total += totals[ii];
198
199 return total;
200 }
201
202 void AddCurve(ImageInfo *curve,T value);
203 void AddCurve(Kist<Point> *imagekist,T value);
204 void AddCurve(std::vector<Point_2d> &curve,T value);
205 void AddCurve(std::vector<RAY> &curve,T value);
206
208 void drawline(double x1[],double x2[],T value,bool add);
210 void DrawLine(long x0,long x1,long y0,long y1,T value,bool add);
211 void DrawLineGS(long x0,long x1,long y0,long y1,T value,bool add);
212 void drawcircle(PosType r_center[],PosType radius,PosType value);
213 void drawdisk(PosType r_center[],PosType radius,PosType value,int Nstrip);
214 void AddGrid(const Grid &grid,T value = 1.0);
215 void AddGrid(const Grid &grid,LensingVariable val);
216
217 void Renormalize(T factor);
218 void AddValue(std::size_t i, T value);
219 void AssignValue(std::size_t i, T value);
220 void printASCII() const;
221 void printASCIItoFile(std::string filename) const;
222 void printFITS(std::string filename,bool Xflip = false, bool ctype = false, bool verbose = false);
223 void printFITS(std::string filename,std::vector< std::tuple<std::string,double,std::string> > &extra_header_info, bool verbose);
224
226 void printFITS(std::string filename
227 ,std::vector<std::string> &headercards
228 );
229
230 void smooth(double sigma);
231
232 inline T getValue(std::size_t i) const { return map[i]; }
233 inline T & operator[](std::size_t i) { return map[i]; };
234 inline T operator[](std::size_t i) const { return map[i]; };
235 inline T & operator()(std::size_t i) { return map[i]; };
236 inline T operator()(std::size_t i) const { return map[i]; };
237 inline T operator()(std::size_t i,std::size_t j) const { return map[i + Nx*j]; };
238 inline T & operator()(std::size_t i,std::size_t j) { return map[i + Nx*j]; };
239
240 PixelMap& operator+=(const PixelMap& rhs);
241 void operator+=(float f){map +=f;};
242 void operator+=(double f){map +=f;};
243 //friend PixelMap operator+(const PixelMap&, const PixelMap&);
244 PixelMap operator+(const PixelMap&) const;
245
246 PixelMap& operator-=(const PixelMap& rhs);
247 //friend PixelMap operator-(const PixelMap&, const PixelMap&);
248 PixelMap operator-(const PixelMap&) const;
249 void operator-=(float f){map -=f;};
250 void operator-=(double f){map -=f;};
251
252 PixelMap& operator*=(const PixelMap& rhs);
253 //friend PixelMap operator*(const PixelMap&, const PixelMap&);
254 PixelMap operator*(const PixelMap& a) const;
255 PixelMap operator/(const PixelMap& a) const;
256
257 PixelMap& operator*=(PosType b);
258 PixelMap operator*(PosType b) const;
259
260 std::valarray<T>& data() { return map; }
261
263 bool agrees(const PixelMap& other) const;
264
265 //friend void swap(PixelMap&, PixelMap&);
266 static void swap(PixelMap<T>&, PixelMap<T>&);
267
269 PosType ave() const {return map.sum()/map.size();}
271 PosType sum() const {return map.sum();};
273 size_t size(){return map.size();}
274 T max() const{ return map.max(); }
275 T min() const{ return map.min(); }
276
277 void FindArc(PosType &radius,PosType *xc,PosType *arc_center,PosType &arclength,PosType &width
278 ,PosType threshold);
279
281 long find_index(PosType const x[],long &ix,long &iy) const;
283 long find_index(PosType const x[]) const;
284
286 long find_index(PosType x,PosType y,long &ix,long &iy) const;
288 long find_index(PosType x,PosType y) const;
289
291 void find_position(PosType x[],std::size_t const index) const;
293 void find_position(PosType x[],std::size_t const ix,std::size_t const iy) const;
294
297 PosType theta
298 ,T scale=1
299 );
300
302 T linear_interpolate(PosType x[]);
303
305 void drawgrid(int N,PosType value);
306 void drawPoints(std::vector<Point *> points,PosType size,PosType value);
307
308 void drawPoints(std::vector<Point> points,PosType size,PosType value);
309
310 void drawCurve(std::vector<Point *> points,PosType value){
311 for(int i=0;i<points.size()-1;++i) drawline(points[i]->x,points[i+1]->x,value,false);
312 }
313 void drawCurve(std::vector<Point> points,PosType value){
314 for(int i=0;i<points.size()-1;++i) drawline(points[i].x,points[i+1].x,value,false);
315 }
316 void drawPoints(std::vector<Point_2d> points,PosType size,PosType value);
317 void drawCurve(std::vector<Point_2d> points,PosType value){
318 for(int i=0;i<points.size()-1;++i) drawline(points[i].x,points[i+1].x,value,false);
319 }
321 void drawSquare(PosType p1[],PosType p2[],PosType value);
322 void drawBox(PosType p1[],PosType p2[],PosType value,int Nstrip);
323
325 void PowerSpectrum(std::vector<PosType> &power_spectrum
326 ,std::vector<PosType> &lvec
327 ,bool overwrite = true
328 );
329
331 void PowerSpectrum(std::vector<PosType> &power_spectrum
332 ,const std::vector<PosType> &lbins
333 ,std::vector<PosType> &lave
334 ,bool overwrite = true
335 );
336
337 void AdaptiveSmooth(PosType value);
338
340 void find_contour(T level
341 ,std::vector<std::vector<Point_2d> > &points
342 ,std::vector<bool> &hits_edge
343 ) const;
349
350 void find_islands_holes(T level,
351 std::vector<std::vector<size_t> > &points
352 ) const;
353
366 void lens_definition(T min_sn_per_image
367 ,T pixel_threshold
368 ,int &Nimages
369 ,T &total_sig_noise_source
370 ,std::vector<size_t> &maxima_indexes
371 ,std::vector<std::vector<size_t> > &image_points
372 ,bool &lens_TF
373 ,T &level
374 ,size_t &n_pix_in_source
375 ,bool verbose = false
376 );
377
378
380 std::vector<size_t> maxima(T minlevel) const;
381
388 //int count_islands(std::list<size_t> &pixel_index,std::vector<std::list<size_t>::iterator> &heads) const;
389 int count_islands(std::vector<size_t> &pixel_index) const;
390
392 size_t threshold(std::list<size_t> &pixel_index,PosType value){
393 for(size_t i=0;i<map.size();++i) if(value < map[i]) pixel_index.push_back(i);
394 return pixel_index.size();
395 }
396
398 void flipY(){
399 for(size_t i=0;i<Nx;++i){
400 for(size_t j=0;j<(Ny-1)/2;++j){
401 std::swap( map[i + Nx*j],map[i + Nx*(Ny-j-1)] );
402 }
403 }
404 }
405
406 void flipX(){
407 for(size_t i=0;i<(Nx-1)/2;++i){
408 for(size_t j=0;j<Ny;++j){
409 std::swap( map[i + Nx*j],map[Nx-i-1 + Nx*j] );
410 }
411 }
412 }
413
415 flipX();
416 flipY();
417 }
418
420
421 void recenter(PosType newcenter[2]
422 );
423 void recenter(Point_2d newcenter
424 );
425
426 /* \brief convolve the image with a kernel.
427
428 It is assumed that the size of the kernel is much smaller than the image and
429 that the kernal has the same pixel size as the image.
430 **/
431 //void convolve(PixelMap &kernel,long center_x = 0,long center_y = 0);
432
437 PixelMap<T> downsize(int n
438 );
439
444 PixelMap interpolate(int n);
445
447 void addheader(std::string label,long value,std::string comment){
448 bool found = false;
449 for(auto &a : headers_long){
450 if(std::get<0>(a) == label){
451 std::get<1>(a)=value;
452 std::get<2>(a)=comment;
453 found = true;
454 break;
455 }
456 }
457 if(!found) headers_long.push_back(std::make_tuple(label,value,comment));
458 }
459 void addheader(std::string label,size_t value,std::string comment){
460 bool found = false;
461 for(auto &a : headers_long){
462 if(std::get<0>(a) == label){
463 std::get<1>(a)=value;
464 std::get<2>(a)=comment;
465 found = true;
466 break;
467 }
468 }
469 if(!found) headers_long.push_back(std::make_tuple(label,value,comment));
470 }
471 void addheader(std::string label,float value,std::string comment){
472 bool found = false;
473 for(auto &a : headers_float){
474 if(std::get<0>(a) == label){
475 std::get<1>(a)=value;
476 std::get<2>(a)=comment;
477 found=true;
478 break;
479 }
480 }
481 if(!found) headers_float.push_back(std::make_tuple(label,value,comment));
482 }
483 void addheader(std::string label,double value,std::string comment){
484 bool found = false;
485 for(auto &a : headers_float){
486 if(std::get<0>(a) == label){
487 std::get<1>(a)=value;
488 std::get<2>(a)=comment;
489 found=true;
490 break;
491 }
492 }
493 if(!found) headers_float.push_back(std::make_tuple(label,value,comment));
494 }
495 void addheader(std::string label,std::string value,std::string comment){
496 bool found = false;
497 for(auto &a : headers_string){
498 if(std::get<0>(a) == label){
499 std::get<1>(a)=value;
500 std::get<2>(a)=comment;
501 found=true;
502 break;
503 }
504 }
505 if(!found) headers_string.push_back(std::make_tuple(label,value,comment));
506 }
507
508private:
509 std::vector<std::tuple<std::string,float,std::string> > headers_float;
510 std::vector<std::tuple<std::string,long,std::string> > headers_long;
511 std::vector<std::tuple<std::string,std::string,std::string> > headers_string;
512
513 std::valarray<T> map;
514 long Nx;
515 long Ny;
516 double resolution,rangeX,rangeY,center[2];
517 double RA=0,DEC=0; // optional coordinates of center
518 double map_boundary_p1[2],map_boundary_p2[2];
519 PixelMapUnits units= PixelMapUnits::ndef;
520
521 void AddGrid_(const PointList &list,LensingVariable val);
522
523 double LeafPixelArea(IndexType i,Branch * branch1);
524 void PointsWithinLeaf(Branch * branch1, std::list <unsigned long> &neighborlist);
525 bool inMapBox(Branch * branch1) const;
526 bool inMapBox(double * branch1) const;
527
529 bool pixels_are_neighbors(size_t i,size_t j) const;
533 void _count_islands_(size_t current,std::list<size_t> &reservoir
534 ,std::list<size_t>::iterator &group) const;
535
536 //void addsource_(size_t i1,size_t i2,int oversample,Source source,PosType &total);
537 //void addsource_(size_t i1,size_t i2,int oversample,Po,
538 // PosType &total);
539
540 template <typename S>
541 void addsource_(size_t i1,size_t i2,int oversample,
542 S &source,
543 PosType &total){
544 PosType tmp_res = resolution*1.0/oversample;
545 PosType tmp = tmp_res*tmp_res;
546 PosType bl = resolution /2 - 0.5*tmp_res;
547 PosType y[2],x[2];
548
549 total = 0;
550
551 for(size_t index = i1 ;index <= i2; ++index){
552 find_position(y,index);
553 y[0] -= bl;
554 y[1] -= bl;
555 for(int i = 0 ; i < oversample ; ++i){
556 x[0] = y[0] + i*tmp_res;
557 for(int j=0; j < oversample;++j){
558 x[1] = y[1] + j*tmp_res;
559 map[index] += source.SurfaceBrightness(x)*tmp;
560 total += source.SurfaceBrightness(x)*tmp;
561 }
562 }
563 }
564 }
565
566 // find if pixel k is in the curve which must be in pixel units, meant to be used in conjunction with Utilities::find_boundaries<>
567 bool incurve(long k,std::vector<Point_2d> &curve) const;
568};
569
570template<typename T>
571void swap(PixelMap<T>& x, PixelMap<T>& y)
572{
573 using std::swap;
574
575 swap(x.map,y.map);
576
577 swap(x.Nx, y.Nx);
578 swap(x.Ny, y.Ny);
579 swap(x.resolution, y.resolution);
580 swap(x.rangeX, y.rangeX);
581 swap(x.rangeY, y.rangeY);
582
583 swap(x.center[0], y.center[0]);
584 swap(x.center[1], y.center[1]);
585
586 swap(x.map_boundary_p1[0], y.map_boundary_p1[0]);
587 swap(x.map_boundary_p1[1], y.map_boundary_p1[1]);
588 swap(x.map_boundary_p2[0], y.map_boundary_p2[0]);
589 swap(x.map_boundary_p2[1], y.map_boundary_p2[1]);
590}
591
592#endif /* pixelmap_h */
Image structure that can be manipulated and exported to/from fits files.
Definition pixelmap.h:42
void flipY()
reflects the image about the horizontal mid-line
Definition pixelmap.h:398
void find_contour(T level, std::vector< std::vector< Point_2d > > &points, std::vector< bool > &hits_edge) const
returns a vector of contour curves
Definition pixelmap.cpp:857
void duplicate(const PixelMap &pmap)
copy a PixelMap that must be the same without creating a new one..
Definition pixelmap.cpp:2468
void FindArc(PosType &radius, PosType *xc, PosType *arc_center, PosType &arclength, PosType &width, PosType threshold)
Find arcs in image WARNING: THIS IS UNDER CONSTRUCTION!
Definition pixelmap.cpp:2082
double getRA()
returns right accention of center
Definition pixelmap.h:101
double getDEC()
returns declination of center
Definition pixelmap.h:103
void AddUniformImages(ImageInfo *imageinfo, int Nimages, T value)
Add images with uniform surface brightness set by input parameter value.
Definition pixelmap.cpp:769
void copy_in(const PixelMap &pmap)
copy a PixelMap into this one.
Definition pixelmap.cpp:2480
PixelMap< T > rotate(PosType theta, T scale=1)
rotate and scale the image while keeping pixels, resoluiton
Definition pixelmap.cpp:2305
void AddGridBrightness(Grid &grid)
Add an image from a the surface brightnesses of a Grid to the PixelMap.
Definition pixelmap.cpp:685
PixelMap & operator-=(const PixelMap &rhs)
Subtract the values of another PixelMap from this one.
Definition pixelmap.cpp:566
PixelMap & operator+=(const PixelMap &rhs)
Add the values of another PixelMap to this one.
Definition pixelmap.cpp:542
void drawSquare(PosType p1[], PosType p2[], PosType value)
Draw a rectangle.
Definition pixelmap.cpp:1783
void drawdisk(PosType r_center[], PosType radius, PosType value, int Nstrip)
Draws a disk.
Definition pixelmap.cpp:1681
PixelMap(const PixelMap< T > &pmap, double res_ratio)
Creates a PixelMap at a different resolution. The new counts are calculated integrating over the inpu...
Definition pixelmap.cpp:320
void drawline(double x1[], double x2[], T value, bool add)
simple line
Definition pixelmap.cpp:1531
PosType AddSource_parallel(S &source, int oversample)
Adds source to map. This version breaks pixels up into blocks and does them in seporate threads.
Definition pixelmap.h:173
PixelMap interpolate(int n)
Makes a PixelMap with resolution 1/n of the original with the values linearly interpolated.
Definition pixelmap.cpp:398
void doubleFlip()
rotate the image by 180deg or equivalently reflect it through the origin
Definition pixelmap.h:414
PixelMap & operator*=(const PixelMap &rhs)
Multiply the values of another PixelMap by this one.
Definition pixelmap.cpp:589
void AddCurve(ImageInfo *curve, T value)
Draws a closed curve through the points in curve->imagekist.
Definition pixelmap.cpp:1869
void printASCIItoFile(std::string filename) const
Print an ASCII table of all the pixel values.
Definition pixelmap.cpp:1297
PixelMap< T > convolve(const PixelMap< T > &kernel)
convolve the image with a kernel.
Definition pixelmap.cpp:2642
void AddImages(ImageInfo *imageinfo, int Nimages, float rescale=1.)
Add an image to the map.
Definition pixelmap.cpp:641
void AssignValue(std::size_t i, T value)
Assigns a value to the i-th pixel.
Definition pixelmap.cpp:523
PosType ave() const
return average pixel value
Definition pixelmap.h:269
PixelMap operator*(const PixelMap &a) const
Multiply two PixelMaps.
Definition pixelmap.cpp:618
PixelMap operator-(const PixelMap &) const
Subtract two PixelMaps.
Definition pixelmap.cpp:578
void AddValue(std::size_t i, T value)
Adds a value to the i-th pixel.
Definition pixelmap.cpp:516
int count_islands(std::vector< size_t > &pixel_index) const
For a list of pixel indexes this will count and separated islands that are not connected.
Definition pixelmap.cpp:1150
void recenter(PosType newcenter[2])
recenter the map without changing anything else.
Definition pixelmap.cpp:2730
void find_islands_holes(T level, std::vector< std::vector< size_t > > &points) const
Definition pixelmap.cpp:877
size_t threshold(std::list< size_t > &pixel_index, PosType value)
get a list of pixels above value
Definition pixelmap.h:392
void printASCII() const
Print an ASCII table of all the pixel values.
Definition pixelmap.cpp:1286
void flipX()
reflects the image about the vertical mid-line
Definition pixelmap.h:406
PixelMap< T > downsize(int n)
Creates a PixelMap with a lower resolution. The value of the pixels are added for the new pixels....
Definition pixelmap.cpp:371
PixelMap operator+(const PixelMap &) const
Add two PixelMaps.
Definition pixelmap.cpp:555
void PowerSpectrum(std::vector< PosType > &power_spectrum, std::vector< PosType > &lvec, bool overwrite=true)
Find the power spectrum of the map.
Definition pixelmap.cpp:2753
void drawBox(PosType p1[], PosType p2[], PosType value, int Nstrip)
Draws a box (filling the inside with horizontal lines, starting from the top)
Definition pixelmap.cpp:1815
PixelMap operator/(const PixelMap &a) const
Multiply two PixelMaps.
Definition pixelmap.cpp:627
void setRAandDec(double RAin, double DECin)
set the coordinates of center
Definition pixelmap.h:106
PosType sum() const
return sum of all pixel values
Definition pixelmap.h:271
void AddGridMapBrightness(const GridMap &grid)
Add an image from a the surface brightnesses of a GridMap to the PixelMap.
Definition pixelmap.cpp:720
void Renormalize(T factor)
Multiplies the whole map by a scalar factor.
Definition pixelmap.cpp:509
long find_index(PosType const x[], long &ix, long &iy) const
get the index for a position, returns -1 if out of map, this version returns the 2D grid coordinates
Definition pixelmap.cpp:2227
void paste(const PixelMap &pmap)
Replace overlaping pixel values with those of the input map.
Definition pixelmap.cpp:2576
size_t size()
Total number of pixels.
Definition pixelmap.h:273
void AddGrid(const Grid &grid, T value=1.0)
Fills in pixels where the image plane points in the grid are located with the value given.
Definition pixelmap.cpp:1936
void find_position(PosType x[], std::size_t const index) const
get the index for a position, returns -1 if out of map
Definition pixelmap.cpp:2278
PixelMap< T > cutout(long xmin, long xmax, long ymin, long ymax)
cut out a part of the PixelMap
Definition pixelmap.cpp:2712
void smooth(double sigma)
Smoothes a map with a Gaussian kernel of width sigma (in arcseconds)
Definition pixelmap.cpp:1465
void drawcircle(PosType r_center[], PosType radius, PosType value)
Draws a circle.
Definition pixelmap.cpp:1657
T linear_interpolate(PosType x[])
interpolate to point x[]
Definition pixelmap.cpp:2340
bool agrees(const PixelMap &other) const
Check whether two PixelMaps agree in their physical dimensions.
Definition pixelmap.cpp:529
std::vector< size_t > maxima(T minlevel) const
find maxima that are above minlevel
Definition pixelmap.cpp:942
void printFITS(std::string filename, bool Xflip=false, bool ctype=false, bool verbose=false)
Output the pixel map as a fits file.
Definition pixelmap.cpp:1318
void lens_definition(T min_sn_per_image, T pixel_threshold, int &Nimages, T &total_sig_noise_source, std::vector< size_t > &maxima_indexes, std::vector< std::vector< size_t > > &image_points, bool &lens_TF, T &level, size_t &n_pix_in_source, bool verbose=false)
Definition pixelmap.cpp:984
void addheader(std::string label, long value, std::string comment)
add a heaader keyword that will appear in fits output
Definition pixelmap.h:447
void DrawLine(long x0, long x1, long y0, long y1, T value, bool add)
line by Bresenham's line algorithm
Definition pixelmap.cpp:1578
void drawgrid(int N, PosType value)
draw a grid on the image that divides the each demension into N cells
Definition pixelmap.cpp:1717
Base class for all sources.
Definition source.h:44
int GetNThreads()
returns the compiler variable N_THREADS that is maximum number of threads to be used.
Definition utilities.cpp:553
LensingVariable
output lensing variables
Definition standard.h:89
Structure to contain both source and image trees.
Definition grid_maintenance.h:24
A simplified version of the Grid structure for making non-adaptive maps of the lensing quantities (ka...
Definition gridmap.h:31
Structure for storing information about images or curves.
Definition image_info.h:20
Class for representing points or vectors in 2 dimensions. Not that the dereferencing operator is over...
Definition point.h:48