SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkOverlayViewController.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2009-2014 The Regents of the University of California.
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  * • Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * • Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * • None of the names of any campus of the University of California, the name
13  * "The Regents of the University of California," or the names of any of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
26  * OF SUCH DAMAGE.
27  */
28 
29 
30 
31 /*
32  * $URL$
33  * $Rev$
34  * $Author$
35  * $Date$
36  *
37  * Authors:
38  * Jason C. Crane, Ph.D.
39  * Beck Olson
40  */
41 
42 
43 #ifndef SVK_OVERLAY_VIEW_CONTROLLER_H
44 #define SVK_OVERLAY_VIEW_CONTROLLER_H
45 
46 // standard headers
47 #include <map>
48 #include <vector>
49 #include <sstream>
50 #include <math.h>
51 
52 // vtk headers
53 #include <vtkImageData.h>
54 #include <vtkRenderWindow.h>
55 #include <vtkRenderWindowInteractor.h>
56 #include <vtkActorCollection.h>
57 #include <vtkImageViewer2.h>
58 #include <vtkActor.h>
59 #include <vtkActor2D.h>
60 #include <vtkCallbackCommand.h>
61 #include <vtkRenderer.h>
62 #include <vtkCommand.h>
63 #include <vtkCamera.h>
64 #include <vtkCollectionIterator.h>
65 #include <vtkCoordinate.h>
66 #include <vtkInteractorStyleImage.h>
67 #include <vtkInteractorObserver.h>
68 #include <vtkImageMapToWindowLevelColors.h>
69 #include <vtkCornerAnnotation.h>
70 #include <vtkPolyDataMapper2D.h>
71 #include <vtkPolyData.h>
72 #include <vtkCubeSource.h>
73 #include <vtkObjectFactory.h>
74 #include <vtkProperty2D.h>
75 #include <vtkTextActor.h>
76 #include <vtkTextProperty.h>
77 #include <vtkAxesActor.h>
78 #include <vtkPointPicker.h>
79 #include <vtkPlane.h>
80 
81 #include <svkOverlayView.h>
82 #include <svkOverlaySelector.h>
83 #include <svkDataView.h>
84 #include <svkLookupTable.h>
85 
86 
87 namespace svk {
88 
89 
90 using namespace std;
91 
92 class svkOverlayView;
93 
102 {
103 
104  public:
105 
106 
108 
109  static svkOverlayViewController* New();
110 
113 
114  enum InteractorStyle { SELECTION, WINDOW_LEVEL, COLOR_OVERLAY, ROTATION };
115 
118  REFERENCE_IMAGE = 0,
119  IMAGE_OVERLAY
120  };
121 
122 
123  // Methods
124  virtual void SetInput( svkImageData* data, int index = 0 );
125  virtual void SetSlice( int slice );
126  virtual void SetSlice( int slice, bool centerImage );
127  virtual void SetSlice(int slice, svkDcmHeader::Orientation orientation);
128  virtual int GetImageSlice( svkDcmHeader::Orientation sliceOrientation = svkDcmHeader::UNKNOWN_ORIENTATION );
129  virtual void SetRWInteractor(vtkRenderWindowInteractor*);
130  virtual void TurnPropOn( int propIndex );
131  virtual void TurnPropOff( int propIndex );
132  virtual int* GetTlcBrc();
133  virtual void SetTlcBrc( int* tlcBrc );
134  void SetOverlayOpacity(double opacity);
135  void SetOverlayThreshold(double threshold);
136  double GetOverlayThreshold();
137  double GetOverlayThresholdValue();
138  void SetLevel(double level, WindowLevelTarget target = REFERENCE_IMAGE);
139  double GetLevel(WindowLevelTarget target = REFERENCE_IMAGE);
140  void SetWindow(double window, WindowLevelTarget target = REFERENCE_IMAGE);
141  double GetWindow(WindowLevelTarget target = REFERENCE_IMAGE);
142  int GetCurrentStyle();
143  void SetCurrentStyle( int style );
144  void UseWindowLevelStyle();
145  void UseColorOverlayStyle();
146  void UseSelectionStyle();
147  void UseRotationStyle();
148  void ResetWindowLevel();
149  void HighlightSelectionVoxels();
150  void Reset();
151  string GetDataCompatibility( svkImageData* data, int targetIndex );
152  void SetInterpolationType( int interpolationType);
153  void SetLUT( svkLookupTable::svkLookupTableType type );
154  void TurnOrthogonalImagesOn();
155  void TurnOrthogonalImagesOff();
156  bool IsImageInsideSpectra();
157 
158 
159 
160  protected:
161 
163  enum DataInputs {
164  MRI = 0,
165  MR4D = 1,
166  MET = 2
167  };
168 
170 
174  vtkRenderWindow* myRenderWindow;
176  vtkCallbackCommand* cursorLocationCB;
178  vtkCallbackCommand* dragSelectionCB;
180  vtkCallbackCommand* colorOverlayCB;
181  vtkCallbackCommand* interactorSwitchCB;
183  //vtkCornerAnnotation* mousePositionText;
184  vtkTextActor* mousePositionText;
186  vtkRenderer* mouseLocRenderer;
188  vtkInteractorObserver* windowLevelStyle;
190  vtkInteractorObserver* colorOverlayStyle;
192  vtkInteractorObserver* rotationStyle;
196  vtkActor* scanBoundryActor;
197  double initialColorWindowLevel[2];
198  int pickPos[2];
199  double startOpacity;
201 
202  private:
203 
204 
205  void InitDisplayText( );
206  void CreateDataVisualization();
207 
208  // Callback Command methods
209  static void UpdateCursorLocation( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
210  static void UpdateInteractor( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
211  static void UpdateSelection( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
212  static void ColorWindowLevel( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
213 };
214 
215 
216 } //svk
217 
218 
219 #endif //SVK_OVERLAY_VIEW_CONTROLLER_H
Definition: svkOverlayViewController.h:114
vtkCallbackCommand * dragSelectionCB
callback that responds to left click to highlight voxels
Definition: svkOverlayViewController.h:178
vtkTextActor * mousePositionText
the actor that represents the mouse location
Definition: svkOverlayViewController.h:184
vtkInteractorObserver * windowLevelStyle
interactor style for window leveling
Definition: svkOverlayViewController.h:188
bool visualizationCreated
enum represents data indicies
Definition: svkOverlayViewController.h:172
WindowLevelTarget
Enum for window level targets.
Definition: svkOverlayViewController.h:117
vtkCallbackCommand * cursorLocationCB
callback that responds to mouse movements to update cursor location display
Definition: svkOverlayViewController.h:176
vtkRenderWindow * myRenderWindow
the views render window
Definition: svkOverlayViewController.h:174
Orientation
Definition: svkDcmHeader.h:101
svkLookupTableType
Definition: svkLookupTable.h:63
Definition: svkDataViewController.h:72
vtkActor * scanBoundryActor
actor that represents the scan boundry
Definition: svkOverlayViewController.h:196
vtkCallbackCommand * colorOverlayCB
callback that responds to left click to highlight voxels
Definition: svkOverlayViewController.h:180
int currentInteractorStyle
Definition: svkOverlayViewController.h:200
vtkRenderer * mouseLocRenderer
the renderer used to display the mouse location
Definition: svkOverlayViewController.h:186
svkOverlaySelector * dragSelectStyle
interactor style for selecting voxels
Definition: svkOverlayViewController.h:194
vtkInteractorObserver * colorOverlayStyle
interactor style for window leveling
Definition: svkOverlayViewController.h:190
Definition: svkOverlayViewController.h:101
Definition: svkOverlaySelector.h:70
Definition: svkImageData.h:107
double startOpacity
Definition: svkOverlayViewController.h:199
vtkCallbackCommand * interactorSwitchCB
Definition: svkOverlayViewController.h:181
InteractorStyle
Definition: svkOverlayViewController.h:114
vtkInteractorObserver * rotationStyle
interactor style for 3D rotation
Definition: svkOverlayViewController.h:192
DataInputs
enum represents data indicies
Definition: svkOverlayViewController.h:163
Definition: svkDcmHeader.h:102