1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #ifndef __wxContourViewPaneL_h_INCLUDED_H__
27 #define __wxContourViewPaneL_h_INCLUDED_H__
30 // -----------------------------------------------------------------------------------------------------------
31 // WX headers inclusion.
32 // For compilers that support precompilation, includes <wx/wx.h>.
33 // -----------------------------------------------------------------------------------------------------------
35 #include <wx/wxprec.h>
43 #include <wx/scrolwin.h>
45 //------------------------------------------------------------------------------------------------------------
47 //------------------------------------------------------------------------------------------------------------
49 #include "mBarRange.h"
50 #include "wxMaracas_N_ViewersWidget.h"
51 #include "vtkImageData.h"
52 #include "wxVtkBaseView.h"
55 #include "wxVtkBaseView_SceneManager.h"
56 #include "manualContourModel.h"
58 #include <vtkImageMapToWindowLevelColors.h>
61 //------------------------------------------------------------------------------------------------------------
63 //------------------------------------------------------------------------------------------------------------
65 BEGIN_DECLARE_EVENT_TYPES()
66 DECLARE_EVENT_TYPE(wxINSTANT_CHANGE,400)
67 END_DECLARE_EVENT_TYPES()
74 //------------------------------------------------------------------------------------------------------------
76 //------------------------------------------------------------------------------------------------------------
78 class wxContourViewPanel : public wxPanel
81 //------------------------------------------------------------------------------------------------------------
82 // Constructors & Destructors
83 //------------------------------------------------------------------------------------------------------------
84 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 );
85 ~wxContourViewPanel();
86 //------------------------------------------------------------------------------------------------------------
87 // Creational and initialization methods
88 //------------------------------------------------------------------------------------------------------------
89 void setWxEventHandler( wxEvtHandler * theEventHandler );
90 void createHorizontalBar(int horzStart, int horzEnd);
91 void createVerticalBar(int vertStart, int vertEnd);
92 void createViewPanel();
93 //------------------------------------------------------------------------------------------------------------
94 // Methods for capturing events from the horizontal bar
95 //------------------------------------------------------------------------------------------------------------
97 * Handles the event wxEVT_TSBAR from the horizontal bar
99 void onBarrange_Horizontal(wxCommandEvent& event);
101 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
103 void onActualChange_Bar_Horizontal(wxCommandEvent& event);
105 * Handles the event wxEVT_TSBAR_START from the horizontal bar
107 void onStartChange_Bar_Horizontal(wxCommandEvent& event);
109 * Handles the event wxEVT_TSBAR_END from the horizontal bar
111 void onEndChange_Bar_Horizontal(wxCommandEvent& event);
113 * Handles the event wxEVT_SELECTION_END from the horizontal bar
115 void onSelectionEnd_Horizontal(wxCommandEvent& event);
117 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
119 void onMovedBar_Horizontal(wxCommandEvent& event);
122 //------------------------------------------------------------------------------------------------------------
123 // Methods for capturing events from the vertical bar
124 //------------------------------------------------------------------------------------------------------------
127 * Handles the event wxEVT_TSBAR from the vertical bar
129 void onBarrange_Vertical(wxCommandEvent& event);
131 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
133 void onActualChange_Bar_Vertical(wxCommandEvent& event);
135 * Handles the event wxEVT_TSBAR_START from the vertical bar
137 void onStartChange_Bar_Vertical(wxCommandEvent& event);
139 * Handles the event wxEVT_TSBAR_END from the vertical bar
141 void onEndChange_Bar_Vertical(wxCommandEvent& event);
143 * Handles the event wxEVT_SELECTION_END from the vertical bar
145 void onSelectionEnd_Vertical(wxCommandEvent& event);
147 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
149 void onMovedBar_Vertical(wxCommandEvent& event);
152 //------------------------------------------------------------------------------------------------------------
153 // Methods for sending events
154 //------------------------------------------------------------------------------------------------------------
156 //------------------------------------------------------------------------------------------------------------
157 // Attributes getters and setters
158 //------------------------------------------------------------------------------------------------------------
161 * Sets the represented values of the vertical bar
162 * @param minRepresented In the minimum represented value of the bar
163 * @param maxRepresented In the maximum represented value of the bar
165 void setVerticalRepresentedValues( int minRepresented, int maxRepresented );
168 * Sets the represented values of the horizontal bar
169 * @param minRepresented In the minimum represented value of the bar
170 * @param maxRepresented In the maximum represented value of the bar
172 void setHorizontalRepresentedValues( int minRepresented, int maxRepresented );
175 * Gets the StartVertical value
176 * @return The StartVertical
178 int getStartVertical();
180 * Gets the EndVertical value
181 * @return The EndVertical
183 int getEndVertical();
185 * Gets the ActualVertical value
186 * @return The ActualVertical
188 int getActualVertical();
191 * Sets the StartVertical value
192 * @param nwValue The new value for the StartVertical
194 void setStartVertical( int nwValue);
196 * Sets the EndVertical value
197 * @param nwValue The new value for the EndVertical
199 void setEndVertical( int nwValue);
201 * Sets the ActualVertical value
202 * @param nwValue The new value for the ActualVertical
204 void setActualVertical( int nwValue);
207 * Gets the StartHorizontal value
208 * @return The StartHorizontal
210 int getStartHorizontal();
212 * Gets the EndHorizontal value
213 * @return The EndHorizontal
215 int getEndHorizontal();
217 * Gets the ActualHorizontal value
218 * @return The ActualHorizontal
220 int getActualHorizontal();
223 * Sets the StartHorizontal value
224 * @param nwValue The new value for the StartHorizontal
226 void setStartHorizontal( int nwValue);
228 * Sets the EndHorizontal value
229 * @param nwValue The new value for the EndHorizontal
231 void setEndHorizontal( int nwValue);
233 * Sets the ActualHorizontal value
234 * @param nwValue The new value for the ActualHorizontal
236 void setActualHorizontal( int nwValue);
239 * Sets the horizontal concept values and name
240 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
241 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
242 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
243 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
244 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
245 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
247 void setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
250 * Sets the vertical concept values and name
251 * @param theVerticalConcept The name of the concept for setting at the vertical bar
252 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
253 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
254 * @param minShowed The minShowed value of the concept for setting at the vertical bar
255 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
256 * @param actualShow The actualShow value of the concept for setting at the vertical bar
258 void setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
261 * Sets the horizontal concept name
262 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
264 void setHorizontalConceptName( std::string theHorizontalConcept );
267 * Gets the horizontal concept name
268 * @return _horizontalConcept The name of the concept for setting at the horizontal bar
270 std::string getHorizontalConceptName( );
273 * Sets the vertical concept name
274 * @param theVerticalConcept The name of the concept for setting at the vertical bar
276 void setVerticalConceptName( std::string theVerticalConcept );
279 * Gets the vertical concept name
280 * @return _verticalConcept The name of the concept for setting at the vertical bar
282 std::string getVerticalConceptName( );
283 //------------------------------------------------------------------------------------------------------------
284 // Other functional methods
285 //------------------------------------------------------------------------------------------------------------
286 void getSpacing( double * spacing );
287 wxVtkBaseView* getWxVtkBaseView();
288 double getCurrentDeep();
289 void SetVisibleAxis(bool ok);
293 void SetXY(int x, int y);
297 //this method should be deleted
298 wxVtkBaseView_SceneManager* getSceneManager();
300 void initializeScenceManager();
301 bool isEditableCControler(std::string theKeyName);
302 void removeFromScene(std::string theKeyName);
304 /////////////////////////////////////////////////////
305 void onChangeInstant(wxCommandEvent& event);
306 void onCreateMultipleROI (wxCommandEvent& event);
307 void onCreateROI (wxCommandEvent& event);
308 void onStopCreateROI (wxCommandEvent& event);
309 void onChangedDeep (wxCommandEvent& event);
310 void onActionButtonPressed(wxCommandEvent& event);
311 void removeSceneContours();
312 void addNameWrapperToScene();
313 std::vector<std::string> getSelectedObjects();
314 void RefreshInterface();
315 vtkImageData* getImageData();
316 void configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour);
317 int GetImageDataSizeZ();
318 void GetImageDataRange(double *range);
319 void SetWidthContour(double width );
320 int getColorWindow();
321 int getWindowLevel();
322 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
323 void onInterpolation(bool interpolate);
324 void onShowTextContour(bool show);
325 void onBeforeAfterContour(bool before, bool after);
326 void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
327 void changeImage(vtkImageData* img);
329 void setImageSlice(int z);
332 //------------------------------------------------------------------------------------------------------------
334 //------------------------------------------------------------------------------------------------------------
335 wxVtkBaseView_SceneManager *_sceneManager;
337 * Represents the outer sizer of the ContourViewPanel
339 wxFlexGridSizer *outSizer;
342 * Represents the panel for viewing
344 wxMaracas_N_ViewersWidget *theViewPanel;
346 * Represents the vertical barrange
348 mBarRange *_verticalBar;
351 * Represents the horizontal barrange
353 mBarRange *_horizontalBar;
354 vtkImageData *showingVID;
355 std::string _verticalConceptName;
356 std::string _horizontalConceptName;
357 double last_spacing[3];
358 bool _useVerticalBar;
359 bool _useHorizontalBar;
360 wxEvtHandler *_eventHandler;
361 bool _showBeforeContour;
362 bool _showAfterContour;
365 //------------------------------------------------------------------------------------------------------------
367 //------------------------------------------------------------------------------------------------------------
368 wxVtkMPR2DView *GetwxVtkMPR2DView();
369 // DECLARE_CLASS(wxContourViewPanel)
370 // any class wishing to process wxWindows events must use this macro
371 //DECLARE_EVENT_TABLE()
373 #endif // __wxContour_ViewPanel__