]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
#3140 creaContours Feature New Normal - branch vtk7itk4wx3
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourViewPanel.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
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
8 #
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.
15 #
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
20 #  liability.
21 #
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 # ------------------------------------------------------------------------ */
25
26
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "wxContourViewPanel.h"
31
32 #include "wxContourMainFrame.h"
33 //----------------------------------------------------------------------------------------------------------------
34 // Other includes
35 //----------------------------------------------------------------------------------------------------------------
36 //#include "ConceptDataWrap.h"
37
38 //this should be eliminated at some point
39 //#include "wxContourEventHandler.h"
40 //----------------------------------------------------------------------------------------------------------------
41 // Class implementation
42 //----------------------------------------------------------------------------------------------------------------
43 /** @file wxContourViewPanel.cxx */
44
45 //----------------------------------------------------------------------------------------------------------------
46 // Throwed Events definition
47 //----------------------------------------------------------------------------------------------------------------
48
49 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
50
51
52         //------------------------------------------------------------------------------------------------------------
53         // Constructors & Destructors
54         //------------------------------------------------------------------------------------------------------------
55         //:wxScrolledWindow(parent, -1, pos, size, style)
56         wxContourViewPanel::wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
57         :wxPanel(parent, -1, pos, size, style)
58         {
59                 theShowingImage->GetSpacing(last_spacing);
60                 showingVID                              = theShowingImage;
61                 int gapH                                = 20;
62                 int gapV                                = 10;
63                 _verticalConceptName    = "";
64                 _horizontalConceptName  = "";
65                 createHorizontalBar(1,80);
66                 createVerticalBar(1,200);
67                 createViewPanel();
68                 _eventHandler                   = NULL;
69                 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4,  gapV, gapH);
70 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
71 #if wxMAJOR_VERSION <= 2
72                 panelSizer -> AddGrowableCol(2);
73                 panelSizer -> AddGrowableRow(2);
74 #else
75                 panelSizer -> AddGrowableRow(0,1);
76                 panelSizer -> AddGrowableCol(2,1);
77 #endif
78                 panelSizer->Add(_verticalBar, 0, wxEXPAND);
79                 panelSizer->AddSpacer(gapV);
80                 panelSizer->Add(theViewPanel, 1, wxEXPAND);
81                 panelSizer->AddSpacer(gapV);
82                 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
83 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
84 #if wxMAJOR_VERSION <= 2
85                 outSizer -> AddGrowableCol(1);
86                 outSizer -> AddGrowableRow(1);
87 #else
88                 outSizer -> AddGrowableRow(1,1);
89                 outSizer -> AddGrowableCol(0,1);
90 #endif
91                 outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP);
92                 outSizer->Add( panelSizer, 1, wxEXPAND);
93                 outSizer->AddSpacer(gapH);
94                 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
95                 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
96                 //Connecting the events to the horizontal bar
97                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
98                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
99                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
100                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
101                 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
102                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
103
104                 //Connecting the events to the vertical bar
105                 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
106                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
107                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
108                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
109                 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
110                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
111                 this->SetSizer( outSizer );
112                 this->SetAutoLayout( true );
113                 this->Layout();
114                 //SetSize(1900,1900);
115                 //theViewPanel->SetSize(800,600);
116                 //theViewPanel->GetWindow(1)->SetSize(800,600);
117                 //outSizer->Fit( this );
118                 initializeScenceManager();
119         }
120
121
122         wxContourViewPanel :: ~wxContourViewPanel()
123         {
124                 delete _sceneManager;
125         }
126
127         void wxContourViewPanel::initializeScenceManager()
128         {
129                 //_theViewPanel = theViewPanel;
130                 //_theViewPanel->setWxEventHandler( this );
131                 double spc[3];
132                 this->getSpacing(spc);
133                 _sceneManager           = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc  );
134                 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangeInstant );
135         Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateMultipleROI );
136                 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateROI );
137                 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStopCreateROI );
138                 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangedDeep );
139                 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
140         }
141
142         wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager()
143         {
144                 return _sceneManager;
145         }
146
147         //------------------------------------------------------------------------------------------------------------
148         // Creational and initialization methods
149         //------------------------------------------------------------------------------------------------------------
150
151         void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
152         {
153                 _eventHandler = theEventHandler;
154         }
155
156         void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
157         {
158                 _horizontalBar = new mBarRange(this, 1500,80);
159                 _horizontalBar -> setVisibleLabels (true);
160                 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
161                 _horizontalBar -> setActiveStateTo(true);
162                 _horizontalBar -> SetActual( horzStart );
163                 _horizontalBar -> setDeviceBlitStart (10,10);
164                 _horizontalBar -> setDeviceEndMargin (10);
165         }
166
167         void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
168         {
169                 _verticalBar = new mBarRange(this, 1500,40);
170                 _verticalBar -> SetOrientation(false);
171                 _verticalBar -> setVisibleLabels (false);
172                 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
173                 _verticalBar -> setActiveStateTo(true);
174                 _verticalBar -> SetActual( vertStart );
175                 _verticalBar -> setDeviceBlitStart (10,10);
176                 _verticalBar -> setDeviceEndMargin (10);
177         }
178         //------------------------------------------------------------------------------------------------------------
179
180         void wxContourViewPanel::createViewPanel()
181         {
182                 std::vector<int> * numViews = new std::vector<int> ();
183                 numViews->push_back(0);
184                 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
185                 SetVisibleAxis(false);
186
187                 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
188
189                 theViewPanel->SetSize(800,600);
190                 theViewPanel->GetWindow(1)->SetSize(800,600);
191
192         }
193         //------------------------------------------------------------------------------------------------------------
194
195         void wxContourViewPanel::changeImage(vtkImageData* img){
196
197                 theViewPanel->SetImage(img);
198
199         }
200         wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
201         {
202                 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
203         }
204
205         //------------------------------------------------------------------------------------------------------------
206         void wxContourViewPanel::SetVisibleAxis(bool ok)
207         {
208                 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
209         }
210
211         //------------------------------------------------------------------------------------------------------------
212         int wxContourViewPanel::GetX()
213         {
214                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
215         }
216         //------------------------------------------------------------------------------------------------------------
217         int wxContourViewPanel::GetY()
218         {
219                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
220         }
221         //------------------------------------------------------------------------------------------------------------
222         int wxContourViewPanel::GetZ()
223         {
224                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
225         }
226
227         //------------------------------------------------------------------------------------------------------------
228         void wxContourViewPanel::Refresh()
229         {
230                 GetwxVtkMPR2DView()->GetRenWin()->Render();
231         }
232
233
234         //------------------------------------------------------------------------------------------------------------
235         // Methods for capturing events from the horizontal bar
236         //------------------------------------------------------------------------------------------------------------
237
238         /**
239         * Handles the event wxEVT_TSBAR from the horizontal bar
240         */
241         void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
242         {
243
244         }
245         /**
246         * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
247         */
248         void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
249         {
250
251                 int actual = getActualHorizontal();
252
253                 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
254
255                 //JCP 26 - 11 - 08
256                 //int nxActual_h = getActualHorizontal();
257
258
259                 //if (_eventHandler!=NULL)
260                 //{
261                         //-------------------------------------------------
262                         //  Sending the event of wxINSTANT_CHANGE
263                         //-------------------------------------------------
264                 //      wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
265
266                 //      ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
267                 //      cWrap->setActualValue( nxActual_h );
268
269                 //      newevent.SetClientData( (void *)cWrap );
270                 //      _eventHandler->ProcessEvent(newevent);
271
272                 //}
273                 //JCP 26 - 11 - 08
274         }
275         /**
276         * Handles the event wxEVT_TSBAR_START from the horizontal bar
277         */
278         void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
279         {
280 //              int nxStart_h = getStartHorizontal();
281         }
282         /**
283         * Handles the event wxEVT_TSBAR_END from the horizontal bar
284         */
285         void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
286         {
287 //              int nxEnd_h = getEndHorizontal();
288         }
289         /**
290         * Handles the event wxEVT_SELECTION_END from the horizontal bar
291         */
292         void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
293         {
294
295         }
296         /**
297         * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
298         */
299         void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
300         {
301 //              int nxStart_h = getStartHorizontal();
302 //              int nxEnd_h = getEndHorizontal();
303         }
304
305
306         //------------------------------------------------------------------------------------------------------------
307         // Methods for capturing events from the vertical bar
308         //------------------------------------------------------------------------------------------------------------
309
310         /**
311         * Handles the event wxEVT_TSBAR from the vertical bar
312         */
313         void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
314         {
315
316         }
317         /**
318         * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
319         */
320         void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
321         {
322                 int actual = getActualVertical();
323                 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
324                 //JCP 26 - 11 - 08
325                 /*
326                 int nxActual_v = getActualVertical();
327
328                 if (_eventHandler!=NULL)
329                 {
330                         //-------------------------------------------------
331                         //  Sending the event of wxINSTANT_CHANGE
332                         //-------------------------------------------------
333                         wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
334
335                         ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
336                         cWrap->setActualValue( nxActual_v );
337
338                         newevent.SetClientData( (void *)cWrap );
339                         _eventHandler->ProcessEvent(newevent);
340                 }*/
341                 //JCP 26 - 11 - 08
342         }
343         /**
344         * Handles the event wxEVT_TSBAR_START from the vertical bar
345         */
346         void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
347         {
348 //              int nxStart_v = getStartVertical();
349         }
350         /**
351         * Handles the event wxEVT_TSBAR_END from the vertical bar
352         */
353         void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
354         {
355 //              int nxEnd_v = getEndVertical();
356         }
357         /**
358         * Handles the event wxEVT_SELECTION_END from the vertical bar
359         */
360         void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
361         {
362
363         }
364         /**
365         * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
366         */
367         void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
368         {
369 //              int nxStart_v = getStartVertical();
370 //              int nxEnd_v = getEndVertical();
371         }
372
373
374         //------------------------------------------------------------------------------------------------------------
375         //  Methods for sending events
376         //------------------------------------------------------------------------------------------------------------
377
378         //------------------------------------------------------------------------------------------------------------
379         //  Attributes getters and setters
380         //------------------------------------------------------------------------------------------------------------
381
382         /**
383         * Sets the represented values of the vertical bar
384         * @param minRepresented In the minimum represented value of the bar
385         * @param maxRepresented In the maximum represented value of the bar
386         */
387         void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
388         {
389                 if( _verticalBar != NULL && _useVerticalBar )
390                 {
391                         _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
392                 }
393         }
394
395         /**
396         * Sets the represented values of the horizontal bar
397         * @param minRepresented In the minimum represented value of the bar
398         * @param maxRepresented In the maximum represented value of the bar
399         */
400         void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
401         {
402                 if( _horizontalBar != NULL && _useHorizontalBar )
403                 {
404                         _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
405                 }
406         }
407
408         /**
409         * Gets the StartVertical value
410         * @return The StartVertical
411         */
412         int wxContourViewPanel :: getStartVertical()
413         {
414                 return _verticalBar->GetActual();
415         }
416         /**
417         * Gets the EndVertical value
418         * @return The EndVertical
419         */
420         int wxContourViewPanel :: getEndVertical()
421         {
422                 return _verticalBar->GetEnd();
423         }
424         /**
425         * Gets the ActualVertical value
426         * @return The ActualVertical
427         */
428         int wxContourViewPanel :: getActualVertical()
429         {
430                 return _verticalBar->GetActual();//GetEnd();
431         }
432
433         /**
434         * Sets the StartVertical value
435         * @param nwValue The new value for the StartVertical
436         */
437         void wxContourViewPanel :: setStartVertical( int nwValue )
438         {
439                  _verticalBar->SetEnd( nwValue );
440         }
441         /**
442         * Sets the EndVertical value
443         * @param nwValue The new value for the EndVertical
444         */
445         void wxContourViewPanel :: setEndVertical( int nwValue )
446         {
447                  _verticalBar->SetEnd( nwValue );
448         }
449         /**
450         * Sets the ActualVertical value
451         * @param nwValue The new value for the ActualVertical
452         */
453         void wxContourViewPanel :: setActualVertical( int nwValue )
454         {
455                  _verticalBar->SetActual( nwValue );
456         }
457
458         /**
459         * Gets the StartHorizontal value
460         * @return The StartHorizontal
461         */
462         int wxContourViewPanel :: getStartHorizontal()
463         {
464                 return _horizontalBar->GetStart();
465         }
466         /**
467         * Gets the EndHorizontal value
468         * @return The EndHorizontal
469         */
470         int wxContourViewPanel :: getEndHorizontal()
471         {
472                 return _horizontalBar->GetEnd();
473         }
474         /**
475         * Gets the ActualHorizontal value
476         * @return The ActualHorizontal
477         */
478         int wxContourViewPanel :: getActualHorizontal()
479         {
480                 return _horizontalBar->GetActual();
481         }
482
483         /**
484         * Sets the StartHorizontal value
485         * @param nwValue The new value for the StartHorizontal
486         */
487         void wxContourViewPanel :: setStartHorizontal( int nwValue )
488         {
489                 _horizontalBar->SetStart( nwValue );
490         }
491         /**
492         * Sets the EndHorizontal value
493         * @param nwValue The new value for the EndHorizontal
494         */
495         void wxContourViewPanel :: setEndHorizontal( int nwValue )
496         {
497                 _horizontalBar->SetEnd( nwValue );
498         }
499         /**
500         * Sets the ActualHorizontal value
501         * @param nwValue The new value for the ActualHorizontal
502         */
503         void wxContourViewPanel :: setActualHorizontal( int nwValue )
504         {
505                 _horizontalBar->SetActual( nwValue );
506         }
507
508         /**
509         * Sets the horizontal concept values and name
510         * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
511         * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
512         * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
513         * @param minShowed The minShowed value of the concept for setting at the horizontal bar
514         * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
515         * @param actualShow The actualShow value of the concept for setting at the horizontal bar
516         */
517         void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
518         {
519                 setHorizontalConceptName( theHorizontalConcept );
520                 setHorizontalRepresentedValues( minRepresent, maxRepresent );
521                 setActualHorizontal( actualShow );
522                 setStartHorizontal( minShowed );
523                 setEndHorizontal( maxShowed );
524         }
525
526         /**
527         * Sets the vertical concept values and name
528         * @param theVerticalConcept The name of the concept for setting at the vertical bar
529         * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
530         * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
531         * @param minShowed The minShowed value of the concept for setting at the vertical bar
532         * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
533         * @param actualShow The actualShow value of the concept for setting at the vertical bar
534         */
535         void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
536         {
537                 setVerticalConceptName( theVerticalConcept );
538                 setVerticalRepresentedValues( minRepresent, maxRepresent );
539                 setActualVertical( actualShow );
540                 setStartVertical( minShowed );
541                 setEndVertical( maxShowed );
542         }
543
544
545         /**
546         * Sets the horizontal concept name
547         * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
548         */
549         void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
550         {
551                 _horizontalConceptName = theHorizontalConcept;
552         }
553
554         /**
555         * Gets the horizontal concept name
556         * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
557         */
558         std::string wxContourViewPanel :: getHorizontalConceptName(  )
559         {
560                 return _horizontalConceptName;
561         }
562
563         /**
564         * Sets the vertical concept name
565         * @param theVerticalConcept The name of the concept for setting at the vertical bar
566         */
567         void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
568         {
569                 _verticalConceptName = theVerticalConcept;
570         }
571
572         /**
573         * Gets the vertical concept name
574         * @return _verticalConceptName The name of the concept for setting at the vertical bar
575         */
576         std::string wxContourViewPanel :: getVerticalConceptName(  )
577         {
578                 return _verticalConceptName;
579         }
580
581         //------------------------------------------------------------------------------------------------------------
582         //  Other functional methods
583         //------------------------------------------------------------------------------------------------------------
584
585         void wxContourViewPanel :: getSpacing( double * spacing  )
586         {
587                 spacing[0] = last_spacing[0];
588                 spacing[1] = last_spacing[1];
589                 spacing[2] = last_spacing[2];
590         }
591
592         wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
593         {
594                 return theViewPanel->GetwxVtkBaseView(1);
595         }
596
597         double wxContourViewPanel :: getCurrentDeep()
598         {
599 //EED 08/04/2008
600 //              return theViewPanel->GetZ(1);
601                 return theViewPanel->GetZ();
602                 //return GetZ();
603         }
604
605
606         bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
607                 return _sceneManager->isEditableCControler(theKeyName);
608         }
609
610         void wxContourViewPanel::removeFromScene(std::string theKeyName){
611
612                 _sceneManager->deleteCViewerCControler(theKeyName);
613
614
615         }
616
617         void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
618                 ConceptDataWrap * dataConcept = NULL;
619                 if ( GetId() == event.GetId() )
620                 {
621                         dataConcept = (ConceptDataWrap *)event.GetClientData();
622                         int value = dataConcept->getActualValue();
623                         //_instantPanel->setConceptValue( dataConcept->getName(), value );
624                         wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
625                 }
626                 else
627                 {
628                         dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
629                         if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
630                         {
631                                 setActualVertical( dataConcept->getActualValue());
632                                 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
633                         }
634                         else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
635                         {
636                                 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
637                         }
638                 }
639                 wxContourMainFrame::getInstance()->changeInstant();
640         }
641
642         void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
643         }
644         void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
645         }
646         void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
647         }
648         void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
649                 double val = getCurrentDeep();
650                 //setActualVertical( (int)val );
651                 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
652                 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
653
654 //              changeInstant();
655         }
656         void wxContourViewPanel::changeDeep(){
657                 double val = getCurrentDeep();
658                 setActualVertical( (int)val );
659         }
660         void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
661
662
663                 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
664 //              int elementsSelected = currentSelection.size();
665                 bool ctrlKey = _sceneManager->isCtrlPressed();
666                 char toolCommand = _sceneManager->getLastKeyCode();
667
668
669                 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
670                 {
671                         wxContourMainFrame::getInstance()->onCopy();
672                 }
673                 else if(  toolCommand == 22 && ctrlKey ) //'V' || 'v'
674                 {
675                         wxContourMainFrame::getInstance()->onPaste();
676                 }
677                 else if(  toolCommand == 8 || (toolCommand==127) ) // backspace Delete
678                 {
679                         wxContourMainFrame::getInstance()->onDeleteContour();
680                 }
681                 else if(  toolCommand == 14 && ctrlKey ) //'N' || 'n'
682                 {
683                         //toolCommand = &(CREATE_CONTOUR_KEY);
684                 }
685                 else if(  toolCommand == 15 && ctrlKey ) //'O' || 'o'
686                 {
687                         wxContourMainFrame::getInstance()->onLoad();
688                 }
689                 else if(  toolCommand == 19 && ctrlKey ) //'S' || 's'
690                 {
691                         wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
692                 }else if( toolCommand == 26 ){
693                         wxContourMainFrame::getInstance()->onUndo();
694                 }else if( toolCommand == 25 ){
695                         wxContourMainFrame::getInstance()->onRedo();
696                 }
697         }
698
699         void wxContourViewPanel::removeSceneContours()
700         {
701                 _sceneManager->removeSceneContours();
702         }
703
704         void wxContourViewPanel::addNameWrapperToScene()
705         {
706                 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
707                 for(int i = 0; i < size;i++){
708                         std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
709                         _sceneManager->addToScene(name, true, true, true, false, false );
710                 }
711         }
712
713         std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
714                 return _sceneManager->getSelectedObjects();
715         }
716
717         void wxContourViewPanel::RefreshInterface(){
718                 getWxVtkBaseView()->Refresh();
719         }
720
721         vtkImageData* wxContourViewPanel::getImageData(){
722                 return _sceneManager->GetImageData();
723         }
724
725         void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
726         {
727                 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
728         }
729
730         int wxContourViewPanel::GetImageDataSizeZ()
731         {
732                 return _sceneManager->GetImageDataSizeZ();
733         }
734
735         void wxContourViewPanel::GetImageDataRange(double *range)
736         {
737                 _sceneManager->GetImageDataRange(range);
738         }
739
740         void wxContourViewPanel::SetWidthContour(double width )
741         {
742                 _sceneManager->SetWidthContour( width );
743         }
744
745         int wxContourViewPanel::getColorWindow()
746         {
747                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
748                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
749                 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
750                 return colorwindow;
751         }
752
753         int wxContourViewPanel::getWindowLevel()
754         {
755                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
756                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
757                 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
758                 return windowlevel;
759         }
760
761         void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
762         {
763                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
764                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
765                 imageviewer->SetColorWindow(colorwindow);
766                 imageviewer->SetColorLevel(windowlevel);
767         }
768
769         void wxContourViewPanel::onInterpolation(bool interpolate)
770         {
771                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
772                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
773
774                 if (interpolate){
775                         imageviewer->GetImageActor()->InterpolateOn();
776                 } else {
777                         imageviewer->GetImageActor()->InterpolateOff();
778                 }
779         }
780
781         void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
782         {
783                 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
784         }
785
786         void wxContourViewPanel::setImageSlice(int z){
787                 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
788                 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
789                 baseview->SetActualSlice(z);
790                 RefreshInterface();
791         }
792