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 {// public wxScrolledWindow {
82 //------------------------------------------------------------------------------------------------------------
83 // Constructors & Destructors
84 //------------------------------------------------------------------------------------------------------------
86 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 );
88 ~wxContourViewPanel();
90 //------------------------------------------------------------------------------------------------------------
91 // Creational and initialization methods
92 //------------------------------------------------------------------------------------------------------------
94 void setWxEventHandler( wxEvtHandler * theEventHandler );
96 void createHorizontalBar(int horzStart, int horzEnd);
98 void createVerticalBar(int vertStart, int vertEnd);
100 void createViewPanel();
102 //------------------------------------------------------------------------------------------------------------
103 // Methods for capturing events from the horizontal bar
104 //------------------------------------------------------------------------------------------------------------
107 * Handles the event wxEVT_TSBAR from the horizontal bar
109 void onBarrange_Horizontal(wxCommandEvent& event);
111 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
113 void onActualChange_Bar_Horizontal(wxCommandEvent& event);
115 * Handles the event wxEVT_TSBAR_START from the horizontal bar
117 void onStartChange_Bar_Horizontal(wxCommandEvent& event);
119 * Handles the event wxEVT_TSBAR_END from the horizontal bar
121 void onEndChange_Bar_Horizontal(wxCommandEvent& event);
123 * Handles the event wxEVT_SELECTION_END from the horizontal bar
125 void onSelectionEnd_Horizontal(wxCommandEvent& event);
127 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
129 void onMovedBar_Horizontal(wxCommandEvent& event);
132 //------------------------------------------------------------------------------------------------------------
133 // Methods for capturing events from the vertical bar
134 //------------------------------------------------------------------------------------------------------------
137 * Handles the event wxEVT_TSBAR from the vertical bar
139 void onBarrange_Vertical(wxCommandEvent& event);
141 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
143 void onActualChange_Bar_Vertical(wxCommandEvent& event);
145 * Handles the event wxEVT_TSBAR_START from the vertical bar
147 void onStartChange_Bar_Vertical(wxCommandEvent& event);
149 * Handles the event wxEVT_TSBAR_END from the vertical bar
151 void onEndChange_Bar_Vertical(wxCommandEvent& event);
153 * Handles the event wxEVT_SELECTION_END from the vertical bar
155 void onSelectionEnd_Vertical(wxCommandEvent& event);
157 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
159 void onMovedBar_Vertical(wxCommandEvent& event);
162 //------------------------------------------------------------------------------------------------------------
163 // Methods for sending events
164 //------------------------------------------------------------------------------------------------------------
166 //------------------------------------------------------------------------------------------------------------
167 // Attributes getters and setters
168 //------------------------------------------------------------------------------------------------------------
171 * Sets the represented values of the vertical bar
172 * @param minRepresented In the minimum represented value of the bar
173 * @param maxRepresented In the maximum represented value of the bar
175 void setVerticalRepresentedValues( int minRepresented, int maxRepresented );
178 * Sets the represented values of the horizontal bar
179 * @param minRepresented In the minimum represented value of the bar
180 * @param maxRepresented In the maximum represented value of the bar
182 void setHorizontalRepresentedValues( int minRepresented, int maxRepresented );
185 * Gets the StartVertical value
186 * @return The StartVertical
188 int getStartVertical();
190 * Gets the EndVertical value
191 * @return The EndVertical
193 int getEndVertical();
195 * Gets the ActualVertical value
196 * @return The ActualVertical
198 int getActualVertical();
201 * Sets the StartVertical value
202 * @param nwValue The new value for the StartVertical
204 void setStartVertical( int nwValue);
206 * Sets the EndVertical value
207 * @param nwValue The new value for the EndVertical
209 void setEndVertical( int nwValue);
211 * Sets the ActualVertical value
212 * @param nwValue The new value for the ActualVertical
214 void setActualVertical( int nwValue);
217 * Gets the StartHorizontal value
218 * @return The StartHorizontal
220 int getStartHorizontal();
222 * Gets the EndHorizontal value
223 * @return The EndHorizontal
225 int getEndHorizontal();
227 * Gets the ActualHorizontal value
228 * @return The ActualHorizontal
230 int getActualHorizontal();
233 * Sets the StartHorizontal value
234 * @param nwValue The new value for the StartHorizontal
236 void setStartHorizontal( int nwValue);
238 * Sets the EndHorizontal value
239 * @param nwValue The new value for the EndHorizontal
241 void setEndHorizontal( int nwValue);
243 * Sets the ActualHorizontal value
244 * @param nwValue The new value for the ActualHorizontal
246 void setActualHorizontal( int nwValue);
249 * Sets the horizontal concept values and name
250 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
251 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
252 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
253 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
254 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
255 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
257 void setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
260 * Sets the vertical concept values and name
261 * @param theVerticalConcept The name of the concept for setting at the vertical bar
262 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
263 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
264 * @param minShowed The minShowed value of the concept for setting at the vertical bar
265 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
266 * @param actualShow The actualShow value of the concept for setting at the vertical bar
268 void setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
271 * Sets the horizontal concept name
272 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
274 void setHorizontalConceptName( std::string theHorizontalConcept );
277 * Gets the horizontal concept name
278 * @return _horizontalConcept The name of the concept for setting at the horizontal bar
280 std::string getHorizontalConceptName( );
283 * Sets the vertical concept name
284 * @param theVerticalConcept The name of the concept for setting at the vertical bar
286 void setVerticalConceptName( std::string theVerticalConcept );
289 * Gets the vertical concept name
290 * @return _verticalConcept The name of the concept for setting at the vertical bar
292 std::string getVerticalConceptName( );
294 //------------------------------------------------------------------------------------------------------------
295 // Other functional methods
296 //------------------------------------------------------------------------------------------------------------
298 void getSpacing( double * spacing );
300 wxVtkBaseView* getWxVtkBaseView();
302 double getCurrentDeep();
304 void SetVisibleAxis(bool ok);
311 //this method should be deleted
312 wxVtkBaseView_SceneManager* getSceneManager();
314 void initializeScenceManager();
315 bool isEditableCControler(std::string theKeyName);
316 void removeFromScene(std::string theKeyName);
318 /////////////////////////////////////////////////////
319 void onChangeInstant(wxCommandEvent& event);
320 void onCreateMultipleROI (wxCommandEvent& event);
321 void onCreateROI (wxCommandEvent& event);
322 void onStopCreateROI (wxCommandEvent& event);
323 void onChangedDeep (wxCommandEvent& event);
324 void onActionButtonPressed(wxCommandEvent& event);
326 void removeSceneContours();
327 void addNameWrapperToScene();
329 std::vector<std::string> getSelectedObjects();
331 void RefreshInterface();
333 vtkImageData* getImageData();
335 void configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour);
337 int GetImageDataSizeZ();
339 void GetImageDataRange(double *range);
341 void SetWidthContour(double width );
343 int getColorWindow();
345 int getWindowLevel();
347 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
349 void onInterpolation(bool interpolate);
351 void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
353 void changeImage(vtkImageData* img);
357 void setImageSlice(int z);
360 //------------------------------------------------------------------------------------------------------------
362 //------------------------------------------------------------------------------------------------------------
363 wxVtkBaseView_SceneManager* _sceneManager;
365 * Represents the outer sizer of the ContourViewPanel
367 wxFlexGridSizer* outSizer;
370 * Represents the panel for viewing
372 wxMaracas_N_ViewersWidget * theViewPanel;
374 * Represents the vertical barrange
376 mBarRange * _verticalBar;
379 * Represents the horizontal barrange
381 mBarRange * _horizontalBar;
383 vtkImageData * showingVID;
385 std::string _verticalConceptName;
387 std::string _horizontalConceptName;
389 double last_spacing[3];
391 bool _useVerticalBar;
393 bool _useHorizontalBar;
395 wxEvtHandler * _eventHandler;
399 //------------------------------------------------------------------------------------------------------------
401 //------------------------------------------------------------------------------------------------------------
405 wxVtkMPR2DView * GetwxVtkMPR2DView();
408 // DECLARE_CLASS(wxContourViewPanel)
409 // any class wishing to process wxWindows events must use this macro
410 //DECLARE_EVENT_TABLE()
413 #endif // __wxContour_ViewPanel__