SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkSpectraReferenceView.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 #ifndef SVK_OVERLAY_VIEW_H
43 #define SVK_OVERLAY_VIEW_H
44 
45 
46 #include <vtkImageViewer2.h>
47 #include <vtkRenderWindow.h>
48 #include <vtkRenderWindowInteractor.h>
49 #include <vtkRenderer.h>
50 #include <vtkCamera.h>
51 #include <vtkImageMapToWindowLevelColors.h>
52 #include <vtkProp3DCollection.h>
53 #include <vtkAreaPicker.h>
54 #include <vtkImageActor.h>
55 #include <vtkObjectFactory.h>
56 #include <vtkExtractEdges.h>
57 #include <vtkCellData.h>
58 #include <vtkPointData.h>
59 #include <vtkPlane.h>
60 #include <vtkColorTransferFunction.h>
61 #include <vtkLookupTable.h>
62 #include <vtkScalarBarActor.h>
63 
65 #include <svkImageViewer2.h>
66 #include <svkDataView.h>
67 #include <svkMrsImageData.h>
68 #include <svkDataValidator.h>
69 #include <svkObliqueReslice.h>
70 #include <svkPlotLineGrid.h>
71 #include <svkImageMapToColors.h>
72 #include <svkLookupTable.h>
73 #include <svkSatBandSet.h>
74 
75 
76 namespace svk {
77 
78 
79 // Determines how close to the voxels things are clipped
80 #define CLIP_TOLERANCE 0.001
81 
82 class svkDataViewController;
83 class svkSpectraReferenceViewController;
84 
94 {
96 
97  public:
98  // vtk type revision macro
100 
101  static svkSpectraReferenceView* New();
102 
105 
106  // Methods:
107  virtual void SetInput( svkImageData* data, int index = 0);
108  virtual void SetSlice(int slice);
109  virtual void SetSlice(int slice, bool centerImage );
111  virtual void SetRWInteractor( vtkRenderWindowInteractor* );
112  virtual void SetWindowLevelRange( double lower, double upper, int index );
113  virtual void GetWindowLevelRange( double &lower, double &upper, int index );
114  void SetComponent( svkPlotLine::PlotComponent component );
115  string GetDataCompatibility( svkImageData* data, int targetIndex );
116  void TurnOrthogonalImagesOn();
121  void AlignCamera();
122  bool IsImageInsideSpectra();
124 
126  typedef enum {
130 
131 
133  enum DataInputs {
134  MRI = 0,
135  MRS = 1,
137  };
138 
140  enum PropType {
159  };
160 
163  NEAREST = 0,
166  };
167 
170  PRIMARY = 0,
173  };
174 
176  enum {
179  } ColorSchema;
180 
181 
182 
183  protected:
184 
187 
190 
192  vtkRenderWindow* myRenderWindow;
193 
196 
201 
202  // Transfer function for rendering overlays
204 
205 
206  // Methods:
207  void SetupMrInput( bool firstInput );
208  void SetupMsInput( bool firstInput );
209  void UpdateImageSlice( bool centerImage );
210  void SetSelection( double* selectionArea, bool isWorldCords = 0 );
211  void SetOverlayOpacity( double opacity );
212  double GetOverlayOpacity( );
213  void SetOverlayThreshold( double threshold );
214  double GetOverlayThreshold( );
215  void SetTlcBrc( int* tlcBrc );
217  void GenerateClippingPlanes( );
218  void SetupOverlay();
219  void SetInterpolationType( int interpolationType );
221  void ResetWindowLevel();
228 
229  private:
230 
231  void SetSliceOverlay();
232  void ResliceImage(svkImageData* input, svkImageData* target, int targetIndex);
233 
234  double overlayOpacity;
235  double overlayThreshold;
236 
237 
239  InterpolationType interpolationType;
240 
242  svkSatBandSet* satBandsAxial;
243  svkSatBandSet* satBandsCoronal;
244  svkSatBandSet* satBandsSagittal;
245 
246 
247 
248 };
249 
250 
251 } //svk
252 
253 
254 #endif //SVK_OVERLAY_VIEW_H
bool imageInsideSpectra
Definition: svkSpectraReferenceView.h:195
double GetOverlayThreshold()
Definition: svkSpectraReferenceView.cc:849
Definition: svkSpectraReferenceView.h:143
void ToggleSelBoxVisibilityOn()
Definition: svkSpectraReferenceView.cc:1686
void TurnOrthogonalImagesOn()
Definition: svkSpectraReferenceView.cc:1444
void ToggleSelBoxVisibilityOff()
Definition: svkSpectraReferenceView.cc:1707
Definition: svkImageMapToColors.h:66
Definition: svkSpectraReferenceView.h:134
Definition: svkSpectraReferenceView.h:164
Definition: svkImageViewer2.h:71
void SetComponent(svkPlotLine::PlotComponent component)
Definition: svkSpectraReferenceView.cc:778
Definition: svkSpectraReferenceView.h:149
svkLookupTable * GetLookupTable()
Definition: svkSpectraReferenceView.cc:1299
void SetupMsInput(bool firstInput)
Definition: svkSpectraReferenceView.cc:220
Definition: svkDataView.h:73
svkImageViewer2 * imageViewer
the vtkImageViewer2 object used to display the image
Definition: svkSpectraReferenceView.h:189
Definition: svkSpectraReferenceView.h:163
Definition: svkSpectraReferenceView.h:147
int FindCenterImageSlice(int spectraSlice, svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:576
void TurnOrthogonalImagesOff()
Definition: svkSpectraReferenceView.cc:1453
virtual void SetSlice(int slice)
Definition: svkSpectraReferenceView.cc:442
~svkSpectraReferenceView()
Definition: svkSpectraReferenceView.cc:161
svkPlotLineGrid * plotGrid
Represents the plotted lines of the grid.
Definition: svkSpectraReferenceView.h:186
bool IsImageInsideSpectra()
Definition: svkSpectraReferenceView.cc:1752
svkDcmHeader::Orientation orientation
Definition: svkDataView.h:162
svkImageMapToColors * windowLevelerAxial
Object used to window livel the overlay.
Definition: svkSpectraReferenceView.h:198
bool AreAllSatBandsOn(svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:1613
void SetOverlayOpacity(double opacity)
Definition: svkSpectraReferenceView.cc:808
Definition: svkSatBandSet.h:71
Definition: svkSpectraReferenceView.h:153
void UpdateImageSlice(bool centerImage)
Definition: svkSpectraReferenceView.cc:608
Definition: svkPlotLineGrid.h:84
void SetInterpolationType(int interpolationType)
Definition: svkSpectraReferenceView.cc:1268
virtual void GetWindowLevelRange(double &lower, double &upper, int index)
Definition: svkSpectraReferenceView.cc:759
Definition: svkSpectraReferenceView.h:150
Definition: svkSpectraReferenceView.h:93
Orientation
Definition: svkDcmHeader.h:101
string GetDataCompatibility(svkImageData *data, int targetIndex)
Definition: svkSpectraReferenceView.cc:1356
Definition: svkSpectraReferenceView.h:158
double GetOverlayOpacity()
Definition: svkSpectraReferenceView.cc:824
void ResetWindowLevel()
Resets the window level, source taken from vtkImageViewer2.
Definition: svkSpectraReferenceView.cc:1425
void SetSelection(double *selectionArea, bool isWorldCords=0)
Definition: svkSpectraReferenceView.cc:671
Definition: svkSpectraReferenceView.h:151
Definition: svkSpectraReferenceView.h:142
Definition: svkSpectraReferenceView.h:146
virtual void SetRWInteractor(vtkRenderWindowInteractor *)
Definition: svkSpectraReferenceView.cc:647
Definition: svkSpectraReferenceView.h:154
Definition: svkSpectraReferenceView.h:178
int FindSpectraSlice(int imageSlice, svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:592
WindowLevelRanges
Enum represents different color schemes. Used for printing.
Definition: svkSpectraReferenceView.h:126
vtkRenderWindow * myRenderWindow
the render window in which the view is to be displayed
Definition: svkSpectraReferenceView.h:192
static svkSpectraReferenceView * New()
PropType
Enum represents objects in the scene.
Definition: svkSpectraReferenceView.h:140
enum svk::svkSpectraReferenceView::@10 ColorSchema
Enum represents color schema, used for printing.
void SetTlcBrc(int *tlcBrc)
Definition: svkSpectraReferenceView.cc:724
int slice
Definition: svkDataView.h:166
svkLookupTableType
Definition: svkLookupTable.h:63
vtkTypeMacro(svkSpectraReferenceView, svkDataView)
int * HighlightSelectionVoxels()
Definition: svkSpectraReferenceView.cc:790
Definition: svkSpectraReferenceView.h:157
Definition: svkSpectraReferenceView.h:127
bool IsSatBandForSliceOn(svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:1559
bool toggleSelBoxVisibility
Definition: svkSpectraReferenceView.h:194
Definition: svkSpectraReferenceView.h:170
Definition: svkSpectraReferenceView.h:136
void SetOrientation(svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:1462
Definition: svkSpectraReferenceView.h:145
Definition: svkSpectraReferenceView.h:177
void GenerateClippingPlanes()
Definition: svkSpectraReferenceView.cc:860
Definition: svkSpectraReferenceView.h:165
Definition: svkSpectraReferenceView.h:144
void AlignCamera()
Definition: svkSpectraReferenceView.cc:1721
virtual void SetWindowLevelRange(double lower, double upper, int index)
Definition: svkSpectraReferenceView.cc:745
Definition: svkSpectraReferenceView.h:148
Definition: svkSpectraReferenceView.h:141
PlotComponent
Definition: svkPlotLine.h:68
Definition: svkSpectraReferenceView.h:156
Definition: svkSpectraReferenceView.h:135
svkLookupTable * colorTransfer
Definition: svkSpectraReferenceView.h:203
svkImageMapToColors * windowLevelerSagittal
Definition: svkSpectraReferenceView.h:200
Definition: svkSpectraReferenceViewController.h:101
void SetupMrInput(bool firstInput)
Definition: svkSpectraReferenceView.cc:327
virtual void SetInput(svkImageData *data, int index=0)
Definition: svkSpectraReferenceView.cc:403
Definition: svkImageData.h:107
bool IsSatBandOutlineForSliceOn(svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:1586
InterpolationType
Enum represents interpolation methods for the overlay.
Definition: svkSpectraReferenceView.h:162
RendererType
Enum represents renderers in the window.
Definition: svkSpectraReferenceView.h:169
void SetOverlayThreshold(double threshold)
Definition: svkSpectraReferenceView.cc:835
void SetupOverlay()
Definition: svkSpectraReferenceView.cc:1085
Definition: svkSpectraReferenceView.h:155
Definition: svkSpectraReferenceView.h:172
bool AreAllSatBandOutlinesOn(svkDcmHeader::Orientation orientation)
Definition: svkSpectraReferenceView.cc:1649
void SetLUT(svkLookupTable::svkLookupTableType type)
Definition: svkSpectraReferenceView.cc:1310
DataInputs
Enum represents input indecies.
Definition: svkSpectraReferenceView.h:133
Definition: svkSpectraReferenceView.h:171
Definition: svkSpectraReferenceView.h:128
Definition: svkSpectraReferenceView.h:152
int tlcBrc[2]
the top left, bottom right corners of the current view
Definition: svkDataView.h:165
Definition: svkLookupTable.h:58
svkSpectraReferenceView()
Definition: svkSpectraReferenceView.cc:57
svkImageMapToColors * windowLevelerCoronal
Definition: svkSpectraReferenceView.h:199