SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkSpectraReferenceViewController.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 
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 svkSpectraReferenceView;
93 
102 {
103 
104  public:
105 
106 
108 
109  static svkSpectraReferenceViewController* New();
110 
113 
114  enum InteractorStyle { SELECTION, WINDOW_LEVEL, COLOR_OVERLAY, ROTATION };
115 
116  // Methods
117  virtual void SetInput( svkImageData* data, int index = 0 );
118  virtual void SetSlice( int slice );
119  virtual void SetSlice( int slice, bool centerImage );
120  virtual void SetSlice(int slice, svkDcmHeader::Orientation orientation);
121  virtual int GetImageSlice( svkDcmHeader::Orientation sliceOrientation = svkDcmHeader::UNKNOWN_ORIENTATION );
122  virtual void SetRWInteractor(vtkRenderWindowInteractor*);
123  virtual void TurnPropOn( int propIndex );
124  virtual void TurnPropOff( int propIndex );
125  virtual int* GetTlcBrc();
126  virtual void SetTlcBrc( int* tlcBrc );
127  void SetOverlayOpacity(double opacity);
128  void SetOverlayThreshold(double threshold);
129  double GetOverlayThreshold();
130  double GetOverlayThresholdValue();
131  int GetCurrentStyle();
132  void SetCurrentStyle( int style );
133  void UseWindowLevelStyle();
134  void UseColorOverlayStyle();
135  void UseSelectionStyle();
136  void UseRotationStyle();
137  void ResetWindowLevel();
138  void HighlightSelectionVoxels();
139  void Reset();
140  string GetDataCompatibility( svkImageData* data, int targetIndex );
141  void SetInterpolationType( int interpolationType);
142  void SetLUT( svkLookupTable::svkLookupTableType type );
143  void TurnOrthogonalImagesOn();
144  void TurnOrthogonalImagesOff();
145  bool IsImageInsideSpectra();
146 
147 
148 
149  protected:
150 
152  enum DataInputs {
153  MRI = 0,
154  MRS = 1,
155  MET = 2
156  };
157 
159 
163  vtkRenderWindow* myRenderWindow;
165  vtkCallbackCommand* cursorLocationCB;
167  vtkCallbackCommand* dragSelectionCB;
169  vtkCallbackCommand* colorOverlayCB;
170  vtkCallbackCommand* interactorSwitchCB;
172  //vtkCornerAnnotation* mousePositionText;
173  vtkTextActor* mousePositionText;
175  vtkRenderer* mouseLocRenderer;
177  vtkInteractorObserver* windowLevelStyle;
179  vtkInteractorObserver* colorOverlayStyle;
181  vtkInteractorObserver* rotationStyle;
185  vtkActor* scanBoundryActor;
186  double initialColorWindowLevel[2];
187  int pickPos[2];
188  double startOpacity;
190 
191  private:
192 
193 
194 
195  // Callback Command methods
196  static void UpdateCursorLocation( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
197  static void UpdateInteractor( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
198  static void UpdateSelection( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
199  static void ColorWindowLevel( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
200 };
201 
202 
203 } //svk
204 
205 
206 #endif //SVK_OVERLAY_VIEW_CONTROLLER_H
vtkRenderWindow * myRenderWindow
the views render window
Definition: svkSpectraReferenceViewController.h:163
vtkInteractorObserver * colorOverlayStyle
interactor style for window leveling
Definition: svkSpectraReferenceViewController.h:179
vtkInteractorObserver * rotationStyle
interactor style for 3D rotation
Definition: svkSpectraReferenceViewController.h:181
Definition: svkSpectraReferenceViewController.h:114
bool visualizationCreated
enum represents data indicies
Definition: svkSpectraReferenceViewController.h:161
InteractorStyle
Definition: svkSpectraReferenceViewController.h:114
vtkInteractorObserver * windowLevelStyle
interactor style for window leveling
Definition: svkSpectraReferenceViewController.h:177
DataInputs
enum represents data indicies
Definition: svkSpectraReferenceViewController.h:152
Orientation
Definition: svkDcmHeader.h:101
double startOpacity
Definition: svkSpectraReferenceViewController.h:188
vtkCallbackCommand * colorOverlayCB
callback that responds to left click to highlight voxels
Definition: svkSpectraReferenceViewController.h:169
vtkActor * scanBoundryActor
actor that represents the scan boundry
Definition: svkSpectraReferenceViewController.h:185
svkOverlaySelector * dragSelectStyle
interactor style for selecting voxels
Definition: svkSpectraReferenceViewController.h:183
int currentInteractorStyle
Definition: svkSpectraReferenceViewController.h:189
svkLookupTableType
Definition: svkLookupTable.h:63
Definition: svkDataViewController.h:72
vtkCallbackCommand * interactorSwitchCB
Definition: svkSpectraReferenceViewController.h:170
vtkCallbackCommand * cursorLocationCB
callback that responds to mouse movements to update cursor location display
Definition: svkSpectraReferenceViewController.h:165
Definition: svkSpectraReferenceViewController.h:101
Definition: svkOverlaySelector.h:70
vtkRenderer * mouseLocRenderer
the renderer used to display the mouse location
Definition: svkSpectraReferenceViewController.h:175
vtkTextActor * mousePositionText
the actor that represents the mouse location
Definition: svkSpectraReferenceViewController.h:173
Definition: svkImageData.h:107
vtkCallbackCommand * dragSelectionCB
callback that responds to left click to highlight voxels
Definition: svkSpectraReferenceViewController.h:167
Definition: svkDcmHeader.h:102