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);
70 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH);
71 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
72 #if wxMAJOR_VERSION <= 2
73 panelSizer -> AddGrowableCol(2);
74 panelSizer -> AddGrowableRow(2);
76 panelSizer -> AddGrowableRow(0,1);
77 panelSizer -> AddGrowableCol(2,1);
79 panelSizer->Add(_verticalBar, 0, wxEXPAND);
80 panelSizer->AddSpacer(gapV);
81 panelSizer->Add(theViewPanel, 1, wxEXPAND);
82 panelSizer->AddSpacer(gapV);
84 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
85 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
86 #if wxMAJOR_VERSION <= 2
87 outSizer -> AddGrowableCol(1);
88 outSizer -> AddGrowableRow(1);
90 outSizer -> AddGrowableRow(1,1);
91 outSizer -> AddGrowableCol(0,1);
93 outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP);
94 outSizer->Add( panelSizer, 1, wxEXPAND);
95 outSizer->AddSpacer(gapH);
97 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
98 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
100 //Connecting the events to the horizontal bar
101 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
102 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
103 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
104 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
105 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
106 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
108 //Connecting the events to the vertical bar
109 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
110 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
111 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
112 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
113 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
114 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
115 this->SetSizer( outSizer );
116 this->SetAutoLayout( true );
118 //SetSize(1900,1900);
119 //theViewPanel->SetSize(800,600);
120 //theViewPanel->GetWindow(1)->SetSize(800,600);
121 //outSizer->Fit( this );
122 initializeScenceManager();
126 wxContourViewPanel :: ~wxContourViewPanel()
128 delete _sceneManager;
131 void wxContourViewPanel::initializeScenceManager()
133 //_theViewPanel = theViewPanel;
134 //_theViewPanel->setWxEventHandler( this );
136 this->getSpacing(spc);
137 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
138 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
139 Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
140 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
141 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
142 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
143 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
146 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
147 return _sceneManager;
150 //------------------------------------------------------------------------------------------------------------
151 // Creational and initialization methods
152 //------------------------------------------------------------------------------------------------------------
154 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
156 _eventHandler = theEventHandler;
159 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
161 _horizontalBar = new mBarRange(this, 1500,80);
162 _horizontalBar -> setVisibleLabels (true);
163 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
164 _horizontalBar -> setActiveStateTo(true);
165 _horizontalBar -> SetActual( horzStart );
166 _horizontalBar -> setDeviceBlitStart (10,10);
167 _horizontalBar -> setDeviceEndMargin (10);
170 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
172 _verticalBar = new mBarRange(this, 1500,40);
173 _verticalBar -> SetOrientation(false);
174 _verticalBar -> setVisibleLabels (false);
175 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
176 _verticalBar -> setActiveStateTo(true);
177 _verticalBar -> SetActual( vertStart );
178 _verticalBar -> setDeviceBlitStart (10,10);
179 _verticalBar -> setDeviceEndMargin (10);
181 //------------------------------------------------------------------------------------------------------------
183 void wxContourViewPanel::createViewPanel()
185 std::vector<int> * numViews = new std::vector<int> ();
186 numViews->push_back(0);
187 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
188 SetVisibleAxis(false);
190 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
192 theViewPanel->SetSize(800,600);
193 theViewPanel->GetWindow(1)->SetSize(800,600);
196 //------------------------------------------------------------------------------------------------------------
198 void wxContourViewPanel::changeImage(vtkImageData* img){
200 theViewPanel->SetImage(img);
203 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
205 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
208 //------------------------------------------------------------------------------------------------------------
209 void wxContourViewPanel::SetVisibleAxis(bool ok)
211 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
214 //------------------------------------------------------------------------------------------------------------
215 int wxContourViewPanel::GetX()
217 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
219 //------------------------------------------------------------------------------------------------------------
220 int wxContourViewPanel::GetY()
222 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
224 //------------------------------------------------------------------------------------------------------------
225 int wxContourViewPanel::GetZ()
227 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
230 //------------------------------------------------------------------------------------------------------------
231 void wxContourViewPanel::Refresh()
233 GetwxVtkMPR2DView()->GetRenWin()->Render();
237 //------------------------------------------------------------------------------------------------------------
238 // Methods for capturing events from the horizontal bar
239 //------------------------------------------------------------------------------------------------------------
242 * Handles the event wxEVT_TSBAR from the horizontal bar
244 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
249 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
251 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
254 int actual = getActualHorizontal();
256 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
259 //int nxActual_h = getActualHorizontal();
262 //if (_eventHandler!=NULL)
264 //-------------------------------------------------
265 // Sending the event of wxINSTANT_CHANGE
266 //-------------------------------------------------
267 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
269 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
270 // cWrap->setActualValue( nxActual_h );
272 // newevent.SetClientData( (void *)cWrap );
273 // _eventHandler->ProcessEvent(newevent);
279 * Handles the event wxEVT_TSBAR_START from the horizontal bar
281 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
283 // int nxStart_h = getStartHorizontal();
286 * Handles the event wxEVT_TSBAR_END from the horizontal bar
288 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
290 // int nxEnd_h = getEndHorizontal();
293 * Handles the event wxEVT_SELECTION_END from the horizontal bar
295 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
300 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
302 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
304 // int nxStart_h = getStartHorizontal();
305 // int nxEnd_h = getEndHorizontal();
309 //------------------------------------------------------------------------------------------------------------
310 // Methods for capturing events from the vertical bar
311 //------------------------------------------------------------------------------------------------------------
314 * Handles the event wxEVT_TSBAR from the vertical bar
316 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
321 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
323 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
325 int actual = getActualVertical();
326 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
329 int nxActual_v = getActualVertical();
331 if (_eventHandler!=NULL)
333 //-------------------------------------------------
334 // Sending the event of wxINSTANT_CHANGE
335 //-------------------------------------------------
336 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
338 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
339 cWrap->setActualValue( nxActual_v );
341 newevent.SetClientData( (void *)cWrap );
342 _eventHandler->ProcessEvent(newevent);
347 * Handles the event wxEVT_TSBAR_START from the vertical bar
349 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
351 // int nxStart_v = getStartVertical();
354 * Handles the event wxEVT_TSBAR_END from the vertical bar
356 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
358 // int nxEnd_v = getEndVertical();
361 * Handles the event wxEVT_SELECTION_END from the vertical bar
363 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
368 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
370 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
372 // int nxStart_v = getStartVertical();
373 // int nxEnd_v = getEndVertical();
377 //------------------------------------------------------------------------------------------------------------
378 // Methods for sending events
379 //------------------------------------------------------------------------------------------------------------
381 //------------------------------------------------------------------------------------------------------------
382 // Attributes getters and setters
383 //------------------------------------------------------------------------------------------------------------
386 * Sets the represented values of the vertical bar
387 * @param minRepresented In the minimum represented value of the bar
388 * @param maxRepresented In the maximum represented value of the bar
390 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
392 if( _verticalBar != NULL && _useVerticalBar )
394 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
399 * Sets the represented values of the horizontal bar
400 * @param minRepresented In the minimum represented value of the bar
401 * @param maxRepresented In the maximum represented value of the bar
403 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
405 if( _horizontalBar != NULL && _useHorizontalBar )
407 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
412 * Gets the StartVertical value
413 * @return The StartVertical
415 int wxContourViewPanel :: getStartVertical()
417 return _verticalBar->GetActual();
420 * Gets the EndVertical value
421 * @return The EndVertical
423 int wxContourViewPanel :: getEndVertical()
425 return _verticalBar->GetEnd();
428 * Gets the ActualVertical value
429 * @return The ActualVertical
431 int wxContourViewPanel :: getActualVertical()
433 return _verticalBar->GetActual();//GetEnd();
437 * Sets the StartVertical value
438 * @param nwValue The new value for the StartVertical
440 void wxContourViewPanel :: setStartVertical( int nwValue )
442 _verticalBar->SetEnd( nwValue );
445 * Sets the EndVertical value
446 * @param nwValue The new value for the EndVertical
448 void wxContourViewPanel :: setEndVertical( int nwValue )
450 _verticalBar->SetEnd( nwValue );
453 * Sets the ActualVertical value
454 * @param nwValue The new value for the ActualVertical
456 void wxContourViewPanel :: setActualVertical( int nwValue )
458 _verticalBar->SetActual( nwValue );
462 * Gets the StartHorizontal value
463 * @return The StartHorizontal
465 int wxContourViewPanel :: getStartHorizontal()
467 return _horizontalBar->GetStart();
470 * Gets the EndHorizontal value
471 * @return The EndHorizontal
473 int wxContourViewPanel :: getEndHorizontal()
475 return _horizontalBar->GetEnd();
478 * Gets the ActualHorizontal value
479 * @return The ActualHorizontal
481 int wxContourViewPanel :: getActualHorizontal()
483 return _horizontalBar->GetActual();
487 * Sets the StartHorizontal value
488 * @param nwValue The new value for the StartHorizontal
490 void wxContourViewPanel :: setStartHorizontal( int nwValue )
492 _horizontalBar->SetStart( nwValue );
495 * Sets the EndHorizontal value
496 * @param nwValue The new value for the EndHorizontal
498 void wxContourViewPanel :: setEndHorizontal( int nwValue )
500 _horizontalBar->SetEnd( nwValue );
503 * Sets the ActualHorizontal value
504 * @param nwValue The new value for the ActualHorizontal
506 void wxContourViewPanel :: setActualHorizontal( int nwValue )
508 _horizontalBar->SetActual( nwValue );
512 * Sets the horizontal concept values and name
513 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
514 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
515 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
516 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
517 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
518 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
520 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
522 setHorizontalConceptName( theHorizontalConcept );
523 setHorizontalRepresentedValues( minRepresent, maxRepresent );
524 setActualHorizontal( actualShow );
525 setStartHorizontal( minShowed );
526 setEndHorizontal( maxShowed );
530 * Sets the vertical concept values and name
531 * @param theVerticalConcept The name of the concept for setting at the vertical bar
532 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
533 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
534 * @param minShowed The minShowed value of the concept for setting at the vertical bar
535 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
536 * @param actualShow The actualShow value of the concept for setting at the vertical bar
538 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
540 setVerticalConceptName( theVerticalConcept );
541 setVerticalRepresentedValues( minRepresent, maxRepresent );
542 setActualVertical( actualShow );
543 setStartVertical( minShowed );
544 setEndVertical( maxShowed );
549 * Sets the horizontal concept name
550 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
552 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
554 _horizontalConceptName = theHorizontalConcept;
558 * Gets the horizontal concept name
559 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
561 std::string wxContourViewPanel :: getHorizontalConceptName( )
563 return _horizontalConceptName;
567 * Sets the vertical concept name
568 * @param theVerticalConcept The name of the concept for setting at the vertical bar
570 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
572 _verticalConceptName = theVerticalConcept;
576 * Gets the vertical concept name
577 * @return _verticalConceptName The name of the concept for setting at the vertical bar
579 std::string wxContourViewPanel :: getVerticalConceptName( )
581 return _verticalConceptName;
584 //------------------------------------------------------------------------------------------------------------
585 // Other functional methods
586 //------------------------------------------------------------------------------------------------------------
588 void wxContourViewPanel :: getSpacing( double * spacing )
590 spacing[0] = last_spacing[0];
591 spacing[1] = last_spacing[1];
592 spacing[2] = last_spacing[2];
595 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
597 return theViewPanel->GetwxVtkBaseView(1);
600 double wxContourViewPanel :: getCurrentDeep()
603 // return theViewPanel->GetZ(1);
604 return theViewPanel->GetZ();
609 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
610 return _sceneManager->isEditableCControler(theKeyName);
613 void wxContourViewPanel::removeFromScene(std::string theKeyName){
615 _sceneManager->deleteCViewerCControler(theKeyName);
620 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
621 ConceptDataWrap * dataConcept = NULL;
622 if ( GetId() == event.GetId() )
624 dataConcept = (ConceptDataWrap *)event.GetClientData();
625 int value = dataConcept->getActualValue();
626 //_instantPanel->setConceptValue( dataConcept->getName(), value );
627 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
631 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
632 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
634 setActualVertical( dataConcept->getActualValue());
635 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
637 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
639 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
642 wxContourMainFrame::getInstance()->changeInstant();
645 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
647 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
649 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
651 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
652 double val = getCurrentDeep();
653 //setActualVertical( (int)val );
654 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
655 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
659 void wxContourViewPanel::changeDeep(){
660 double val = getCurrentDeep();
661 setActualVertical( (int)val );
663 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
666 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
667 // int elementsSelected = currentSelection.size();
668 bool ctrlKey = _sceneManager->isCtrlPressed();
669 char toolCommand = _sceneManager->getLastKeyCode();
672 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
674 wxContourMainFrame::getInstance()->onCopy();
676 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
678 wxContourMainFrame::getInstance()->onPaste();
680 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
682 wxContourMainFrame::getInstance()->onDeleteContour();
684 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
686 //toolCommand = &(CREATE_CONTOUR_KEY);
688 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
690 wxContourMainFrame::getInstance()->onLoad();
692 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
694 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
695 }else if( toolCommand == 26 ){
696 wxContourMainFrame::getInstance()->onUndo();
697 }else if( toolCommand == 25 ){
698 wxContourMainFrame::getInstance()->onRedo();
702 void wxContourViewPanel::removeSceneContours()
704 _sceneManager->removeSceneContours();
707 void wxContourViewPanel::addNameWrapperToScene()
709 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
710 for(int i = 0; i < size;i++){
711 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
712 _sceneManager->addToScene(name, true, true, true, false, false );
716 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
717 return _sceneManager->getSelectedObjects();
720 void wxContourViewPanel::RefreshInterface(){
721 getWxVtkBaseView()->Refresh();
724 vtkImageData* wxContourViewPanel::getImageData(){
725 return _sceneManager->GetImageData();
728 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
730 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
733 int wxContourViewPanel::GetImageDataSizeZ()
735 return _sceneManager->GetImageDataSizeZ();
738 void wxContourViewPanel::GetImageDataRange(double *range)
740 _sceneManager->GetImageDataRange(range);
743 void wxContourViewPanel::SetWidthContour(double width )
745 _sceneManager->SetWidthContour( width );
748 int wxContourViewPanel::getColorWindow()
750 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
751 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
752 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
756 int wxContourViewPanel::getWindowLevel()
758 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
759 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
760 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
764 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
766 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
767 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
768 imageviewer->SetColorWindow(colorwindow);
769 imageviewer->SetColorLevel(windowlevel);
772 void wxContourViewPanel::onInterpolation(bool interpolate)
774 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
775 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
778 imageviewer->GetImageActor()->InterpolateOn();
780 imageviewer->GetImageActor()->InterpolateOff();
784 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
786 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
789 void wxContourViewPanel::setImageSlice(int z){
790 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
791 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
792 baseview->SetActualSlice(z);