GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vtkViewImage.h
Go to the documentation of this file.
1 /*========================================================================
2  Copyright (c) INRIA - ASCLEPIOS Project (http://www-sop.inria.fr/asclepios).
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  * Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  * Neither the name of INRIA or ASCLEPIOS, nor the names of any contributors
16  may be used to endorse or promote products derived from this software
17  without specific prior written permission.
18 
19  * Modified source versions must be plainly marked as such, and must not be
20  misrepresented as being the original software.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
23  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
26  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  =========================================================================*/
33 
34 /*=========================================================================
35  Modifications were made by the GoFigure Dev. Team.
36  while at Megason Lab, Systems biology, Harvard Medical school, 2009-11
37 
38  Copyright (c) 2009-11, President and Fellows of Harvard College.
39  All rights reserved.
40 
41  Redistribution and use in source and binary forms, with or without
42  modification, are permitted provided that the following conditions are met:
43 
44  Redistributions of source code must retain the above copyright notice,
45  this list of conditions and the following disclaimer.
46  Redistributions in binary form must reproduce the above copyright notice,
47  this list of conditions and the following disclaimer in the documentation
48  and/or other materials provided with the distribution.
49  Neither the name of the President and Fellows of Harvard College
50  nor the names of its contributors may be used to endorse or promote
51  products derived from this software without specific prior written
52  permission.
53 
54  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
56  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
58  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
59  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
60  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
61  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
62  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
63  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
64  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 
66  =========================================================================*/
67 
68 #ifndef _vtkViewImage_h_
69 #define _vtkViewImage_h_
70 
71 #include "MegaVTK2Configure.h"
72 #include "vtkImageViewer2.h"
73 
74 #include <vtkRenderer.h>
75 #include <vtkTextProperty.h>
76 #include <vtkCornerAnnotation.h>
77 #include <vtkActor.h>
78 #include <vtkDataSet.h>
79 
80 #include <vector>
81 
88 //BTX
89 #define vtkSetObjectMacro2Body(object, type, _arg) \
90  if ( this->object == _arg ) { return; } \
91  if ( this->object ) \
92  { \
93  this->object->UnRegister(this); \
94  } \
95  this->object = _arg; \
96  \
97  if ( this->object != NULL ) \
98  { \
99  this->object->Register(this); \
100  } \
101  \
102  this->Modified(); \
103 //ETX
104 
111 //BTX
112 #define vtkSetObjectMacro2(object, type) \
113  virtual void Set ## object (type * _arg) \
114  { \
115  vtkSetObjectMacro2Body (object, type, _arg); \
116  } \
117 
118 //ETX
119 
120 class vtkMatrix4x4;
121 class vtkScalarBarActor;
122 class vtkLookupTable;
123 class vtkTextProperty;
124 class vtkCornerAnnotation;
126 // class vtkQuadricLODActor;
127 class vtkActor;
128 class vtkDataSet;
129 class vtkPolyData;
130 class vtkProperty;
131 class vtkMatrixToLinearTransform;
132 class vtkRenderWindowInteractor;
133 
134 class vtkInteractorStyle;
135 class vtkColorTransferFunction;
136 class vtkProp3D;
137 class vtkProp;
138 class vtkTransform;
139 class vtkScalarsToColors;
140 
183 class VTK_RENDERINGADDON2_EXPORT vtkViewImage:public vtkImageViewer2
184 {
185 public:
186  vtkTypeRevisionMacro(vtkViewImage, vtkImageViewer2);
187 
188  virtual void SetInput(vtkImageData *input);
189 
190  // Description:
191  // Render the resulting image.
192  virtual void Render(void);
193 
197  virtual vtkRenderWindowInteractor * GetInteractor();
198 
199  virtual vtkRenderWindowInteractor * GetRenderWindowInteractor();
200 
206  vtkGetObjectMacro(CornerAnnotation, vtkCornerAnnotation);
211  vtkGetObjectMacro(ScalarBarActor, vtkScalarBarActor);
229  vtkGetObjectMacro(OrientationMatrix, vtkMatrix4x4);
230  virtual void SetOrientationMatrix(vtkMatrix4x4 *matrix);
231 
237  vtkGetObjectMacro(LookupTable, vtkLookupTable);
238  virtual void SetLookupTable(vtkLookupTable *lookuptable);
239 
247  vtkGetObjectMacro(TextProperty, vtkTextProperty);
248  virtual void SetTextProperty(vtkTextProperty *textproperty);
249 
262  void SetWorldCoordinates(const double & x,
263  const double & y, const double & z);
264 
265  virtual void SetWorldCoordinates(double pos[3]) = 0;
266 
276  virtual void SetSlice(int iSlice)
277  {
278  int *range = this->GetSliceRange();
279  if (range)
280  {
281  if (iSlice < range[0])
282  {
283  iSlice = range[0];
284  }
285  else if (iSlice > range[1])
286  {
287  iSlice = range[1];
288  }
289  }
290 
291  if (this->Slice == iSlice)
292  {
293  return;
294  }
295 
296  this->Slice = iSlice;
297  this->Modified();
298 
299  this->UpdateDisplayExtent();
300  }
301 
302  virtual void Update(void){}
303 
308  virtual double *GetWorldCoordinatesFromImageCoordinates(int indices[3]);
312  virtual int *GetImageCoordinatesFromWorldCoordinates(double position[3]);
317  virtual double GetValueAtPosition(double worldcoordinates[3],
318  int component = 0);
323  virtual void SetBackground(double rgb[3]);
324  virtual void SetBackground(const double & r,
325  const double & g,
326  const double & b);
327 
328  virtual double * GetBackground(void);
329 
333  virtual void ResetCamera(void);
334 
339  void SetCameraPosition(double *arg);
340 
345  double * GetCameraPosition(void);
346 
352  void SetCameraFocalPoint(double *arg);
353 
359  double * GetCameraFocalPoint(void);
360 
366  void SetCameraViewUp(double *arg);
367 
373  double * GetCameraViewUp(void);
374 
379  void SetCameraParallelScale(double arg);
380 
385  double GetCameraParallelScale(void);
386 
390  virtual void Reset(void);
391 
397  vtkBooleanMacro (ShowAnnotations, int);
398 
404  vtkGetMacro (ShowAnnotations, int);
411  virtual void SetShowAnnotations(const int & iShowAnnotations);
412 
416  virtual void Enable(void);
417 
421  virtual void Disable(void);
422 
426  virtual bool GetEnabled(void);
427 
433  vtkBooleanMacro(ShowScalarBar, int);
434 
440  vtkGetMacro(ShowScalarBar, int);
444  virtual void SetShowScalarBar(const bool &);
445 
447  virtual void SetColorWindow(double s);
448 
449  virtual void SetColorLevel(double s);
450 
454  virtual void ResetWindowLevel(void);
455 
456  void UpdateWindowLevel();
457 
465  double * GetCurrentPoint(void)
466  { return this->CurrentPoint; }
467 
475  void GetCurrentPoint(double point[3])
476  {
477  point[0] = this->CurrentPoint[0];
478  point[1] = this->CurrentPoint[1];
479  point[2] = this->CurrentPoint[2];
480  }
481 
487  vtkGetMacro(IsColor, bool);
488 
490  vtkSetMacro( IntersectionLineWidth, float );
491 
493  vtkGetMacro( IntersectionLineWidth, float );
494 
495  void SetWindow(double iWindow);
496  double GetWindow();
497 
498  void SetLevel(double iLevel);
499  double GetLevel();
500 
501 protected:
502 
503  vtkViewImage();
504  ~vtkViewImage();
505 
523  vtkMatrix4x4 *OrientationMatrix;
530  vtkCornerAnnotation *CornerAnnotation;
535  vtkTextProperty *TextProperty;
540  vtkLookupTable *LookupTable;
545  vtkScalarBarActor *ScalarBarActor;
550  vtkMatrixToLinearTransform *OrientationTransform;
551 
552  std::string DirectionAnnotationMatrix[3][2];
553 
555 
566  double CurrentPoint[3];
567 
568  bool IsColor;
569 
570  double Window;
571  double Level;
572 };
573 
574 #endif /* _vtkViewImage_h_ */
float IntersectionLineWidth
Definition: vtkViewImage.h:554
vtkTextProperty * TextProperty
Definition: vtkViewImage.h:535
Text annotation in four corners.
vtkScalarBarActor * ScalarBarActor
Definition: vtkViewImage.h:545
void GetCurrentPoint(double point[3])
Get the current position in world coordinate.
Definition: vtkViewImage.h:475
This class is a top-level convenience class for displaying a scalar - or RGB image in a 2D or 3D scen...
Definition: vtkViewImage.h:183
virtual void Update(void)
Definition: vtkViewImage.h:302
vtkMatrix4x4 * OrientationMatrix
Definition: vtkViewImage.h:523
vtkMatrixToLinearTransform * OrientationTransform
Definition: vtkViewImage.h:550
vtkCornerAnnotation * CornerAnnotation
Definition: vtkViewImage.h:530
virtual void SetSlice(int iSlice)
Set/Get the current slice to display (depending on the orientation this can be in X...
Definition: vtkViewImage.h:276
double * GetCurrentPoint(void)
Get the current position in world coordinate.
Definition: vtkViewImage.h:465
vtkLookupTable * LookupTable
Definition: vtkViewImage.h:540