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::SetXY(int x, int y)
230 GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x);
231 GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y);
234 //------------------------------------------------------------------------------------------------------------
235 void wxContourViewPanel::Refresh()
237 GetwxVtkMPR2DView()->GetRenWin()->Render();
241 //------------------------------------------------------------------------------------------------------------
242 // Methods for capturing events from the horizontal bar
243 //------------------------------------------------------------------------------------------------------------
246 * Handles the event wxEVT_TSBAR from the horizontal bar
248 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
253 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
255 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
258 int actual = getActualHorizontal();
260 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
263 //int nxActual_h = getActualHorizontal();
266 //if (_eventHandler!=NULL)
268 //-------------------------------------------------
269 // Sending the event of wxINSTANT_CHANGE
270 //-------------------------------------------------
271 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
273 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
274 // cWrap->setActualValue( nxActual_h );
276 // newevent.SetClientData( (void *)cWrap );
277 // _eventHandler->ProcessEvent(newevent);
283 * Handles the event wxEVT_TSBAR_START from the horizontal bar
285 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
287 // int nxStart_h = getStartHorizontal();
290 * Handles the event wxEVT_TSBAR_END from the horizontal bar
292 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
294 // int nxEnd_h = getEndHorizontal();
297 * Handles the event wxEVT_SELECTION_END from the horizontal bar
299 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
304 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
306 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
308 // int nxStart_h = getStartHorizontal();
309 // int nxEnd_h = getEndHorizontal();
313 //------------------------------------------------------------------------------------------------------------
314 // Methods for capturing events from the vertical bar
315 //------------------------------------------------------------------------------------------------------------
318 * Handles the event wxEVT_TSBAR from the vertical bar
320 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
325 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
327 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
329 int actual = getActualVertical();
330 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
333 int nxActual_v = getActualVertical();
335 if (_eventHandler!=NULL)
337 //-------------------------------------------------
338 // Sending the event of wxINSTANT_CHANGE
339 //-------------------------------------------------
340 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
342 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
343 cWrap->setActualValue( nxActual_v );
345 newevent.SetClientData( (void *)cWrap );
346 _eventHandler->ProcessEvent(newevent);
351 * Handles the event wxEVT_TSBAR_START from the vertical bar
353 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
355 // int nxStart_v = getStartVertical();
358 * Handles the event wxEVT_TSBAR_END from the vertical bar
360 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
362 // int nxEnd_v = getEndVertical();
365 * Handles the event wxEVT_SELECTION_END from the vertical bar
367 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
372 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
374 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
376 // int nxStart_v = getStartVertical();
377 // int nxEnd_v = getEndVertical();
381 //------------------------------------------------------------------------------------------------------------
382 // Methods for sending events
383 //------------------------------------------------------------------------------------------------------------
385 //------------------------------------------------------------------------------------------------------------
386 // Attributes getters and setters
387 //------------------------------------------------------------------------------------------------------------
390 * Sets the represented values of the vertical bar
391 * @param minRepresented In the minimum represented value of the bar
392 * @param maxRepresented In the maximum represented value of the bar
394 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
396 if( _verticalBar != NULL && _useVerticalBar )
398 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
403 * Sets the represented values of the horizontal bar
404 * @param minRepresented In the minimum represented value of the bar
405 * @param maxRepresented In the maximum represented value of the bar
407 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
409 if( _horizontalBar != NULL && _useHorizontalBar )
411 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
416 * Gets the StartVertical value
417 * @return The StartVertical
419 int wxContourViewPanel :: getStartVertical()
421 return _verticalBar->GetActual();
424 * Gets the EndVertical value
425 * @return The EndVertical
427 int wxContourViewPanel :: getEndVertical()
429 return _verticalBar->GetEnd();
432 * Gets the ActualVertical value
433 * @return The ActualVertical
435 int wxContourViewPanel :: getActualVertical()
437 return _verticalBar->GetActual();//GetEnd();
441 * Sets the StartVertical value
442 * @param nwValue The new value for the StartVertical
444 void wxContourViewPanel :: setStartVertical( int nwValue )
446 _verticalBar->SetEnd( nwValue );
449 * Sets the EndVertical value
450 * @param nwValue The new value for the EndVertical
452 void wxContourViewPanel :: setEndVertical( int nwValue )
454 _verticalBar->SetEnd( nwValue );
457 * Sets the ActualVertical value
458 * @param nwValue The new value for the ActualVertical
460 void wxContourViewPanel :: setActualVertical( int nwValue )
462 _verticalBar->SetActual( nwValue );
466 * Gets the StartHorizontal value
467 * @return The StartHorizontal
469 int wxContourViewPanel :: getStartHorizontal()
471 return _horizontalBar->GetStart();
474 * Gets the EndHorizontal value
475 * @return The EndHorizontal
477 int wxContourViewPanel :: getEndHorizontal()
479 return _horizontalBar->GetEnd();
482 * Gets the ActualHorizontal value
483 * @return The ActualHorizontal
485 int wxContourViewPanel :: getActualHorizontal()
487 return _horizontalBar->GetActual();
491 * Sets the StartHorizontal value
492 * @param nwValue The new value for the StartHorizontal
494 void wxContourViewPanel :: setStartHorizontal( int nwValue )
496 _horizontalBar->SetStart( nwValue );
499 * Sets the EndHorizontal value
500 * @param nwValue The new value for the EndHorizontal
502 void wxContourViewPanel :: setEndHorizontal( int nwValue )
504 _horizontalBar->SetEnd( nwValue );
507 * Sets the ActualHorizontal value
508 * @param nwValue The new value for the ActualHorizontal
510 void wxContourViewPanel :: setActualHorizontal( int nwValue )
512 _horizontalBar->SetActual( nwValue );
516 * Sets the horizontal concept values and name
517 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
518 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
519 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
520 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
521 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
522 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
524 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
526 setHorizontalConceptName( theHorizontalConcept );
527 setHorizontalRepresentedValues( minRepresent, maxRepresent );
528 setActualHorizontal( actualShow );
529 setStartHorizontal( minShowed );
530 setEndHorizontal( maxShowed );
534 * Sets the vertical concept values and name
535 * @param theVerticalConcept The name of the concept for setting at the vertical bar
536 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
537 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
538 * @param minShowed The minShowed value of the concept for setting at the vertical bar
539 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
540 * @param actualShow The actualShow value of the concept for setting at the vertical bar
542 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
544 setVerticalConceptName( theVerticalConcept );
545 setVerticalRepresentedValues( minRepresent, maxRepresent );
546 setActualVertical( actualShow );
547 setStartVertical( minShowed );
548 setEndVertical( maxShowed );
553 * Sets the horizontal concept name
554 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
556 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
558 _horizontalConceptName = theHorizontalConcept;
562 * Gets the horizontal concept name
563 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
565 std::string wxContourViewPanel :: getHorizontalConceptName( )
567 return _horizontalConceptName;
571 * Sets the vertical concept name
572 * @param theVerticalConcept The name of the concept for setting at the vertical bar
574 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
576 _verticalConceptName = theVerticalConcept;
580 * Gets the vertical concept name
581 * @return _verticalConceptName The name of the concept for setting at the vertical bar
583 std::string wxContourViewPanel :: getVerticalConceptName( )
585 return _verticalConceptName;
588 //------------------------------------------------------------------------------------------------------------
589 // Other functional methods
590 //------------------------------------------------------------------------------------------------------------
592 void wxContourViewPanel :: getSpacing( double * spacing )
594 spacing[0] = last_spacing[0];
595 spacing[1] = last_spacing[1];
596 spacing[2] = last_spacing[2];
599 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
601 return theViewPanel->GetwxVtkBaseView(1);
604 double wxContourViewPanel :: getCurrentDeep()
607 // return theViewPanel->GetZ(1);
608 return theViewPanel->GetZ();
613 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
614 return _sceneManager->isEditableCControler(theKeyName);
617 void wxContourViewPanel::removeFromScene(std::string theKeyName){
619 _sceneManager->deleteCViewerCControler(theKeyName);
624 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
625 ConceptDataWrap * dataConcept = NULL;
626 if ( GetId() == event.GetId() )
628 dataConcept = (ConceptDataWrap *)event.GetClientData();
629 int value = dataConcept->getActualValue();
630 //_instantPanel->setConceptValue( dataConcept->getName(), value );
631 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
635 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
636 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
638 setActualVertical( dataConcept->getActualValue());
639 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
641 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
643 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
646 wxContourMainFrame::getInstance()->changeInstant();
649 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
651 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
653 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
655 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
656 double val = getCurrentDeep();
657 //setActualVertical( (int)val );
658 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
659 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
663 void wxContourViewPanel::changeDeep(){
664 double val = getCurrentDeep();
665 setActualVertical( (int)val );
667 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
670 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
671 // int elementsSelected = currentSelection.size();
672 bool ctrlKey = _sceneManager->isCtrlPressed();
673 char toolCommand = _sceneManager->getLastKeyCode();
676 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
678 wxContourMainFrame::getInstance()->onCopy();
680 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
682 wxContourMainFrame::getInstance()->onPaste();
684 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
686 wxContourMainFrame::getInstance()->onDeleteContour();
688 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
690 //toolCommand = &(CREATE_CONTOUR_KEY);
692 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
694 wxContourMainFrame::getInstance()->onLoad();
696 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
698 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
699 }else if( toolCommand == 26 ){
700 wxContourMainFrame::getInstance()->onUndo();
701 }else if( toolCommand == 25 ){
702 wxContourMainFrame::getInstance()->onRedo();
706 void wxContourViewPanel::removeSceneContours()
708 _sceneManager->removeSceneContours();
711 void wxContourViewPanel::addNameWrapperToScene()
713 int i,size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
714 for(i = 0; i < size;i++)
716 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
717 _sceneManager->addToScene(name, true, true, true, false, false );
721 printf("EED \wxContourViewPanel::addNameWrapperToScene Clean this part of code ...\n");
722 printf("EED \wxContourViewPanel::addNameWrapperToScene Clean this part of code ...\n");
723 printf("EED \wxContourViewPanel::addNameWrapperToScene Clean this part of code ...\n");
724 printf("EED \wxContourViewPanel::addNameWrapperToScene Clean this part of code ...\n");
725 printf("EED \wxContourViewPanel::addNameWrapperToScene Clean this part of code ...\n");
726 printf("EED \wxContourViewPanel::addNameWrapperToScene Clean this part of code ...\n");
728 // falta buscar slice antes y despues para encontrar elementos
729 // falta cambiar de colores para antes y despues
730 // falta un flag que active y desactive esta opcion
732 std::vector<int> tempVector;
733 wxContourMainFrame::getInstance()->getInstantVector( tempVector );
736 std::vector<std::string> lstNameBefor = wxContourMainFrame::getInstance()->getOutlinesName(tempVector[1]-10);
737 size = lstNameBefor.size();
738 for(i = 0; i < size;i++)
740 // ctrol active showCtr
741 _sceneManager->addToScene(lstNameBefor[i], true, true, false, false, false );
745 std::vector<std::string> lstNameAfter = wxContourMainFrame::getInstance()->getOutlinesName(tempVector[1]+10);
746 size = lstNameAfter.size();
747 for(i = 0; i < size;i++)
749 // ctrol active showCtr
750 _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false );
756 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
757 return _sceneManager->getSelectedObjects();
760 void wxContourViewPanel::RefreshInterface(){
761 getWxVtkBaseView()->Refresh();
764 vtkImageData* wxContourViewPanel::getImageData(){
765 return _sceneManager->GetImageData();
768 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
770 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
773 int wxContourViewPanel::GetImageDataSizeZ()
775 return _sceneManager->GetImageDataSizeZ();
778 void wxContourViewPanel::GetImageDataRange(double *range)
780 _sceneManager->GetImageDataRange(range);
783 void wxContourViewPanel::SetWidthContour(double width )
785 _sceneManager->SetWidthContour( width );
788 int wxContourViewPanel::getColorWindow()
790 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
791 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
792 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
796 int wxContourViewPanel::getWindowLevel()
798 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
799 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
800 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
804 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
806 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
807 wxvtk2dbaseview->SetColorWindow( colorwindow );
808 wxvtk2dbaseview->SetColorLevel( windowlevel );
811 void wxContourViewPanel::onInterpolation(bool interpolate)
813 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
814 wxvtk2dbaseview->SetInterpolate( interpolate );
817 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
819 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
822 void wxContourViewPanel::setImageSlice(int z){
823 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
824 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
825 baseview->SetActualSlice(z);