SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkOverlayView.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 #include <vtkImageGaussianSmooth.h>
64 #include <vtkCleanPolyData.h>
65 
67 #include <svkImageViewer2.h>
68 #include <svkDataView.h>
69 #include <svk4DImageData.h>
70 #include <svkDataValidator.h>
71 #include <svkObliqueReslice.h>
72 #include <svkImageMapToColors.h>
73 #include <svkLookupTable.h>
74 #include <svkSatBandSet.h>
75 #include <svkVoxelTaggingUtils.h>
76 #include <svkMrsTopoGenerator.h>
77 
78 #include <svkBurnResearchPixels.h>
80 
81 #define SINC_MAX_EXTENT 512
82 
83 namespace svk {
84 
85 
86 class svkDataViewController;
87 class svkOverlayViewController;
88 
98 {
100 
101  public:
102  // vtk type revision macro
104 
105  static svkOverlayView* New();
106 
107  svkOverlayView();
108  ~svkOverlayView();
109 
110  // Methods:
111  virtual void SetInput( svkImageData* data, int index = 0);
112  virtual void SetInputPostReslice( svkImageData* data, int index );
113  virtual void RemoveInput( int index );
114  virtual void SetSlice(int slice);
115  virtual void SetSlice(int slice, bool centerImage );
117  virtual void SetActiveImageVolume( int volume );
118  virtual void SetActiveOverlayVolume( int volume );
119  virtual void SetRWInteractor( vtkRenderWindowInteractor* );
120  string GetDataCompatibility( svkImageData* data, int targetIndex );
121  void TurnOrthogonalImagesOn();
123  bool AreOrthogonalImagesOn();
127  void AlignCamera();
128  bool IsImageInsideSpectra();
129  void SetLevel(double level);
130  double GetLevel( );
131  void SetWindow(double window );
132  double GetWindow( );
133  void SetColorOverlayWindow( double window );
134  void SetColorOverlayLevel( double level );
135  double GetColorOverlayWindow( );
136  double GetColorOverlayLevel( );
137  bool CheckDataOrientations();
138  void SetCameraZoom( double zoom );
139 
140 
142 
144  enum DataInputs {
145  MRI = 0,
146  MR4D = 1,
148  };
149 
151  enum PropType {
169  };
170 
173  NEAREST = 0,
176  };
177 
180  PRIMARY = 0,
183  };
184 
185 
186 
188  enum {
191  } ColorSchema;
192 
193 
194 
195  protected:
196 
199 
201  vtkRenderWindow* myRenderWindow;
202 
203 
206 
211 
212 
213  // Holds the sinc interpolated version of the overlay
215 
216  // Holds the interpolated overlay
218 
219  // Transfer function for rendering overlays
221 
222  // Methods:
223  void SetupMrInput( bool firstInput );
224  void SetupMsInput( bool firstInput );
225  void UpdateImageSlice( bool centerImage );
226  void SetSelection( double* selectionArea, bool isWorldCords = 0 );
227  void SetOverlayOpacity( double opacity );
228  double GetOverlayOpacity( );
229  void SetOverlayThreshold( double threshold );
230  double GetOverlayThreshold( );
231  void SetTlcBrc( int* tlcBrc );
233  void GenerateClippingPlanes( );
234  void SetupOverlay();
235  void SetInterpolationType( int interpolationType );
238  void ResetWindowLevel();
246 
247  private:
248 
249  void SetSliceOverlay();
250  bool ResliceImage(svkImageData* input, svkImageData* target, int targetIndex);
251  float GetImageToSpecSliceRatio(svkImageData* input, svkImageData* target);
252  bool OriginShiftRequired(svkImageData* input, svkImageData* target, double* targetOrigin);
253 
254 
255  double overlayOpacity;
256  double overlayThreshold;
257 
259  InterpolationType interpolationType;
260 
262  svkSatBandSet* satBandsAxial;
263  svkSatBandSet* satBandsCoronal;
264  svkSatBandSet* satBandsSagittal;
265 
266  // Determines how close to the voxels things are clipped
267  static const double CLIP_TOLERANCE;
268 
269 
270 };
271 
272 
273 } //svk
274 
275 
276 #endif //SVK_OVERLAY_VIEW_H
Definition: svkOverlayView.h:146
virtual void SetInput(svkImageData *data, int index=0)
Definition: svkOverlayView.cc:397
svkSincInterpolationFilter * sincInterpolation
Definition: svkOverlayView.h:214
InterpolationType
Enum represents interpolation methods for the overlay.
Definition: svkOverlayView.h:172
void SetLUT(svkLookupTable::svkLookupTableType type)
Definition: svkOverlayView.cc:1589
void GenerateClippingPlanes()
Definition: svkOverlayView.cc:1032
double GetOverlayThreshold()
Definition: svkOverlayView.cc:939
DataInputs
Enum represents input indecies.
Definition: svkOverlayView.h:144
Definition: svkOverlayView.h:154
static svkOverlayView * New()
Definition: svkImageMapToColors.h:66
double GetWindow()
Definition: svkOverlayView.cc:973
vtkRenderWindow * myRenderWindow
the render window in which the view is to be displayed
Definition: svkOverlayView.h:201
void SetLevel(double level)
Definition: svkOverlayView.cc:946
Definition: svkOverlayView.h:158
void SetColorOverlayWindow(double window)
Definition: svkOverlayView.cc:992
Definition: svkImageViewer2.h:71
void SetupOverlay()
Definition: svkOverlayView.cc:1246
Definition: svkOverlayView.h:156
double GetOverlayOpacity()
Definition: svkOverlayView.cc:914
bool AreAllSatBandOutlinesOn(svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:2210
svkMriImageData * interpOverlay
Definition: svkOverlayView.h:217
Definition: svkOverlayView.h:159
Definition: svkDataView.h:73
svkImageMapToColors * windowLevelerAxial
Object used to window livel the overlay.
Definition: svkOverlayView.h:208
int FindSpectraSlice(int imageSlice, svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:676
bool imageInsideSpectra
Definition: svkOverlayView.h:205
virtual void SetRWInteractor(vtkRenderWindowInteractor *)
Definition: svkOverlayView.cc:767
void SetWindow(double window)
Definition: svkOverlayView.cc:956
Definition: svkOverlayView.h:175
virtual void RemoveInput(int index)
Definition: svkOverlayView.cc:478
Definition: svkOverlayView.h:145
Definition: svkOverlayView.h:97
void ToggleSelBoxVisibilityOff()
Definition: svkOverlayView.cc:2269
svkDcmHeader::Orientation orientation
Definition: svkDataView.h:162
void ResetWindowLevel()
Resets the window level, source taken from vtkImageViewer2.
Definition: svkOverlayView.cc:1895
void UpdateSincInterpolation()
Definition: svkOverlayView.cc:1514
int FindCenterImageSlice(int spectraSlice, svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:658
Definition: svkOverlayView.h:152
vtkTypeMacro(svkOverlayView, svkDataView)
svkImageMapToColors * windowLevelerSagittal
Definition: svkOverlayView.h:210
Definition: svkSatBandSet.h:71
enum svk::svkOverlayView::@9 ColorSchema
Enum represents color schema, used for printing.
Definition: svkSincInterpolationFilter.h:82
double GetColorOverlayWindow()
Definition: svkOverlayView.cc:1017
#define CLIP_TOLERANCE
Definition: svkSpectraReferenceView.h:80
svkLookupTable * GetLookupTable()
Definition: svkOverlayView.cc:1578
Orientation
Definition: svkDcmHeader.h:101
void SetInterpolationType(int interpolationType)
Definition: svkOverlayView.cc:1474
Definition: svkOverlayView.h:190
PropType
Enum represents objects in the scene.
Definition: svkOverlayView.h:151
Definition: svkOverlayView.h:153
void TurnOrthogonalImagesOff()
Definition: svkOverlayView.cc:1962
Definition: svkOverlayView.h:166
bool AreOrthogonalImagesOn()
Definition: svkOverlayView.cc:2017
int FindOverlaySlice(int slice, svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:699
Definition: svkOverlayView.h:157
Definition: svkOverlayView.h:168
bool CheckDataOrientations()
Definition: svkOverlayView.cc:1868
bool IsImageInsideSpectra()
Definition: svkOverlayView.cc:2330
void SetCameraZoom(double zoom)
Definition: svkOverlayView.cc:2320
double GetColorOverlayLevel()
Definition: svkOverlayView.cc:1005
Definition: svkOverlayView.h:162
int slice
Definition: svkDataView.h:166
Definition: svkOverlayView.h:182
svkLookupTableType
Definition: svkLookupTable.h:63
Definition: svkOverlayView.h:164
void SetTlcBrc(int *tlcBrc)
Definition: svkOverlayView.cc:852
virtual void SetInputPostReslice(svkImageData *data, int index)
Definition: svkOverlayView.cc:442
virtual void SetSlice(int slice)
Definition: svkOverlayView.cc:492
RendererType
Enum represents renderers in the window.
Definition: svkOverlayView.h:179
Definition: svkOverlayView.h:165
bool IsSatBandOutlineForSliceOn(svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:2147
Definition: svkOverlayView.h:189
void SetupMsInput(bool firstInput)
Definition: svkOverlayView.cc:225
void SetOverlayOpacity(double opacity)
Definition: svkOverlayView.cc:898
Definition: svkOverlayView.h:147
Definition: svkOverlayView.h:167
string GetDataCompatibility(svkImageData *data, int targetIndex)
Definition: svkOverlayView.cc:1634
void SetOrientation(svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:2025
Definition: svkOverlayView.h:173
Definition: svkOverlayView.h:163
void ToggleSelBoxVisibilityOn()
Definition: svkOverlayView.cc:2247
Definition: svkOverlayView.h:174
svkImageMapToColors * windowLevelerCoronal
Definition: svkOverlayView.h:209
void UpdateImageSlice(bool centerImage)
Definition: svkOverlayView.cc:723
Definition: svkOverlayView.h:155
void TurnOrthogonalImagesOn()
Definition: svkOverlayView.cc:1926
double GetLevel()
Definition: svkOverlayView.cc:966
Definition: svkOverlayView.h:160
Definition: svkOverlayViewController.h:101
virtual void SetActiveImageVolume(int volume)
Definition: svkOverlayView.cc:630
Definition: svkMriImageData.h:72
bool IsSatBandForSliceOn(svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:2120
Definition: svkOverlayView.h:180
Definition: svkImageData.h:107
virtual void SetActiveOverlayVolume(int volume)
Definition: svkOverlayView.cc:641
void SetColorOverlayLevel(double level)
Definition: svkOverlayView.cc:980
void SetOverlayThreshold(double threshold)
Definition: svkOverlayView.cc:925
bool AreAllSatBandsOn(svkDcmHeader::Orientation orientation)
Definition: svkOverlayView.cc:2174
void SetSelection(double *selectionArea, bool isWorldCords=0)
Definition: svkOverlayView.cc:789
svkOverlayView()
Definition: svkOverlayView.cc:59
Definition: svkOverlayView.h:161
bool toggleSelBoxVisibility
Definition: svkOverlayView.h:204
~svkOverlayView()
Definition: svkOverlayView.cc:163
svkLookupTable * colorTransfer
Definition: svkOverlayView.h:220
int tlcBrc[2]
the top left, bottom right corners of the current view
Definition: svkDataView.h:165
void SetupMrInput(bool firstInput)
Definition: svkOverlayView.cc:317
Definition: svkLookupTable.h:58
Definition: svkOverlayView.h:181
void AlignCamera()
Definition: svkOverlayView.cc:2283
int * HighlightSelectionVoxels()
Definition: svkOverlayView.cc:867
svkImageViewer2 * imageViewer
the vtkImageViewer2 object used to display the image
Definition: svkOverlayView.h:198