SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkPlotGridView.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_PLOT_GRID_VIEW_H
44 #define SVK_PLOT_GRID_VIEW_H
45 
46 
47 #include <vtkObjectFactory.h>
48 #include <vtkProp3DCollection.h>
49 #include <svkLabeledDataMapper.h>
50 #include <vtkSelectVisiblePoints.h>
51 #include <svkImageClip.h>
52 #include <vtkImageActor.h>
53 #include <vtkTextProperty.h>
54 #include <vtkDoubleArray.h>
55 #include <vtkExtractEdges.h>
56 #include <vtkImageMapper3D.h>
57 #include <svkImageMapToColors.h>
58 #include <svkDataView.h>
60 #include <svkPlotLine.h>
61 #include <svkPlotLineGrid.h>
62 #include <svkDataValidator.h>
63 #include <svkObliqueReslice.h>
64 #include <svkLookupTable.h>
65 #include <svkImageClip.h>
66 #include <svkSatBandSet.h>
67 #include <svkVoxelTaggingUtils.h>
68 #include <vtkCellCenters.h>
69 #include <vtkXYPlotActor.h>
70 #include <vtkCursor2D.h>
71 #include <vtkCleanPolyData.h>
72 #include <vtkPolyDataPointSampler.h>
74 #include <svkMrsTopoGenerator.h>
75 #include <svkOrientedImageActor.h>
76 
77 #include <vector>
78 
79 
80 namespace svk {
81 
82 
83 using namespace std;
84 
85 
86 // Note forward declaration to avoid self refererncing includes.
87 class svkPlotGridViewController;
88 
94 {
95 
97 
98  public:
99 
100  // vtk type revision macro
101  vtkTypeMacro( svkPlotGridView, svkDataView );
102 
103  static svkPlotGridView* New();
104 
105  svkPlotGridView();
106  ~svkPlotGridView();
107 
108  // Methods:
109  virtual void SetInput( svkImageData* data, int index );
110  virtual void AddReferenceInput( svkImageData* data );
111  virtual void RemoveInput( int index );
112  virtual void SetSlice( int slice );
113  virtual void SetTlcBrc( int tlcBrc[2] );
114  virtual void SetTlcBrc( int tlcID, int brcID );
115  virtual void SetWindowLevelRange( double lower, double upper, int index );
116  virtual void GetWindowLevelRange( double &lower, double &upper, int index );
117  virtual void SetOverlayWLRange( double* range );
118  virtual double* GetOverlayWLRange( );
119  void SetComponent( svkPlotLine::PlotComponent component, int plotIndex = -1 );
120  void SetActiveComponent( svkPlotLine::PlotComponent component );
121  svkPlotLine::PlotComponent GetActiveComponent( );
122  virtual void SetVolumeIndex( int index, int volumeIndex = 0, int plotIndex = -1 );
123  virtual int GetVolumeIndex( int volumeIndex = 0 );
124  virtual int* GetVolumeIndexArray( );
125  void SetPlotUnits( svkSpecPoint::UnitType plotUnitType );
126  virtual void SetRWInteractor( vtkRenderWindowInteractor* rwi );
127  virtual void SetPlotColor( int plotIndex, double* rgb );
128  virtual double* GetPlotColor( int plotIndex );
129  virtual void SetPlotLineWidth( float width );
130  virtual void SetPlotVisibility( int plotIndex, bool visible );
131  virtual bool GetPlotVisibility( int plotIndex );
132  virtual int GetNumberOfReferencePlots( );
133  virtual void SetActivePlotIndex( int plotIndex );
134  virtual svkImageData* GetActivePlot( );
135  virtual int GetActivePlotIndex( );
136  virtual void Refresh();
137  void GeneratePlotGridActor();
138  void GenerateClippingPlanes();
139  virtual void SetOrientation( svkDcmHeader::Orientation orientation );
140  virtual void AlignCamera();
141  svk4DImageData* GetActiveInput();
142  void SetOverlayTextDigits( int digits );
143  string GetScientificFormat( int digits );
144  string GetDecimalFormat( int digits );
145  void TurnPropOn(int propIndex);
146  void TurnPropOff(int propIndex);
147  void HideView();
148  void ShowView();
149  void AlignCameraOff();
150  void AlignCameraOn();
151 
153  typedef enum {
154  VOL_SELECTION = 0,
163  LAST_PROP = SAT_BANDS_OUTLINE
164  } ActorType;
165 
167  typedef enum {
168  PRIMARY = 0,
169  LAST_RENDERER = PRIMARY
170  } RendererType;
171 
173  typedef enum {
174  LIGHT_ON_DARK = 0,
175  DARK_ON_LIGHT
176  } ColorSchema;
177 
179  enum DataInputs { MR4D, MET, ADDITIONAL_MR4D };
180 
182  typedef enum {
183  FREQUENCY = 0,
184  AMPLITUDE
185  } WindowLevelRanges;
186  void SetActiveOverlayVolume( int volume );
187  void SetOverlayThreshold( double threshold );
188 
189  protected:
190 
191 
192  // Members:
193  vector<svkPlotLineGrid*> plotGrids;
194  vector<svkImageClip*> metClippers;
195  vector<vtkActor2D*> overlayTextActors;
196  double referencePlotColors[10][3];
197  void CreateMetaboliteOverlay( svkImageData* data );
198  void UpdateMetaboliteText( int* tlcBrc );
199  void UpdateMetaboliteImage( int* tlcBrc );
200  void UpdateMetaboliteTextDisplacement( );
201  void UpdateDetailedPlot( int* tlcBrc );
202  void UpdateDetailedPlotOverlay( int tlc );
203  void SetSelection( double* selectionArea, bool isWorldCords = 0 );
204  int* HighlightSelectionVoxels();
205  void SetColorSchema( int colorSchema );
206  string GetDataCompatibility( svkImageData* data, int targetIndex );
207  void SetOverlayOpacity( double opacity );
208  void SetLUT( svkLookupTable::svkLookupTableType type );
209 
210  private:
211  void ResliceImage(svkImageData* input, svkImageData* target);
212  int numColors;
213  svkLookupTable* colorTransfer;
214  svkSatBandSet* satBands;
215  int activePlot;
216  svkDetailedPlotDirector* detailedPlotDirector;
217  svkSpecPoint::UnitType plotUnitType;
218  svkImageMapToColors* windowLevel;
219  vtkstd::vector<int> volumeIndexVector;
220  int overlayTextDigits;
221  bool alignCamera;
222 
223  static const double CLIP_TOLERANCE;
224 
225 
226 };
227 
228 
229 } //svk
230 
231 
232 #endif //SVK_PLOT_GRID_VIEW_H
233 
Definition: svkPlotGridViewController.h:74
Definition: svkImageMapToColors.h:66
Definition: svkPlotGridView.h:179
Definition: svkDataView.h:73
Definition: svkPlotGridView.h:162
vector< svkPlotLineGrid * > plotGrids
Definition: svkPlotGridView.h:193
Definition: svkSatBandSet.h:71
Definition: svkPlotGridView.h:155
#define CLIP_TOLERANCE
Definition: svkSpectraReferenceView.h:80
Orientation
Definition: svkDcmHeader.h:101
DataInputs
Enum represent the data inputs.
Definition: svkPlotGridView.h:179
Definition: svkPlotGridView.h:159
svkLookupTableType
Definition: svkLookupTable.h:63
Definition: svkPlotGridView.h:93
Definition: svkPlotGridView.h:160
Definition: svkPlotGridView.h:157
Definition: svkPlotGridView.h:158
PlotComponent
Definition: svkPlotLine.h:68
vector< svkImageClip * > metClippers
Definition: svkPlotGridView.h:194
Definition: svkPlotGridView.h:161
Definition: svk4DImageData.h:69
vector< vtkActor2D * > overlayTextActors
Definition: svkPlotGridView.h:195
Definition: svkImageData.h:107
Definition: svkPlotGridView.h:156
Definition: svkDetailedPlotDirector.h:85
UnitType
Definition: svkSpecPoint.h:69
Definition: svkLookupTable.h:58