GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vtkViewImage3D.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 _vtkViewImage3D_h_
69 #define _vtkViewImage3D_h_
70 
71 #include "vtkViewImage.h"
72 #include "MegaVTK2Configure.h"
73 
75 
76 #include <vtkImageActor.h>
77 #include <vtkRenderer.h>
78 #include <vtkImageMapToWindowLevelColors.h>
79 #include <vtkImageMapToColors.h>
80 #include "vtkOrientedBoxWidget.h"
81 #include <vtkPlaneWidget.h>
82 #include <vtkOrientationMarkerWidget.h>
83 #include <vtkVolumeProperty.h>
85 #include <vtkObjectFactory.h>
86 
87 #include <vector>
88 
89 // For the picked/unpicked actors
90 #include <list>
91 #include "vtkProp3D.h"
92 
94 class vtkSmartVolumeMapper;
95 class vtkVolume;
96 class vtkImageActor;
97 class vtkAxes;
98 class vtkDataSet3DCroppingPlaneCallback;
99 class vtkTubeFilter;
100 class vtkAnnotatedCubeActor;
101 class vtkOrientationMarkerWidget;
102 class vtkAxesActor;
103 class vtkViewImage2D;
104 class vtkScalarsToColors;
105 class vtkColorTransferFunction;
106 
107 class ImageActorCallback;
108 
109 class vtkPlanes;
110 
117 class VTK_RENDERINGADDON2_EXPORT vtkViewImage3D:public vtkViewImage
118 {
119 public:
123  static vtkViewImage3D * New();
124 
126 
127  // Description:
128  // Render the resulting image.
129  virtual void Render(void);
130 
140 // virtual vtkQuadricLODActor*
141  virtual vtkActor * AddDataSet(vtkDataSet *dataset,
142  vtkProperty *property = NULL,
143  const bool & intersection = true,
144  const bool & iDataVisibility = false);
145 
150  virtual void SetSlice(int s){ (void)s; }
151  virtual void SetSliceOrientation(int orientation){ (void)orientation; }
152  // Description:
153  // Update the display extent manually so that the proper slice for the
154  // given orientation is displayed. It will also try to set a
155  // reasonable camera clipping range.
156  // This method is called automatically when the Input is changed, but
157  // most of the time the input of this class is likely to remain the same,
158  // i.e. connected to the output of a filter, or an image reader. When the
159  // input of this filter or reader itself is changed, an error message might
160  // be displayed since the current display extent is probably outside
161  // the new whole extent. Calling this method will ensure that the display
162  // extent is reset properly.
163  virtual void UpdateDisplayExtent(){}
164 
165  virtual void Add2DPhantom(
166  const unsigned int & i,
167  vtkImageActor *input,
168  vtkPolyData *in_bounds = NULL);
169 
170  virtual void SetOrientationMatrix(vtkMatrix4x4 *matrix);
171 
172  /*
173  * \brief Set volume rendering on
174  */
175  void SetVolumeRenderingOn(const std::vector<vtkImageData*>& iImages,
176  const std::vector<vtkPiecewiseFunction*>& iOpacities);
177 
178  /*
179  * \brief Set volume rendering off
180  */
181  void SetVolumeRenderingOff();
182 
183  /*
184  * \brief Set TriPlanar rendering on
185  */
186  void SetTriPlanarRenderingOn();
187 
188  /*
189  * \brief Set TriPlanar rendering off
190  */
191  void SetTriPlanarRenderingOff();
192 
197  void SetCubeVisibility(const bool & a)
198  {
199  if ( this->Interactor ) { this->Marker->SetEnabled (a); }
200  }
201 
206  bool GetCubeVisibility(void)
207  {
208  return ( this->Marker->GetEnabled() == 1 );
209  }
210 
211  vtkBooleanMacro (CubeVisibility, int);
212 
217  void SetShade(const bool & a)
218  {
219  this->VolumeProperty->SetShade (a);
220  }
221 
226  bool GetShade(void)
227  {
228  return ( this->VolumeProperty->GetShade() == 1 );
229  }
230 
231  vtkBooleanMacro (Shade, int);
232 
234  vtkGetObjectMacro (VolumeActor, vtkVolume);
235  //vtkGetObjectMacro (PlaneWidget, vtkPlaneWidget);
236  vtkGetObjectMacro (VolumeProperty, vtkVolumeProperty);
237  //vtkGetObjectMacro (BoxWidget, vtkOrientedBoxWidget);
238 
239  virtual void SetWorldCoordinates(double pos[3]) { (void)pos; }
240 
245  void SetBoundsActorsVisibility(bool iVisibility);
246 
251  vtkInteractorStyleImage3D * GetInteractorStyle3D();
252 
254 
260  void ComputeDistances(double *n, double *origin);
261 
266  void ComputeDistancesToSquare(vtkPlanes *planes);
267 
268  std::vector< vtkProp3D * > GetPlanesActors();
269 
270 protected:
271 
272  vtkViewImage3D();
273  ~vtkViewImage3D();
274 
275  // Description:
276  virtual void InstallPipeline();
277 
278  virtual void UpdateOrientation(){}
279 
280  virtual void SetupWidgets();
281 
282  void CleanVolumeRenderingVectors();
283 
284  // texture mapper in 3D
285  vtkSmartVolumeMapper *SmartVolumeMapper3D;
286  // volume property
287  vtkVolumeProperty *VolumeProperty;
288  // volume actor
289  vtkVolume *VolumeActor;
290 
291  std::vector<vtkVolume*> m_VolumeActors;
292  std::vector<vtkSmartVolumeMapper*> m_VolumeMappers;
293  std::vector<vtkVolumeProperty*> m_VolumeProperties;
294 
295  // image 3D cropping box callback
297 
298  std::vector< vtkImageActor * > Phantom;
299  std::vector< ImageActorCallback * > PhantomCallback;
300  std::vector< vtkActor * > BoundsActor;
301 
302  // box widget
303  //vtkOrientedBoxWidget* BoxWidget;
304  // vtkPlane widget
305  // vtkPlaneWidget* PlaneWidget;
306  // annotated cube actor
307  vtkAnnotatedCubeActor * Cube;
308  vtkOrientationMarkerWidget *Marker;
309 
317 };
318 
319 #endif /* _vtkViewImage3D_h_ */
bool GetShade(void)
Get the shade.
vtkOrientationMarkerWidget * Marker
vtkAnnotatedCubeActor * Cube
virtual void SetWorldCoordinates(double pos[3])
virtual void UpdateOrientation()
virtual void UpdateDisplayExtent()
std::vector< vtkSmartVolumeMapper * > m_VolumeMappers
vtkVolume * VolumeActor
vtkGetObjectMacro(CornerAnnotation, vtkCornerAnnotation)
Get the corner annotation.
std::vector< vtkImageActor * > Phantom
std::vector< ImageActorCallback * > PhantomCallback
void SetShade(const bool &a)
Set the shade.
vtkInteractorStyleImage3D * InteractorStyle3D
std::vector< vtkVolumeProperty * > m_VolumeProperties
vtkTypeRevisionMacro(vtkViewImage, vtkImageViewer2)
virtual void SetSlice(int s)
void SetCubeVisibility(const bool &a)
Set the cube visibility.
Basic class to handle items such as images and polydatas visualization in 3D.
vtkImage3DCroppingBoxCallback * Callback
virtual void SetOrientationMatrix(vtkMatrix4x4 *matrix)
bool GetCubeVisibility(void)
Get the cube visibility.
vtkViewImage3DCommand * Command
Callback to be called by the box widget to render only what is inside the box widget.
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
vtkSmartVolumeMapper * SmartVolumeMapper3D
virtual void Render(void)
std::vector< vtkActor * > BoundsActor
vtkBooleanMacro(ShowAnnotations, int)
Set the annotation status. 0: annotations are not visible 1: annotations are visible.
std::vector< vtkVolume * > m_VolumeActors
virtual void SetSliceOrientation(int orientation)
Define the interactor behavior withing a vtkImage3D. 4 modes (Default, Zoom, Pan and Pick) ...
vtkVolumeProperty * VolumeProperty
Manage events occuring in 3D view.
Basic class to handle 2D/3D items such as images and polydatas visualization in 2D.