My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
MultipleImagePlotter.h
Go to the documentation of this file.
1 // $Id: MultipleImagePlotter.h,v 1.1.1.1 2009/07/06 23:57:23 eml Exp $
2 
3 #ifndef GCP_GRABBER_MULTIPLEIMAGEPLOTTER_H
4 #define GCP_GRABBER_MULTIPLEIMAGEPLOTTER_H
5 
16 #include <iostream>
17 
18 #include "gcp/pgutil/common/ImagePlotter.h"
19 
20 #include "gcp/util/common/Angle.h"
21 #include "gcp/util/common/ImageHandler.h"
22 
23 #include "gcp/control/code/unix/viewer_src/color_tab.h"
24 
25 namespace gcp {
26  namespace grabber {
27 
29  public:
30 
31  // Constructor.
32 
34 
35  // Destructor.
36 
37  virtual ~MultipleImagePlotter();
38 
39  // Set the current image to the specified index
40 
41  void setCurrentImage(unsigned short imageIndex);
42  unsigned short getCurrentChannel();
43 
44  // Return the current Image
45 
46  ImagePlotter& currentImage();
47 
48  // Return the requested image
49 
50  ImagePlotter& getImage(unsigned iChan);
51 
52  // Open a new pgplot device
53 
54  void open(char* device);
55  void draw(bool cmapUpdate=false);
56  void drawDouble();
57  void setGridInterval(gcp::util::Angle& interval);
58 
59  // Install a new image in the image buffer
60 
61  void installNewImage(unsigned short channel, unsigned short* image);
62 
63  void testDraw();
64 
65  // Given a pixel, in grabber pixel orientation, return the world
66  // coordinate
67 
68  void pixelToWorld(unsigned ix, unsigned iy, double& x, double& y);
69 
70  // Convert from world to pixel coordinate. If truncate = true,
71  // and the world coordinate lies outside the image boundary, the
72  // returned pixel values will be truncated to the nearest valid
73  // pixel. If truncate = false, this function will throw an
74  // error if the world coordinate lies outside the image
75 
76  void worldToPixel(double x, double y, unsigned& ix, unsigned& iy,
77  bool truncate=false);
78 
79  void worldToSkyOffset(double x, double y,
80  gcp::util::Angle& xsky, gcp::util::Angle& ysky);
81 
82  // Reset plot limits
83 
84  void setPlotBoundaries();
85 
86  // Calculate plot limits
87 
88  void calculatePlotLimits();
89 
90  // Set a peak location (in pixel units)
91 
92  void setPeak(unsigned ix, unsigned iy);
93 
94  bool& doGrid();
95 
96  bool& doCompass();
97 
98  bool& doBullseye();
99 
100  bool& doCrosshair();
101 
102  void setContrast(double contrast = ImagePlotter::defaultContrast_);
103  void setBrightness(double brightness = ImagePlotter::defaultBrightness_);
104 
105  void installColormap(std::string cmap);
106 
107  // Fiddle the contrast and brightness of a frame grabber image
108 
109  void fiddleContrast(double xa, double ya);
110 
111  void setDisplayedRange(double xa, double xb, double ya, double yb);
112  void setDisplayedRange();
113 
114  void initialize();
115  void getGreyscale();
116  void drawImage(bool cmapUpdate=false);
117  void drawGrid();
118  void drawBullseye();
119  void drawCompass();
120  void drawCrosshair();
121 
122  //------------------------------------------------------------
123  // The following functions are virtual, so that inheritors can
124  // define what else, if anything, should happen when these
125  // parameters are reset
126  //------------------------------------------------------------
127 
128  // Public method to set the deck angle rotation sense
129 
130  virtual void setDeckAngleRotationSense(gcp::control::RotationSense sense);
131 
132  // Public method to set the number of images to combine
133 
134  virtual void setNCombine(unsigned ncombine);
135 
136  // Public method to set the channel
137 
138  virtual void setChannel(unsigned channel);
139 
140  // Public method to set the flatfield
141 
142  virtual void setFlatfieldType(unsigned flatfieldType);
143 
144  // Public method to set the optical camera image directions
145 
146  virtual void setXImDir(gcp::control::ImDir dir);
147 
148 
149  // Public method to set the optical camera image directions
150 
151  virtual void setYImDir(gcp::control::ImDir dir);
152 
153  // Public method to reset the optical camera FOV
154 
155  virtual void setFov(const gcp::util::Angle& fov);
156 
157  // Public method to set the optical camera FOV
158 
159  virtual void setAspectRatio(double aspectRatio);
160 
161  // Public method to set the optical camera collimation
162 
163  virtual void setRotationAngle(const gcp::util::Angle& rotationAngle);
164 
165  // Public method to set the deck angle
166 
167  virtual void setDeckAngle(const gcp::util::Angle& deckAngle);
168 
169  // Get statistics on the last received image
170 
172 
174  getStats(unsigned ixmin, unsigned iymin,
175  unsigned ixmax, unsigned iymax);
176 
177  // Return the offset of the peak in x and y, converted to
178  // horizontal and vertical offsets, in degrees
179 
180  void getOffsetInfo(gcp::util::Angle& horiz, gcp::util::Angle& vert,
181  unsigned& ipeak, unsigned& jpeak);
182 
183  // Return information about the peak
184 
185  void getPeakInfo(double& peak, double& snr);
186 
187 
188  private:
189 
190  std::vector<ImagePlotter> images_;
191 
192  unsigned imageIndex_;
193 
194  }; // End class MultipleImagePlotter
195 
196  } // End namespace grabber
197 } // End namespace gcp
198 
199 
200 
201 #endif // End #ifndef GCP_GRABBER_MULTIPLEIMAGEPLOTTER_H
Definition: MultipleImagePlotter.h:28
Definition: ImageHandler.h:35
virtual ~MultipleImagePlotter()
Definition: MultipleImagePlotter.cc:24
MultipleImagePlotter()
Definition: MultipleImagePlotter.cc:16
Definition: Angle.h:20
Definition: ImagePlotter.h:27