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 # ------------------------------------------------------------------------ */
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "wxContourViewPanel.h"
32 #include "wxContourMainFrame.h"
33 //----------------------------------------------------------------------------------------------------------------
35 //----------------------------------------------------------------------------------------------------------------
36 //#include "ConceptDataWrap.h"
38 //this should be eliminated at some point
39 //#include "wxContourEventHandler.h"
40 //----------------------------------------------------------------------------------------------------------------
41 // Class implementation
42 //----------------------------------------------------------------------------------------------------------------
43 /** @file wxContourViewPanel.cxx */
45 //----------------------------------------------------------------------------------------------------------------
46 // Throwed Events definition
47 //----------------------------------------------------------------------------------------------------------------
49 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
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)
59 theShowingImage->GetSpacing(last_spacing);
60 showingVID = theShowingImage;
63 _verticalConceptName = "";
64 _horizontalConceptName = "";
65 createHorizontalBar(1,80);
66 createVerticalBar(1,200);
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);
75 panelSizer -> AddGrowableRow(0,1);
76 panelSizer -> AddGrowableCol(2,1);
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);
88 outSizer -> AddGrowableRow(1,1);
89 outSizer -> AddGrowableCol(0,1);
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 );
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 );
114 //SetSize(1900,1900);
115 //theViewPanel->SetSize(800,600);
116 //theViewPanel->GetWindow(1)->SetSize(800,600);
117 //outSizer->Fit( this );
118 initializeScenceManager();
122 wxContourViewPanel :: ~wxContourViewPanel()
124 delete _sceneManager;
127 void wxContourViewPanel::initializeScenceManager()
129 //_theViewPanel = theViewPanel;
130 //_theViewPanel->setWxEventHandler( this );
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 );
142 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager()
144 return _sceneManager;
147 //------------------------------------------------------------------------------------------------------------
148 // Creational and initialization methods
149 //------------------------------------------------------------------------------------------------------------
151 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
153 _eventHandler = theEventHandler;
156 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
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);
167 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
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);
178 //------------------------------------------------------------------------------------------------------------
180 void wxContourViewPanel::createViewPanel()
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);
187 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
189 theViewPanel->SetSize(800,600);
190 theViewPanel->GetWindow(1)->SetSize(800,600);
193 //------------------------------------------------------------------------------------------------------------
195 void wxContourViewPanel::changeImage(vtkImageData* img){
197 theViewPanel->SetImage(img);
200 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
202 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
205 //------------------------------------------------------------------------------------------------------------
206 void wxContourViewPanel::SetVisibleAxis(bool ok)
208 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
211 //------------------------------------------------------------------------------------------------------------
212 int wxContourViewPanel::GetX()
214 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
216 //------------------------------------------------------------------------------------------------------------
217 int wxContourViewPanel::GetY()
219 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
221 //------------------------------------------------------------------------------------------------------------
222 int wxContourViewPanel::GetZ()
224 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
227 //------------------------------------------------------------------------------------------------------------
228 void wxContourViewPanel::Refresh()
230 GetwxVtkMPR2DView()->GetRenWin()->Render();
234 //------------------------------------------------------------------------------------------------------------
235 // Methods for capturing events from the horizontal bar
236 //------------------------------------------------------------------------------------------------------------
239 * Handles the event wxEVT_TSBAR from the horizontal bar
241 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
246 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
248 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
251 int actual = getActualHorizontal();
253 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
256 //int nxActual_h = getActualHorizontal();
259 //if (_eventHandler!=NULL)
261 //-------------------------------------------------
262 // Sending the event of wxINSTANT_CHANGE
263 //-------------------------------------------------
264 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
266 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
267 // cWrap->setActualValue( nxActual_h );
269 // newevent.SetClientData( (void *)cWrap );
270 // _eventHandler->ProcessEvent(newevent);
276 * Handles the event wxEVT_TSBAR_START from the horizontal bar
278 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
280 // int nxStart_h = getStartHorizontal();
283 * Handles the event wxEVT_TSBAR_END from the horizontal bar
285 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
287 // int nxEnd_h = getEndHorizontal();
290 * Handles the event wxEVT_SELECTION_END from the horizontal bar
292 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
297 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
299 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
301 // int nxStart_h = getStartHorizontal();
302 // int nxEnd_h = getEndHorizontal();
306 //------------------------------------------------------------------------------------------------------------
307 // Methods for capturing events from the vertical bar
308 //------------------------------------------------------------------------------------------------------------
311 * Handles the event wxEVT_TSBAR from the vertical bar
313 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
318 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
320 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
322 int actual = getActualVertical();
323 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
326 int nxActual_v = getActualVertical();
328 if (_eventHandler!=NULL)
330 //-------------------------------------------------
331 // Sending the event of wxINSTANT_CHANGE
332 //-------------------------------------------------
333 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
335 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
336 cWrap->setActualValue( nxActual_v );
338 newevent.SetClientData( (void *)cWrap );
339 _eventHandler->ProcessEvent(newevent);
344 * Handles the event wxEVT_TSBAR_START from the vertical bar
346 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
348 // int nxStart_v = getStartVertical();
351 * Handles the event wxEVT_TSBAR_END from the vertical bar
353 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
355 // int nxEnd_v = getEndVertical();
358 * Handles the event wxEVT_SELECTION_END from the vertical bar
360 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
365 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
367 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
369 // int nxStart_v = getStartVertical();
370 // int nxEnd_v = getEndVertical();
374 //------------------------------------------------------------------------------------------------------------
375 // Methods for sending events
376 //------------------------------------------------------------------------------------------------------------
378 //------------------------------------------------------------------------------------------------------------
379 // Attributes getters and setters
380 //------------------------------------------------------------------------------------------------------------
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
387 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
389 if( _verticalBar != NULL && _useVerticalBar )
391 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
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
400 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
402 if( _horizontalBar != NULL && _useHorizontalBar )
404 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
409 * Gets the StartVertical value
410 * @return The StartVertical
412 int wxContourViewPanel :: getStartVertical()
414 return _verticalBar->GetActual();
417 * Gets the EndVertical value
418 * @return The EndVertical
420 int wxContourViewPanel :: getEndVertical()
422 return _verticalBar->GetEnd();
425 * Gets the ActualVertical value
426 * @return The ActualVertical
428 int wxContourViewPanel :: getActualVertical()
430 return _verticalBar->GetActual();//GetEnd();
434 * Sets the StartVertical value
435 * @param nwValue The new value for the StartVertical
437 void wxContourViewPanel :: setStartVertical( int nwValue )
439 _verticalBar->SetEnd( nwValue );
442 * Sets the EndVertical value
443 * @param nwValue The new value for the EndVertical
445 void wxContourViewPanel :: setEndVertical( int nwValue )
447 _verticalBar->SetEnd( nwValue );
450 * Sets the ActualVertical value
451 * @param nwValue The new value for the ActualVertical
453 void wxContourViewPanel :: setActualVertical( int nwValue )
455 _verticalBar->SetActual( nwValue );
459 * Gets the StartHorizontal value
460 * @return The StartHorizontal
462 int wxContourViewPanel :: getStartHorizontal()
464 return _horizontalBar->GetStart();
467 * Gets the EndHorizontal value
468 * @return The EndHorizontal
470 int wxContourViewPanel :: getEndHorizontal()
472 return _horizontalBar->GetEnd();
475 * Gets the ActualHorizontal value
476 * @return The ActualHorizontal
478 int wxContourViewPanel :: getActualHorizontal()
480 return _horizontalBar->GetActual();
484 * Sets the StartHorizontal value
485 * @param nwValue The new value for the StartHorizontal
487 void wxContourViewPanel :: setStartHorizontal( int nwValue )
489 _horizontalBar->SetStart( nwValue );
492 * Sets the EndHorizontal value
493 * @param nwValue The new value for the EndHorizontal
495 void wxContourViewPanel :: setEndHorizontal( int nwValue )
497 _horizontalBar->SetEnd( nwValue );
500 * Sets the ActualHorizontal value
501 * @param nwValue The new value for the ActualHorizontal
503 void wxContourViewPanel :: setActualHorizontal( int nwValue )
505 _horizontalBar->SetActual( nwValue );
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
517 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
519 setHorizontalConceptName( theHorizontalConcept );
520 setHorizontalRepresentedValues( minRepresent, maxRepresent );
521 setActualHorizontal( actualShow );
522 setStartHorizontal( minShowed );
523 setEndHorizontal( maxShowed );
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
535 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
537 setVerticalConceptName( theVerticalConcept );
538 setVerticalRepresentedValues( minRepresent, maxRepresent );
539 setActualVertical( actualShow );
540 setStartVertical( minShowed );
541 setEndVertical( maxShowed );
546 * Sets the horizontal concept name
547 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
549 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
551 _horizontalConceptName = theHorizontalConcept;
555 * Gets the horizontal concept name
556 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
558 std::string wxContourViewPanel :: getHorizontalConceptName( )
560 return _horizontalConceptName;
564 * Sets the vertical concept name
565 * @param theVerticalConcept The name of the concept for setting at the vertical bar
567 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
569 _verticalConceptName = theVerticalConcept;
573 * Gets the vertical concept name
574 * @return _verticalConceptName The name of the concept for setting at the vertical bar
576 std::string wxContourViewPanel :: getVerticalConceptName( )
578 return _verticalConceptName;
581 //------------------------------------------------------------------------------------------------------------
582 // Other functional methods
583 //------------------------------------------------------------------------------------------------------------
585 void wxContourViewPanel :: getSpacing( double * spacing )
587 spacing[0] = last_spacing[0];
588 spacing[1] = last_spacing[1];
589 spacing[2] = last_spacing[2];
592 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
594 return theViewPanel->GetwxVtkBaseView(1);
597 double wxContourViewPanel :: getCurrentDeep()
600 // return theViewPanel->GetZ(1);
601 return theViewPanel->GetZ();
606 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
607 return _sceneManager->isEditableCControler(theKeyName);
610 void wxContourViewPanel::removeFromScene(std::string theKeyName){
612 _sceneManager->deleteCViewerCControler(theKeyName);
617 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
618 ConceptDataWrap * dataConcept = NULL;
619 if ( GetId() == event.GetId() )
621 dataConcept = (ConceptDataWrap *)event.GetClientData();
622 int value = dataConcept->getActualValue();
623 //_instantPanel->setConceptValue( dataConcept->getName(), value );
624 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
628 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
629 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
631 setActualVertical( dataConcept->getActualValue());
632 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
634 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
636 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
639 wxContourMainFrame::getInstance()->changeInstant();
642 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
644 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
646 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
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 );
656 void wxContourViewPanel::changeDeep(){
657 double val = getCurrentDeep();
658 setActualVertical( (int)val );
660 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
663 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
664 // int elementsSelected = currentSelection.size();
665 bool ctrlKey = _sceneManager->isCtrlPressed();
666 char toolCommand = _sceneManager->getLastKeyCode();
669 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
671 wxContourMainFrame::getInstance()->onCopy();
673 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
675 wxContourMainFrame::getInstance()->onPaste();
677 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
679 wxContourMainFrame::getInstance()->onDeleteContour();
681 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
683 //toolCommand = &(CREATE_CONTOUR_KEY);
685 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
687 wxContourMainFrame::getInstance()->onLoad();
689 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
691 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
692 }else if( toolCommand == 26 ){
693 wxContourMainFrame::getInstance()->onUndo();
694 }else if( toolCommand == 25 ){
695 wxContourMainFrame::getInstance()->onRedo();
699 void wxContourViewPanel::removeSceneContours()
701 _sceneManager->removeSceneContours();
704 void wxContourViewPanel::addNameWrapperToScene()
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 );
713 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
714 return _sceneManager->getSelectedObjects();
717 void wxContourViewPanel::RefreshInterface(){
718 getWxVtkBaseView()->Refresh();
721 vtkImageData* wxContourViewPanel::getImageData(){
722 return _sceneManager->GetImageData();
725 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
727 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
730 int wxContourViewPanel::GetImageDataSizeZ()
732 return _sceneManager->GetImageDataSizeZ();
735 void wxContourViewPanel::GetImageDataRange(double *range)
737 _sceneManager->GetImageDataRange(range);
740 void wxContourViewPanel::SetWidthContour(double width )
742 _sceneManager->SetWidthContour( width );
745 int wxContourViewPanel::getColorWindow()
747 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
748 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
749 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
753 int wxContourViewPanel::getWindowLevel()
755 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
756 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
757 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
761 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
763 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
764 wxvtk2dbaseview->SetColorWindow( colorwindow );
765 wxvtk2dbaseview->SetColorLevel( windowlevel );
768 void wxContourViewPanel::onInterpolation(bool interpolate)
770 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
771 wxvtk2dbaseview->SetInterpolate( interpolate );
774 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
776 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
779 void wxContourViewPanel::setImageSlice(int z){
780 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
781 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
782 baseview->SetActualSlice(z);