SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkDetailedPlotDirector.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_DETAILED_PLOT_DIRECTOR_H
44 #define SVK_DETAILED_PLOT_DIRECTOR_H
45 
46 
47 #include <vtkObjectFactory.h>
48 #include <vtkDataArray.h>
49 #include <vtkAxisActor2D.h>
50 #include <vtkTextActor.h>
51 #include <svkXYPlotActor.h>
52 #include <vtkTextProperty.h>
53 #include <svkXYPlotActor.h>
54 #include <vtkCollectionIterator.h>
55 #include <vtkAxisActor2D.h>
56 #include <vtkProperty2D.h>
57 #include <vtkObject.h>
58 #include <vtkDataSet.h>
59 #include <vtkRenderWindowInteractor.h>
60 #include <vtkCursor2D.h>
61 #include <vtkCallbackCommand.h>
62 #include <vtkRenderWindow.h>
63 #include <vtkRendererCollection.h>
64 #include <vtkFloatArray.h>
65 
66 #include <svkSpecPoint.h>
67 #include <svkPlotLine.h>
68 #include <svkDcmHeader.h>
69 #include <vector>
70 
71 
72 namespace svk {
73 
74 
75 using namespace std;
76 using namespace svk;
77 
78 
79 
85 class svkDetailedPlotDirector : public vtkObject
86 {
87 
88  public:
89 
90  // vtk type revision macro
91  vtkTypeMacro( svkDetailedPlotDirector, vtkObject );
92 
93  static svkDetailedPlotDirector* New();
94 
95 
96  // Methods:
97  virtual void AddInput( vtkDataArray* array, int component, vtkDataObject* sourceToObserve );
98  virtual void RemoveAllInputs( );
99  virtual void RemoveInput( vtkDataArray* array );
100  virtual void SetPlotColor( int plotIndex, double* rgb);
101  virtual void SetBackgroundColor( double* rgb );
102  virtual void SetBackgroundOpacity( double opacity );
103  virtual void SetBackgroundVisibility( bool visible );
104  virtual void SetAnnotationTextVisibility( bool visible );
105  virtual void SetLineWidth( float width );
106  virtual void SetAnnotationText( string text );
107 
108  virtual void SetIndexRange( int lower, int upper );
109  virtual void GenerateAbscissa( double firstPointValue, double lastPointValue );
110  virtual void GenerateAbscissa( svkDcmHeader* header, svkSpecPoint::UnitType type );
111  virtual void SetYRange( double lower, double upper );
112  virtual svkXYPlotActor* GetPlotActor();
113  virtual vtkAxisActor2D* GetRuler();
114  virtual void AddOnMouseMoveObserver( vtkRenderWindowInteractor* rwi);
115  virtual void RemoveOnMouseMoveObserver( vtkRenderWindowInteractor* rwi);
116  virtual int GetPointIndexFromXValue( double xValue );
117  virtual double GetYValueFromIndex( int plotIndex, int pointIndex );
118  virtual double GetYValueFromXValue( int plotIndex, double xValue );
119  virtual void Refresh( );
120 
121  protected:
122 
125 
126 
127  private:
128 
129  void GenerateMagnitudeArray( vtkDataArray* complexArray, vtkDataArray* magnitudeArray);
130  void RegenerateMagnitudeArrays();
131 
132  vtkstd::vector<vtkDataObject*> dataVector;
133  svkXYPlotActor* xyPlotActor;
134  double xMin;
135  double yMin;
136  vtkDataArray* abscissa;
137  int numPoints;
138  vtkCallbackCommand* cursorLocationCB;
139  vtkCursor2D* cursor2D;
140  vtkAxisActor2D* ruler;
142  vtkCallbackCommand* dataModifiedCB;
143  vtkGlyphSource2D* glyphGenerator;
144 
145  static void UpdateData(vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
146  static void UpdateCursorLocation( vtkObject* subject, unsigned long eid, void* thisObject, void *calldata);
147 
148 };
149 
150 
151 } //svk
152 
153 
154 #endif //SVK_DETAILED_PLOT_DIRECTOR_H
155 
Definition: svkDcmHeader.h:66
Definition: svkXYPlotActor.h:172
Definition: svkDetailedPlotDirector.h:85
UnitType
Definition: svkSpecPoint.h:69