Orfeo Toolbox  3.16
otbImageAlternateViewer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbImageAlternateViewer_h
19 #define __otbImageAlternateViewer_h
20 
21 #include "vcl_deprecated_header.h"
22 
23 #include "FL/Fl_Gl_Window.H"
24 #include "itkObject.h"
25 #include "otbImageList.h"
30 #include "otbImage.h"
31 
32 #include <FL/gl.h>
33 #include "itkImageRegionSplitter.h"
34 
35 namespace otb
36 {
44 template <class TPixel>
46  : public Fl_Gl_Window, public itk::Object
47 {
48 public:
54 
56  itkNewMacro(Self);
57 
59  itkTypeMacro(ImageAlternateViewer, Object);
60 
62  typedef TPixel PixelType;
67  typedef typename ImageType::SizeType SizeType;
68  typedef typename ImageType::IndexType IndexType;
71  typedef typename ImageType::PointType PointType;
72 
76 
80 
82  typedef typename SplitterType::Pointer SplitterPointerType;
83 
84  itkSetMacro(RedChannelIndex, unsigned int);
85  itkGetMacro(RedChannelIndex, unsigned int);
86 
87  itkSetMacro(GreenChannelIndex, unsigned int);
88  itkGetMacro(GreenChannelIndex, unsigned int);
89 
90  itkSetMacro(BlueChannelIndex, unsigned int);
91  itkGetMacro(BlueChannelIndex, unsigned int);
92 
93  itkSetMacro(MaxComponentValues, VectorPixelType);
94  itkGetMacro(MaxComponentValues, VectorPixelType);
95 
96  itkSetMacro(MinComponentValues, VectorPixelType);
97  itkGetMacro(MinComponentValues, VectorPixelType);
98 
99  itkSetMacro(SpacingZoomFactor, double);
100  itkGetMacro(SpacingZoomFactor, double);
101 
102  itkSetMacro(OpenGlIsotropicZoom, double);
103  itkGetMacro(OpenGlIsotropicZoom, double);
104 
105  void SetViewedRegionCenter(const IndexType& index);
106  itkGetMacro(ViewedRegionCenter, IndexType);
107 
108  itkSetObjectMacro(Image, ImageType);
109  itkGetObjectMacro(Image, ImageType);
110 
111  itkSetObjectMacro(SecondImage, ImageType);
112  itkGetObjectMacro(SecondImage, ImageType);
113 
114  itkSetMacro(DisplayExtent, RegionType);
115  itkGetMacro(DisplayExtent, RegionType);
116 
117  itkGetObjectMacro(ZoomInInterpolator, InterpolatorType);
118  itkSetObjectMacro(ZoomInInterpolator, InterpolatorType);
119  itkGetObjectMacro(ZoomOutInterpolator, InterpolatorType);
120  itkSetObjectMacro(ZoomOutInterpolator, InterpolatorType);
121 
125  void SetViewModelToRGB(void);
129  void SetViewModelToGrayscale(void);
130 
134  void SetInsightViewModelToRGB(void);
135 
139  void SetInsightViewModelToGrayscale(void);
140 
142  unsigned char Normalize(PixelType value, unsigned int channelIndex);
143 
144  void Show(void);
145 
146  void Reset(void);
147 
149  virtual void Init(int x, int y, int w, int h, const char * l);
150 
152  virtual void resize(int x, int y, int w, int h);
153 
154 protected:
158  virtual ~ImageAlternateViewer();
159 
161  virtual void draw(void);
162 
164  virtual void Draw(unsigned char * buffer, RegionType& region);
165 
167  virtual void ResetOpenGlContext(void);
168 
170  virtual int handle(int event);
171 
172  /* /\** Rebuild opengl buffer *\/ */
173  /* virtual void RebuildOpenGlBuffer(void); */
174 
175  virtual void IncrementalOpenGlBufferUpdate(void);
176 
177  RegionType GetAdditionalBufferRegion(unsigned int i);
178 
179  unsigned char * CreateAdditionalBuffer(RegionType region, ImagePointerType image, bool rgb);
180 
181  virtual void MergeBuffersAndFreeMemory(std::vector<unsigned char *> bufferList,
182  std::vector<RegionType> bufferRegionList);
183 
184  virtual void AdditionalRedraw(void);
185 
186  virtual void DecorationRedraw(void);
187 
188  virtual void DrawRegionBoundary(RegionType& region);
189 
190  virtual long IndexInOldGrid(PointType point, PointType oldUpperLeft, SpacingType spacing, SizeType size);
191 
192  RegionType ComputeRequestedRegion(RegionType& region);
194  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
195 
196 private:
197  ImageAlternateViewer(const Self &); //purposely not implemented
198  void operator =(const Self&); //purposely not implemented
199 
203  unsigned char * m_OpenGlBuffer;
210  unsigned int m_RedChannelIndex;
212  unsigned int m_GreenChannelIndex;
214  unsigned int m_BlueChannelIndex;
232  double m_ZoomStep;
239 
242 
245 
248 
251 
252  std::vector<unsigned char *> m_BufferList;
253  std::vector<RegionType> m_BufferRegionList;
254 
260  bool m_Drag;
262  unsigned int m_DragEventCounter;
265 
274 
275 };
276 } // End namespace otb
277 #ifndef OTB_MANUAL_INSTANTIATION
279 #endif
280 
281 #endif

Generated at Sun Feb 3 2013 00:26:04 for Orfeo Toolbox with doxygen 1.8.1.1