2 * Progam made by Olivier Bernard, associate professor
3 * at Institut National des Sciences Appliquees (INSA) Lyon,
5 * 69621 Villeurbanne, France,
9 #ifndef _OpenHeartGUI_h
10 #define _OpenHeartGUI_h
12 #include <vtkImageData.h>
13 #include <vtkDataSet.h>
14 #include <vtkLookupTable.h>
15 #include <vtkPointWidget.h>
16 #include <vtkImagePlaneWidget.h>
18 #include <vtkCellPicker.h>
19 #include <vtkRenderWindowInteractor.h>
20 #include <vtkProperty.h>
21 #include <vtkCommand.h>
22 #include <vtkActor2D.h>
23 #include <vtkTextProperty.h>
24 #include <vtkEventQtSlotConnect.h>
25 #include <vtkTextMapper.h>
26 #include <vtkCutter.h>
27 #include <vtkContextView.h>
29 #include <vtkOrientationMarkerWidget.h>
30 #include <vtkMatrix4x4.h>
33 #include "ui_OpenHeartGui.h"
34 #include <QMainWindow>
42 class vtkEventQtSlotConnect;
47 struct RendererProperties
49 vtkSmartPointer<vtkLookupTable> lut;
50 vtkSmartPointer<vtkImagePlaneWidget> xIPW, yIPW, zIPW;
51 vtkSmartPointer<vtkImagePlaneWidget> xyIPW,xzIPW,yzIPW;
53 vtkSmartPointer<vtkActor2D> TextActorPixel;
54 vtkSmartPointer<vtkTextMapper> TextMapperPixel;
55 vtkSmartPointer<vtkActor2D> TextActorMM;
56 vtkSmartPointer<vtkTextMapper> TextMapperMM;
57 vtkSmartPointer<vtkActor2D> TextActorValue;
58 vtkSmartPointer<vtkTextMapper> TextMapperValue;
59 vtkSmartPointer<vtkActor2D> TextActorSlice;
60 vtkSmartPointer<vtkTextMapper> TextMapperSlice;
61 vtkSmartPointer<vtkActor2D> TextActorNumFrame;
62 vtkSmartPointer<vtkTextMapper> TextMapperNumFrame;
63 vtkSmartPointer<vtkActor2D> TextActorResolution;
64 vtkSmartPointer<vtkTextMapper> TextMapperResolution;
65 vtkSmartPointer<vtkActor> MeshActor;
66 vtkSmartPointer<vtkActor> xCutActor, yCutActor, zCutActor;
67 vtkSmartPointer<vtkActor> BasalPointActor;
68 vtkSmartPointer<vtkActor> ApexPointActor;
69 vtkSmartPointer<vtkActor> LongAxisActor;
70 vtkSmartPointer<vtkActor> BoundingBoxActor;
71 list<vtkDataSetMapper*> StackMapperList;
72 list<vtkDataSetMapper*>::iterator itStackMapperList;
73 list<vtkCutter*> StackMapXCutter;
74 list<vtkCutter*>::iterator itStackMapXCutter;
75 list<vtkCutter*> StackMapYCutter;
76 list<vtkCutter*>::iterator itStackMapYCutter;
77 list<vtkCutter*> StackMapZCutter;
78 list<vtkCutter*>::iterator itStackMapZCutter;
82 class OpenHeartGui : public QMainWindow, public Ui::OpenHeartGui
90 vtkSmartPointer<vtkCellPicker> GetPicker() { return this->Picker; }
91 vtkSmartPointer<vtkCellPicker> GetPickerXY() { return this->PickerXY; }
92 vtkSmartPointer<vtkCellPicker> GetPickerXZ() { return this->PickerXZ; }
93 vtkSmartPointer<vtkCellPicker> GetPickerYZ() { return this->PickerYZ; }
94 RendererProperties *GetRendererProperties() { return this->Properties; }
95 vtkRenderWindow *GetRenderWindow() { return this->qVTK->GetRenderWindow(); }
96 vtkRenderWindow *GetRenderWindowXY() { return this->qVTKXY->GetRenderWindow(); }
97 vtkRenderWindow *GetRenderWindowXZ() { return this->qVTKXZ->GetRenderWindow(); }
98 vtkRenderWindow *GetRenderWindowYZ() { return this->qVTKYZ->GetRenderWindow(); }
99 vtkSmartPointer<vtkRenderer> GetMeshRenderer() { return this->Ren; }
100 vtkSmartPointer<vtkRenderer> GetMainRenderer() { return this->Ren; }
101 vtkSmartPointer<vtkRenderer> GetXYRenderer() { return this->RenXY; }
102 vtkSmartPointer<vtkRenderer> GetXZRenderer() { return this->RenXZ; }
103 vtkSmartPointer<vtkRenderer> GetYZRenderer() { return this->RenYZ; }
105 vtkImageData *GetCurrentImageData() { return this->ImageData; }
106 int *GetDimensions() { return this->Dims; }
107 void InterpolationManagement();
108 void CreateFromSequenceDataPointer(std::string inputFilename);
109 void UpdateForwardViewers();
110 void UpdateBackwardViewers();
111 int GetCurrentFrame() { return this->CurrentFrame; }
112 int GetNumberOfFrames() { return this->NumberOfVolumes; }
113 void SetFlagLoopEndToBegin( int val ) { this->FlagLoopEndToBegin = val; }
114 void SetFlagLoopBeginToEnd( int val ) { this->FlagLoopBeginToEnd = val; }
115 void DisplayMainAxisManagement();
116 void DisplayMeshManagement();
117 void DisplayModeManagement();
118 void HidePlanModeManagement();
119 void UpdateCoords(double *pos);
120 int GetSelectedButton() { return ViewButton; }
121 int GetFlagDisplayText() { return FlagDisplayText; }
122 void ComputePointBeforeRotation(double *pt);
126 void slotMeshAlpha(int);
127 void slotRefreshViewer(int);
128 void slotTabChange(int);
135 void slotMeshRepresentation();
136 void slotMeshColor();
137 void slotMeshCutter();
138 void slotTimerEvent();
139 void slotBasalPoint();
140 void slotApexPoint();
142 void slotUpdateCoords(vtkObject*);
150 double BasalPoint[3];
152 vtkSmartPointer<vtkRenderer> Ren;
153 vtkSmartPointer<vtkRenderer> RenXY;
154 vtkSmartPointer<vtkRenderer> RenXZ;
155 vtkSmartPointer<vtkRenderer> RenYZ;
156 vtkRenderer* RenChart;
158 vtkEventQtSlotConnect* Connections;
160 list<vtkImageData*> StackVolume;
161 list<vtkImageData*>::iterator itStackVolume;
162 list<vtkPolyData*> StackMesh;
163 list<vtkPolyData*>::iterator itStackMesh;
165 vtkImageData *ImageData;
166 vtkSmartPointer <vtkOrientationMarkerWidget> OrientationWidget;
167 RendererProperties *Properties;
168 vtkSmartPointer<vtkCellPicker> Picker;
169 vtkSmartPointer<vtkCellPicker> PickerXY;
170 vtkSmartPointer<vtkCellPicker> PickerXZ;
171 vtkSmartPointer<vtkCellPicker> PickerYZ;
172 vtkSmartPointer<vtkRenderWindowInteractor> Interactor;
173 vtkSmartPointer<vtkRenderWindowInteractor> InteractorXY;
174 vtkSmartPointer<vtkRenderWindowInteractor> InteractorXZ;
175 vtkSmartPointer<vtkRenderWindowInteractor> InteractorYZ;
176 vtkSmartPointer<vtkContextView> ViewChart;
177 vtkSmartPointer<vtkTable> TableChart;
178 vtkSmartPointer<vtkMatrix4x4> RotationMatrix;
179 vtkSmartPointer<vtkTransform> TransformViewOrientation;
180 vtkSmartPointer<vtkMatrix4x4> RotationMatrixInv;
181 vtkSmartPointer<vtkTransform> TransformViewOrientationInv;
183 int FlagInterpolation;
185 int FlagDisplayMeshContourX;
186 int FlagDisplayMeshContourY;
187 int FlagDisplayMeshContourZ;
188 int FlagLoopEndToBegin;
189 int FlagLoopBeginToEnd;
193 int FlagDisplayMeshContours;
195 int FlagDisplayApexPoint;
196 int FlagDisplayBasalPoint;
197 int FlagDisplayLongAxis;
201 int MeshRepresentation;
206 void InstantiateQtVtkRenderers();
209 void InitProperties();
210 void InitOrientationAxes();
211 void InitPlaneWidget();
214 void SetCustomInteractorStyle();
215 vtkActor2D* AddFixedText(const char *text, float x, float y, float R,float G, float B, int Size);
217 void UpdateClinicalIndices();
218 void SetInterfaceColors();
219 void CreateLongAxisActor();
220 void SetLongAxisView();
221 void ResetReslicing();
222 void ComputeRotationMatrix();
223 void UpdateViewer(int view, double zoom, vtkRenderer *ren);
226 /// overloaded resize handler
227 virtual void resizeEvent(QResizeEvent* event);