1 #ifndef __wxContourViewPaneL_h_INCLUDED_H__
2 #define __wxContourViewPaneL_h_INCLUDED_H__
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
10 #include <wx/wxprec.h>
18 #include <wx/scrolwin.h>
20 //------------------------------------------------------------------------------------------------------------
22 //------------------------------------------------------------------------------------------------------------
24 #include "mBarRange.h"
25 #include "wxMaracas_N_ViewersWidget.h"
26 #include "vtkImageData.h"
27 #include "wxVtkBaseView.h"
30 #include "wxVtkBaseView_SceneManager.h"
31 #include "manualContourModel.h"
33 #include <vtkImageMapToWindowLevelColors.h>
36 //------------------------------------------------------------------------------------------------------------
38 //------------------------------------------------------------------------------------------------------------
40 BEGIN_DECLARE_EVENT_TYPES()
41 DECLARE_EVENT_TYPE(wxINSTANT_CHANGE,400)
42 END_DECLARE_EVENT_TYPES()
49 //------------------------------------------------------------------------------------------------------------
51 //------------------------------------------------------------------------------------------------------------
53 class wxContourViewPanel : public wxPanel {// public wxScrolledWindow {
57 //------------------------------------------------------------------------------------------------------------
58 // Constructors & Destructors
59 //------------------------------------------------------------------------------------------------------------
61 wxContourViewPanel( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos=wxDefaultPosition, const wxSize& size = wxDefaultSize,long style= wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, int vertStart=1, int vertEnd=1, int horzStart=1, int horzEnd=1 );
63 ~wxContourViewPanel();
65 //------------------------------------------------------------------------------------------------------------
66 // Creational and initialization methods
67 //------------------------------------------------------------------------------------------------------------
69 void setWxEventHandler( wxEvtHandler * theEventHandler );
71 void createHorizontalBar(int horzStart, int horzEnd);
73 void createVerticalBar(int vertStart, int vertEnd);
75 void createViewPanel();
77 //------------------------------------------------------------------------------------------------------------
78 // Methods for capturing events from the horizontal bar
79 //------------------------------------------------------------------------------------------------------------
82 * Handles the event wxEVT_TSBAR from the horizontal bar
84 void onBarrange_Horizontal(wxCommandEvent& event);
86 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
88 void onActualChange_Bar_Horizontal(wxCommandEvent& event);
90 * Handles the event wxEVT_TSBAR_START from the horizontal bar
92 void onStartChange_Bar_Horizontal(wxCommandEvent& event);
94 * Handles the event wxEVT_TSBAR_END from the horizontal bar
96 void onEndChange_Bar_Horizontal(wxCommandEvent& event);
98 * Handles the event wxEVT_SELECTION_END from the horizontal bar
100 void onSelectionEnd_Horizontal(wxCommandEvent& event);
102 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
104 void onMovedBar_Horizontal(wxCommandEvent& event);
107 //------------------------------------------------------------------------------------------------------------
108 // Methods for capturing events from the vertical bar
109 //------------------------------------------------------------------------------------------------------------
112 * Handles the event wxEVT_TSBAR from the vertical bar
114 void onBarrange_Vertical(wxCommandEvent& event);
116 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
118 void onActualChange_Bar_Vertical(wxCommandEvent& event);
120 * Handles the event wxEVT_TSBAR_START from the vertical bar
122 void onStartChange_Bar_Vertical(wxCommandEvent& event);
124 * Handles the event wxEVT_TSBAR_END from the vertical bar
126 void onEndChange_Bar_Vertical(wxCommandEvent& event);
128 * Handles the event wxEVT_SELECTION_END from the vertical bar
130 void onSelectionEnd_Vertical(wxCommandEvent& event);
132 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
134 void onMovedBar_Vertical(wxCommandEvent& event);
137 //------------------------------------------------------------------------------------------------------------
138 // Methods for sending events
139 //------------------------------------------------------------------------------------------------------------
141 //------------------------------------------------------------------------------------------------------------
142 // Attributes getters and setters
143 //------------------------------------------------------------------------------------------------------------
146 * Sets the represented values of the vertical bar
147 * @param minRepresented In the minimum represented value of the bar
148 * @param maxRepresented In the maximum represented value of the bar
150 void setVerticalRepresentedValues( int minRepresented, int maxRepresented );
153 * Sets the represented values of the horizontal bar
154 * @param minRepresented In the minimum represented value of the bar
155 * @param maxRepresented In the maximum represented value of the bar
157 void setHorizontalRepresentedValues( int minRepresented, int maxRepresented );
160 * Gets the StartVertical value
161 * @return The StartVertical
163 int getStartVertical();
165 * Gets the EndVertical value
166 * @return The EndVertical
168 int getEndVertical();
170 * Gets the ActualVertical value
171 * @return The ActualVertical
173 int getActualVertical();
176 * Sets the StartVertical value
177 * @param nwValue The new value for the StartVertical
179 void setStartVertical( int nwValue);
181 * Sets the EndVertical value
182 * @param nwValue The new value for the EndVertical
184 void setEndVertical( int nwValue);
186 * Sets the ActualVertical value
187 * @param nwValue The new value for the ActualVertical
189 void setActualVertical( int nwValue);
192 * Gets the StartHorizontal value
193 * @return The StartHorizontal
195 int getStartHorizontal();
197 * Gets the EndHorizontal value
198 * @return The EndHorizontal
200 int getEndHorizontal();
202 * Gets the ActualHorizontal value
203 * @return The ActualHorizontal
205 int getActualHorizontal();
208 * Sets the StartHorizontal value
209 * @param nwValue The new value for the StartHorizontal
211 void setStartHorizontal( int nwValue);
213 * Sets the EndHorizontal value
214 * @param nwValue The new value for the EndHorizontal
216 void setEndHorizontal( int nwValue);
218 * Sets the ActualHorizontal value
219 * @param nwValue The new value for the ActualHorizontal
221 void setActualHorizontal( int nwValue);
224 * Sets the horizontal concept values and name
225 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
226 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
227 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
228 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
229 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
230 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
232 void setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
235 * Sets the vertical concept values and name
236 * @param theVerticalConcept The name of the concept for setting at the vertical bar
237 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
238 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
239 * @param minShowed The minShowed value of the concept for setting at the vertical bar
240 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
241 * @param actualShow The actualShow value of the concept for setting at the vertical bar
243 void setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
246 * Sets the horizontal concept name
247 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
249 void setHorizontalConceptName( std::string theHorizontalConcept );
252 * Gets the horizontal concept name
253 * @return _horizontalConcept The name of the concept for setting at the horizontal bar
255 std::string getHorizontalConceptName( );
258 * Sets the vertical concept name
259 * @param theVerticalConcept The name of the concept for setting at the vertical bar
261 void setVerticalConceptName( std::string theVerticalConcept );
264 * Gets the vertical concept name
265 * @return _verticalConcept The name of the concept for setting at the vertical bar
267 std::string getVerticalConceptName( );
269 //------------------------------------------------------------------------------------------------------------
270 // Other functional methods
271 //------------------------------------------------------------------------------------------------------------
273 void getSpacing( double * spacing );
275 wxVtkBaseView* getWxVtkBaseView();
277 double getCurrentDeep();
279 void SetVisibleAxis(bool ok);
286 //this method should be deleted
287 wxVtkBaseView_SceneManager* getSceneManager();
289 void initializeScenceManager();
290 bool isEditableCControler(std::string theKeyName);
291 void removeFromScene(std::string theKeyName);
293 /////////////////////////////////////////////////////
294 void onChangeInstant(wxCommandEvent& event);
295 void onCreateMultipleROI (wxCommandEvent& event);
296 void onCreateROI (wxCommandEvent& event);
297 void onStopCreateROI (wxCommandEvent& event);
298 void onChangedDeep (wxCommandEvent& event);
299 void onActionButtonPressed(wxCommandEvent& event);
301 void removeSceneContours();
302 void addNameWrapperToScene();
304 std::vector<std::string> getSelectedObjects();
306 void RefreshInterface();
308 vtkImageData* getImageData();
310 void configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour);
312 int GetImageDataSizeZ();
314 void GetImageDataRange(double *range);
316 void SetWidthContour(double width );
318 int getColorWindow();
320 int getWindowLevel();
322 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
324 void onInterpolation(bool interpolate);
326 void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
328 void changeImage(vtkImageData* img);
332 void setImageSlice(int z);
335 //------------------------------------------------------------------------------------------------------------
337 //------------------------------------------------------------------------------------------------------------
338 wxVtkBaseView_SceneManager* _sceneManager;
340 * Represents the outer sizer of the ContourViewPanel
342 wxFlexGridSizer* outSizer;
345 * Represents the panel for viewing
347 wxMaracas_N_ViewersWidget * theViewPanel;
349 * Represents the vertical barrange
351 mBarRange * _verticalBar;
354 * Represents the horizontal barrange
356 mBarRange * _horizontalBar;
358 vtkImageData * showingVID;
360 std::string _verticalConceptName;
362 std::string _horizontalConceptName;
364 double last_spacing[3];
366 bool _useVerticalBar;
368 bool _useHorizontalBar;
370 wxEvtHandler * _eventHandler;
374 //------------------------------------------------------------------------------------------------------------
376 //------------------------------------------------------------------------------------------------------------
380 wxVtkMPR2DView * GetwxVtkMPR2DView();
383 // DECLARE_CLASS(wxContourViewPanel)
384 // any class wishing to process wxWindows events must use this macro
385 //DECLARE_EVENT_TABLE()
388 #endif // __wxContour_ViewPanel__