SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkPlotLineGrid.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_LINE_GRID_H_INCL
44 #define SVK_PLOT_LINE_GRID_H_INCL
45 
46 
47 #include <vector>
48 #include <vtkRenderer.h>
49 #include <vtkIdList.h>
50 
51 #include <vtkImageData.h>
52 #include <vtkCellData.h>
53 #include <vtkCamera.h>
54 #include <vtkProp3DCollection.h>
55 #include <vtkDataSetCollection.h>
56 #include <vtkCallbackCommand.h>
57 #include <vtkAppendPolyData.h>
58 #include <vtkAreaPicker.h>
59 #include <vtkCollectionIterator.h>
60 #include <vtkTransform.h>
61 #include <svkPlotLine.h>
62 #include <svkImageData.h>
63 #include <svkDataView.h>
64 #include <svk4DImageData.h>
65 #include <svkMrsImageData.h>
66 #include <vtkPolyDataCollection.h>
67 #include <vtkPolyDataMapper.h>
68 #include <vtkLODActor.h>
69 #include <vtkProperty.h>
70 
71 
72 namespace svk {
73 
74 
75 using namespace std;
76 
77 /*
78  * Representation for 4D Image Data. It creates a vtkPolyData object to represent
79  * the spatial location of the data acquired, and uses svkPlotLine objects
80  * to modify point data for the individual cells. There are methods for controlling
81  * the range, slice, etc.
82  *
83  */
84 class svkPlotLineGrid : public vtkObject
85 {
86 
87  public:
88  // vtk type revision macro
89  vtkTypeMacro( svkPlotLineGrid, vtkObject );
90 
91  static svkPlotLineGrid* New();
92 
94  ~svkPlotLineGrid();
95 
96 
97  // Methods
98  void SetInput( svk4DImageData* data );
99  svk4DImageData* GetInput( );
100  void Update(int tlcBrc[2]);
101  void SetTlcBrc(int tlcBrc[2]);
102  int* GetTlcBrc();
103  void SetSlice(int slice);
104  void SetPlotPoints();
105  int GetSlice( );
106  void SetFrequencyWLRange(int lower, int range, int tlcBrc[2]);
107  void GetFrequencyWLRange(int &lower, int &range);
108  void SetIntensityWLRange(double lower, double range, int tlcBrc[2]);
109  void GetIntensityWLRange(double &lower, double &range);
110  void AlignCamera( bool invertView = 1 );
111  void SetComponent( svkPlotLine::PlotComponent component );
112  svkPlotLine::PlotComponent GetComponent( );
113  vtkstd::vector<int> GetVolumeIndexVector( );
114  void SetVolumeIndexVector( vtkstd::vector<int> );
115  void SetVolumeIndex( int index, int volumeIndex = 0 );
116  int GetVolumeIndex( int volumeIndex = 0 );
117  void UpdateDataArrays(int tlc, int brc);
118  void SetOrientation( svkDcmHeader::Orientation orientation );
119  vtkActor* GetPlotGridActor();
120  void CalculateTlcBrcBounds( double bounds[6], int tlcBrc[2]);
121  void SetColor( double rgb[3]);
122  double* GetColor( );
123 
124  private:
125 
126  void ClearXYPlots();
127 
129  int slice;
130  vtkstd::vector< int > volumeIndexVector;
131 
133  int tlcBrc[2];
134 
136  vtkstd::vector< vtkstd::vector<double> > dcos;
137 
139  vtkstd::vector<svkPlotLine*> xyPlots;
140 
142  vtkActor* plotGridActor;
143 
144  vtkPolyData* polyData;
145 
146  vtkPoints* points;
147 
148  vtkPolyDataMapper* mapper;
149 
151  int plotRangeX1;
152 
154  int plotRangeX2;
155 
157  double plotRangeY1;
158 
160  double plotRangeY2;
161 
163  bool* freqUpToDate;
164 
166  int freqSelectionUpToDate[2];
167 
169  bool* ampUpToDate;
170 
171  int ampSelectionUpToDate[2];
172 
173  // Defines if the given volume for a given slice is up to date
174  vtkstd::vector< vtkstd::vector<bool> > volumeUpToDate;
175 
177  svk4DImageData* data;
178 
180  vtkCallbackCommand* dataModifiedCB;
181 
183  svkPlotLine::PlotComponent plotComponent;
184 
185  svkDcmHeader::Orientation orientation;
186 
187  // Methods:
188  void RegeneratePlots();
189  static void UpdateData(vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
190  void AllocateXYPlots();
191  void AllocatePolyData();
192  void UpdatePlotRange(int tlcBrc[2], bool generatePolyData = true);
193  void UpdateComponent();
194  void UpdateOrientation();
195  void GenerateActor();
196  void HighlightSelectionVoxels();
197  bool IsSliceUpToDate( int slice );
198  void SetSliceUpToDate( int slice );
199  void SetSliceOutOfDate( int slice );
200  void SetVolumeUpToDate( int volumeIndex );
201  void SetVolumeOutOfDate( int volumeIndex );
202  void InitializeVolumeUpToDateVector();
203  void TurnOffAllPlots();
204 
205 };
206 
207 
208 } //svk
209 
210 
211 #endif //SVK_PLOT_LINE_GRID_H_INCL
Definition: svkPlotLineGrid.h:84
Orientation
Definition: svkDcmHeader.h:101
PlotComponent
Definition: svkPlotLine.h:68
Definition: svk4DImageData.h:69