vtkgdcm
vtkImageColorViewer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
56 #ifndef VTKIMAGECOLORVIEWER_H
57 #define VTKIMAGECOLORVIEWER_H
58 
59 #include "vtkgdcmModule.h"
60 #include "vtkObject.h"
61 #include "vtkVersion.h"
62 
63 class vtkAlgorithm;
64 class vtkAlgorithmOutput;
65 class vtkImageActor;
66 class vtkImageData;
68 class vtkInformation;
69 class vtkInteractorStyleImage;
70 class vtkRenderWindow;
71 class vtkRenderer;
72 class vtkRenderWindowInteractor;
73 class vtkPolyData;
74 
75 class VTKGDCM_EXPORT vtkImageColorViewer : public vtkObject
76 {
77 public:
79  vtkTypeMacro(vtkImageColorViewer,vtkObject);
80  void PrintSelf(ostream& os, vtkIndent indent);
81 
85  virtual const char *GetWindowName();
86 
90  virtual void Render(void);
91 
93 
96 #if (VTK_MAJOR_VERSION >= 6)
97  virtual void SetInputData(vtkImageData *in);
98 #else
99  virtual void SetInput(vtkImageData *in);
100 #endif
101  virtual vtkImageData *GetInput();
102  virtual void SetInputConnection(vtkAlgorithmOutput* input);
103  virtual void AddInputConnection(vtkAlgorithmOutput* input);
104  virtual void AddInput(vtkImageData * input);
105  //virtual void AddInput(vtkPolyData * input);
107 
109  void SetOverlayVisibility(double vis);
110 
112 
116  enum
117  {
118  SLICE_ORIENTATION_YZ = 0,
119  SLICE_ORIENTATION_XZ = 1,
120  SLICE_ORIENTATION_XY = 2
121  };
122  //ETX
123  vtkGetMacro(SliceOrientation, int);
124  virtual void SetSliceOrientation(int orientation);
125  virtual void SetSliceOrientationToXY()
126  { this->SetSliceOrientation(vtkImageColorViewer::SLICE_ORIENTATION_XY); };
127  virtual void SetSliceOrientationToYZ()
128  { this->SetSliceOrientation(vtkImageColorViewer::SLICE_ORIENTATION_YZ); };
129  virtual void SetSliceOrientationToXZ()
130  { this->SetSliceOrientation(vtkImageColorViewer::SLICE_ORIENTATION_XZ); };
132 
134 
138  vtkGetMacro(Slice, int);
139  virtual void SetSlice(int s);
141 
154  virtual void UpdateDisplayExtent();
155 
157 
161  virtual int GetSliceMin();
162  virtual int GetSliceMax();
163  virtual void GetSliceRange(int range[2])
164  { this->GetSliceRange(range[0], range[1]); }
165  virtual void GetSliceRange(int &min, int &max);
166  virtual int* GetSliceRange();
168 
170 
173  virtual double GetColorWindow();
174  virtual double GetColorLevel();
175  virtual void SetColorWindow(double s);
176  virtual void SetColorLevel(double s);
178 
180 
183  virtual void SetDisplayId(void *a);
184  virtual void SetWindowId(void *a);
185  virtual void SetParentId(void *a);
187 
189 
192  virtual int* GetPosition();
193  virtual void SetPosition(int a,int b);
194  virtual void SetPosition(int a[2]) { this->SetPosition(a[0],a[1]); }
196 
198 
201  virtual int* GetSize();
202  virtual void SetSize(int a, int b);
203  virtual void SetSize(int a[2]) { this->SetSize(a[0],a[1]); }
205 
207 
211  vtkGetObjectMacro(RenderWindow,vtkRenderWindow);
212  vtkGetObjectMacro(Renderer, vtkRenderer);
213  vtkGetObjectMacro(ImageActor,vtkImageActor);
214  vtkGetObjectMacro(WindowLevel,vtkImageMapToWindowLevelColors2);
215  vtkGetObjectMacro(InteractorStyle,vtkInteractorStyleImage);
217 
219 
222  virtual void SetRenderWindow(vtkRenderWindow *arg);
223  virtual void SetRenderer(vtkRenderer *arg);
225 
229  virtual void SetupInteractor(vtkRenderWindowInteractor*);
230 
232 
237  virtual void SetOffScreenRendering(int);
238  virtual int GetOffScreenRendering();
239  vtkBooleanMacro(OffScreenRendering,int);
241 
245  VTK_LEGACY(int GetWholeZMin());
246 
250  VTK_LEGACY(int GetWholeZMax());
251 
255  VTK_LEGACY(int GetZSlice());
256 
260  VTK_LEGACY(void SetZSlice(int));
261 
262 protected:
265 
266  virtual void InstallPipeline();
267  virtual void UnInstallPipeline();
268 
270  vtkRenderWindow *RenderWindow;
271  vtkRenderer *Renderer;
272  vtkImageActor *ImageActor;
273  vtkImageActor *OverlayImageActor;
274  vtkRenderWindowInteractor *Interactor;
275  vtkInteractorStyleImage *InteractorStyle;
276 
279  int Slice;
280 
281  virtual void UpdateOrientation();
282 
283 #if (VTK_MAJOR_VERSION >= 6)
284  vtkAlgorithm* GetInputAlgorithm();
285  vtkInformation* GetInputInformation();
286 #endif
287 
288  friend class vtkImageColorViewerCallback;
289 
290 private:
291  vtkImageColorViewer(const vtkImageColorViewer&); // Not implemented.
292  void operator=(const vtkImageColorViewer&); // Not implemented.
293 };
294 
295 #endif
Display a 2D image.
double GetOverlayVisibility()
virtual void SetColorWindow(double s)
virtual void SetInputConnection(vtkAlgorithmOutput *input)
static vtkImageColorViewer * New()
virtual void SetSliceOrientationToXZ()
virtual void SetSliceOrientationToXY()
virtual void UnInstallPipeline()
virtual void SetWindowId(void *a)
virtual void SetOffScreenRendering(int)
Create a window in memory instead of on the screen.
virtual void Render(void)
Render the resulting image.
vtkInteractorStyleImage * InteractorStyle
virtual void AddInputConnection(vtkAlgorithmOutput *input)
vtkImageActor * OverlayImageActor
virtual void AddInput(vtkImageData *input)
vtkRenderWindow * RenderWindow
virtual void SetSize(int a[2])
virtual void SetSlice(int s)
virtual void SetColorLevel(double s)
vtkImageMapToWindowLevelColors2 * WindowLevel
virtual void SetRenderer(vtkRenderer *arg)
virtual double GetColorLevel()
virtual void SetInput(vtkImageData *in)
Set/Get the input image to the viewer.
void PrintSelf(ostream &os, vtkIndent indent)
virtual void InstallPipeline()
vtkRenderWindowInteractor * Interactor
virtual void SetRenderWindow(vtkRenderWindow *arg)
Set your own renderwindow and renderer.
virtual void UpdateOrientation()
void SetOverlayVisibility(double vis)
virtual void SetPosition(int a, int b)
virtual int * GetSize()
Set/Get the size of the window in screen coordinates in pixels.
virtual void SetParentId(void *a)
virtual vtkImageData * GetInput()
virtual void SetupInteractor(vtkRenderWindowInteractor *)
Attach an interactor for the internal render window.
virtual int * GetPosition()
Set/Get the position in screen coordinates of the rendering window.
virtual void SetSize(int a, int b)
virtual int GetOffScreenRendering()
vtkImageActor * ImageActor
virtual void SetSliceOrientationToYZ()
virtual int GetSliceMin()
Return the minimum and maximum slice values (depending on the orientation this can be in X,...
virtual void GetSliceRange(int &min, int &max)
virtual void UpdateDisplayExtent()
Update the display extent manually so that the proper slice for the given orientation is displayed.
virtual int GetSliceMax()
virtual void SetDisplayId(void *a)
These are here when using a Tk window.
virtual const char * GetWindowName()
Get the name of rendering window.
virtual void GetSliceRange(int range[2])
virtual void SetPosition(int a[2])
virtual void SetSliceOrientation(int orientation)
virtual int * GetSliceRange()
virtual double GetColorWindow()
Set window and level for mapping pixels to colors.
map the input image through a lookup table and window / level it