source: branches/pixel-map-branch/src/PixelMap/Scan.hh @ 246

Last change on this file since 246 was 246, checked in by Matthew Whiting, 17 years ago

Summary of changes:

  • Rather than storing centres, the Objects now keep the xSum, ySum etc and return xSum/float(numPix) as the result for xCentre.
  • To do this, we also keep track of the number of pixels in each object. Each time a pixel, scan or object is added, we increment the number by the correct amount.
  • These parameters are also calculated as we go, rather than all at once.
  • Detection::calcParams() changed to Detection::calcFluxes(), so that it just works out the flux-related parameters. Things like xCentre etc are done in the Objects.
  • areClose() improved to work at the Scan level, rather than looking at each pixel. It only compares Scans within the appropriate y-range.
  • Other functions simplified include logDetectionList() and trimImage().
  • Scan::join() and Scan::isCommon() changed to Scan::unite() and Scan::intersect().
File size: 1.3 KB
Line 
1#ifndef SCAN_H
2#define SCAN_H
3
4#include <iostream>
5
6class Scan
7{
8public:
9  Scan(){itsY=-1;itsX=-1;itsXLen=0;};
10  Scan(long y, long x, long xl){itsY=y; itsX=x; itsXLen=xl;};
11  Scan(const Scan& s){itsY=s.itsY; itsX=s.itsX; itsXLen=s.itsXLen;};
12  Scan& operator= (const Scan& s){itsY=s.itsY; itsX=s.itsX; itsXLen=s.itsXLen;};
13  virtual ~Scan(){};
14  void define(long y, long x, long xl){itsY=y; itsX=x; itsXLen=xl;};
15  void clear(){itsY=0;itsX=0;itsXLen=0;};
16  long getY(){return itsY;};
17  void setY(long l){itsY=l;};
18  long getX(){return itsX;};
19  void setX(long l){itsX=l;};
20  long getXlen(){return itsXLen;};
21  void setXlen(long l){itsXLen=l;};
22  long getXmax(){return itsX+itsXLen-1;};
23  void setXmax(long l){itsXLen = l-itsX+1;};
24  void growLeft(){itsX--;itsXLen++;};
25  void growRight(){itsXLen++;};
26
27  void addOffsets(long xoff, long yoff){itsY+=yoff; itsX+=xoff;};
28
29  bool isInScan(long x, long y);
30
31  friend std::ostream& operator<< ( std::ostream& theStream, Scan& scan);
32  friend bool operator< (Scan lhs, Scan rhs);
33  friend bool operator== (Scan lhs, Scan rhs);
34  friend class Object2D;
35
36private:
37  long itsY;
38  long itsX;
39  long itsXLen;
40
41};
42
43Scan unite(Scan &s1, Scan &s2);
44Scan intersect(Scan &s1, Scan &s2);
45bool touching(Scan &s1, Scan &s2);
46bool overlap(Scan &s1, Scan &s2);
47bool adjacent(Scan &scan1, Scan &scan2);
48Scan nullScan();
49
50#endif //SCAN_H
Note: See TracBrowser for help on using the repository browser.