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;
61 _showBeforeContour = false;
62 _showAfterContour = false;
65 _verticalConceptName = "";
66 _horizontalConceptName = "";
67 createHorizontalBar(1,80);
68 createVerticalBar(1,200);
71 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH);
72 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
73 #if wxMAJOR_VERSION <= 2
74 panelSizer -> AddGrowableCol(2);
75 panelSizer -> AddGrowableRow(2);
77 panelSizer -> AddGrowableRow(0,1);
78 panelSizer -> AddGrowableCol(2,1);
80 panelSizer->Add(_verticalBar, 0, wxEXPAND);
81 panelSizer->AddSpacer(gapV);
82 panelSizer->Add(theViewPanel, 1, wxEXPAND);
83 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);
96 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
97 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
98 //Connecting the events to the horizontal bar
99 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
100 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
101 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
102 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
103 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
104 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
106 //Connecting the events to the vertical bar
107 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
108 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
109 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
110 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
111 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
112 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
113 this->SetSizer( outSizer );
114 this->SetAutoLayout( true );
116 //SetSize(1900,1900);
117 //theViewPanel->SetSize(800,600);
118 //theViewPanel->GetWindow(1)->SetSize(800,600);
119 //outSizer->Fit( this );
120 initializeScenceManager();
124 wxContourViewPanel :: ~wxContourViewPanel()
126 delete _sceneManager;
129 void wxContourViewPanel::initializeScenceManager()
131 //_theViewPanel = theViewPanel;
132 //_theViewPanel->setWxEventHandler( this );
134 this->getSpacing(spc);
135 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
136 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
137 Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
138 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
139 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
140 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
141 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
144 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager()
146 return _sceneManager;
149 //------------------------------------------------------------------------------------------------------------
150 // Creational and initialization methods
151 //------------------------------------------------------------------------------------------------------------
153 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
155 _eventHandler = theEventHandler;
158 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
160 _horizontalBar = new mBarRange(this, 1500,80);
161 _horizontalBar -> setVisibleLabels (true);
162 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
163 _horizontalBar -> setActiveStateTo(true);
164 _horizontalBar -> SetActual( horzStart );
165 _horizontalBar -> setDeviceBlitStart (10,10);
166 _horizontalBar -> setDeviceEndMargin (10);
169 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
171 _verticalBar = new mBarRange(this, 1500,40);
172 _verticalBar -> SetOrientation(false);
173 _verticalBar -> setVisibleLabels (false);
174 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
175 _verticalBar -> setActiveStateTo(true);
176 _verticalBar -> SetActual( vertStart );
177 _verticalBar -> setDeviceBlitStart (10,10);
178 _verticalBar -> setDeviceEndMargin (10);
180 //------------------------------------------------------------------------------------------------------------
182 void wxContourViewPanel::createViewPanel()
184 std::vector<int> * numViews = new std::vector<int> ();
185 numViews->push_back(0);
186 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
187 SetVisibleAxis(false);
189 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
191 theViewPanel->SetSize(800,600);
192 theViewPanel->GetWindow(1)->SetSize(800,600);
195 //------------------------------------------------------------------------------------------------------------
197 void wxContourViewPanel::changeImage(vtkImageData* img){
199 theViewPanel->SetImage(img);
202 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
204 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
207 //------------------------------------------------------------------------------------------------------------
208 void wxContourViewPanel::SetVisibleAxis(bool ok)
210 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
213 //------------------------------------------------------------------------------------------------------------
214 int wxContourViewPanel::GetX()
216 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
218 //------------------------------------------------------------------------------------------------------------
219 int wxContourViewPanel::GetY()
221 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
223 //------------------------------------------------------------------------------------------------------------
224 int wxContourViewPanel::GetZ()
226 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
229 //------------------------------------------------------------------------------------------------------------
230 void wxContourViewPanel::SetXY(int x, int y)
232 GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x);
233 GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y);
236 //------------------------------------------------------------------------------------------------------------
237 void wxContourViewPanel::Refresh()
239 GetwxVtkMPR2DView()->GetRenWin()->Render();
243 //------------------------------------------------------------------------------------------------------------
244 // Methods for capturing events from the horizontal bar
245 //------------------------------------------------------------------------------------------------------------
248 * Handles the event wxEVT_TSBAR from the horizontal bar
250 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
255 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
257 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
260 int actual = getActualHorizontal();
262 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
265 //int nxActual_h = getActualHorizontal();
268 //if (_eventHandler!=NULL)
270 //-------------------------------------------------
271 // Sending the event of wxINSTANT_CHANGE
272 //-------------------------------------------------
273 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
275 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
276 // cWrap->setActualValue( nxActual_h );
278 // newevent.SetClientData( (void *)cWrap );
279 // _eventHandler->ProcessEvent(newevent);
285 * Handles the event wxEVT_TSBAR_START from the horizontal bar
287 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
289 // int nxStart_h = getStartHorizontal();
292 * Handles the event wxEVT_TSBAR_END from the horizontal bar
294 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
296 // int nxEnd_h = getEndHorizontal();
299 * Handles the event wxEVT_SELECTION_END from the horizontal bar
301 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
306 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
308 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
310 // int nxStart_h = getStartHorizontal();
311 // int nxEnd_h = getEndHorizontal();
315 //------------------------------------------------------------------------------------------------------------
316 // Methods for capturing events from the vertical bar
317 //------------------------------------------------------------------------------------------------------------
320 * Handles the event wxEVT_TSBAR from the vertical bar
322 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
327 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
329 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
331 int actual = getActualVertical();
332 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
335 int nxActual_v = getActualVertical();
337 if (_eventHandler!=NULL)
339 //-------------------------------------------------
340 // Sending the event of wxINSTANT_CHANGE
341 //-------------------------------------------------
342 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
344 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
345 cWrap->setActualValue( nxActual_v );
347 newevent.SetClientData( (void *)cWrap );
348 _eventHandler->ProcessEvent(newevent);
353 * Handles the event wxEVT_TSBAR_START from the vertical bar
355 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
357 // int nxStart_v = getStartVertical();
360 * Handles the event wxEVT_TSBAR_END from the vertical bar
362 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
364 // int nxEnd_v = getEndVertical();
367 * Handles the event wxEVT_SELECTION_END from the vertical bar
369 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
374 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
376 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
378 // int nxStart_v = getStartVertical();
379 // int nxEnd_v = getEndVertical();
383 //------------------------------------------------------------------------------------------------------------
384 // Methods for sending events
385 //------------------------------------------------------------------------------------------------------------
387 //------------------------------------------------------------------------------------------------------------
388 // Attributes getters and setters
389 //------------------------------------------------------------------------------------------------------------
392 * Sets the represented values of the vertical bar
393 * @param minRepresented In the minimum represented value of the bar
394 * @param maxRepresented In the maximum represented value of the bar
396 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
398 if( _verticalBar != NULL && _useVerticalBar )
400 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
405 * Sets the represented values of the horizontal bar
406 * @param minRepresented In the minimum represented value of the bar
407 * @param maxRepresented In the maximum represented value of the bar
409 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
411 if( _horizontalBar != NULL && _useHorizontalBar )
413 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
418 * Gets the StartVertical value
419 * @return The StartVertical
421 int wxContourViewPanel :: getStartVertical()
423 return _verticalBar->GetActual();
426 * Gets the EndVertical value
427 * @return The EndVertical
429 int wxContourViewPanel :: getEndVertical()
431 return _verticalBar->GetEnd();
434 * Gets the ActualVertical value
435 * @return The ActualVertical
437 int wxContourViewPanel :: getActualVertical()
439 return _verticalBar->GetActual();//GetEnd();
443 * Sets the StartVertical value
444 * @param nwValue The new value for the StartVertical
446 void wxContourViewPanel :: setStartVertical( int nwValue )
448 _verticalBar->SetEnd( nwValue );
451 * Sets the EndVertical value
452 * @param nwValue The new value for the EndVertical
454 void wxContourViewPanel :: setEndVertical( int nwValue )
456 _verticalBar->SetEnd( nwValue );
459 * Sets the ActualVertical value
460 * @param nwValue The new value for the ActualVertical
462 void wxContourViewPanel :: setActualVertical( int nwValue )
464 _verticalBar->SetActual( nwValue );
468 * Gets the StartHorizontal value
469 * @return The StartHorizontal
471 int wxContourViewPanel :: getStartHorizontal()
473 return _horizontalBar->GetStart();
476 * Gets the EndHorizontal value
477 * @return The EndHorizontal
479 int wxContourViewPanel :: getEndHorizontal()
481 return _horizontalBar->GetEnd();
484 * Gets the ActualHorizontal value
485 * @return The ActualHorizontal
487 int wxContourViewPanel :: getActualHorizontal()
489 return _horizontalBar->GetActual();
493 * Sets the StartHorizontal value
494 * @param nwValue The new value for the StartHorizontal
496 void wxContourViewPanel :: setStartHorizontal( int nwValue )
498 _horizontalBar->SetStart( nwValue );
501 * Sets the EndHorizontal value
502 * @param nwValue The new value for the EndHorizontal
504 void wxContourViewPanel :: setEndHorizontal( int nwValue )
506 _horizontalBar->SetEnd( nwValue );
509 * Sets the ActualHorizontal value
510 * @param nwValue The new value for the ActualHorizontal
512 void wxContourViewPanel :: setActualHorizontal( int nwValue )
514 _horizontalBar->SetActual( nwValue );
518 * Sets the horizontal concept values and name
519 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
520 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
521 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
522 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
523 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
524 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
526 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
528 setHorizontalConceptName( theHorizontalConcept );
529 setHorizontalRepresentedValues( minRepresent, maxRepresent );
530 setActualHorizontal( actualShow );
531 setStartHorizontal( minShowed );
532 setEndHorizontal( maxShowed );
536 * Sets the vertical concept values and name
537 * @param theVerticalConcept The name of the concept for setting at the vertical bar
538 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
539 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
540 * @param minShowed The minShowed value of the concept for setting at the vertical bar
541 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
542 * @param actualShow The actualShow value of the concept for setting at the vertical bar
544 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
546 setVerticalConceptName( theVerticalConcept );
547 setVerticalRepresentedValues( minRepresent, maxRepresent );
548 setActualVertical( actualShow );
549 setStartVertical( minShowed );
550 setEndVertical( maxShowed );
555 * Sets the horizontal concept name
556 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
558 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
560 _horizontalConceptName = theHorizontalConcept;
564 * Gets the horizontal concept name
565 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
567 std::string wxContourViewPanel :: getHorizontalConceptName( )
569 return _horizontalConceptName;
573 * Sets the vertical concept name
574 * @param theVerticalConcept The name of the concept for setting at the vertical bar
576 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
578 _verticalConceptName = theVerticalConcept;
582 * Gets the vertical concept name
583 * @return _verticalConceptName The name of the concept for setting at the vertical bar
585 std::string wxContourViewPanel :: getVerticalConceptName( )
587 return _verticalConceptName;
590 //------------------------------------------------------------------------------------------------------------
591 // Other functional methods
592 //------------------------------------------------------------------------------------------------------------
594 void wxContourViewPanel :: getSpacing( double * spacing )
596 spacing[0] = last_spacing[0];
597 spacing[1] = last_spacing[1];
598 spacing[2] = last_spacing[2];
601 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
603 return theViewPanel->GetwxVtkBaseView(1);
606 double wxContourViewPanel :: getCurrentDeep()
609 // return theViewPanel->GetZ(1);
610 return theViewPanel->GetZ();
615 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
616 return _sceneManager->isEditableCControler(theKeyName);
619 void wxContourViewPanel::removeFromScene(std::string theKeyName){
621 _sceneManager->deleteCViewerCControler(theKeyName);
626 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
627 ConceptDataWrap * dataConcept = NULL;
628 if ( GetId() == event.GetId() )
630 dataConcept = (ConceptDataWrap *)event.GetClientData();
631 int value = dataConcept->getActualValue();
632 //_instantPanel->setConceptValue( dataConcept->getName(), value );
633 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
637 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
638 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
640 setActualVertical( dataConcept->getActualValue());
641 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
643 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
645 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
648 wxContourMainFrame::getInstance()->changeInstant();
651 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
653 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
655 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
657 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
658 double val = getCurrentDeep();
659 //setActualVertical( (int)val );
660 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
661 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
665 void wxContourViewPanel::changeDeep(){
666 double val = getCurrentDeep();
667 setActualVertical( (int)val );
669 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
672 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
673 // int elementsSelected = currentSelection.size();
674 bool ctrlKey = _sceneManager->isCtrlPressed();
675 char toolCommand = _sceneManager->getLastKeyCode();
678 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
680 wxContourMainFrame::getInstance()->onCopy();
682 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
684 wxContourMainFrame::getInstance()->onPaste();
686 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
688 wxContourMainFrame::getInstance()->onDeleteContour();
690 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
692 //toolCommand = &(CREATE_CONTOUR_KEY);
694 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
696 wxContourMainFrame::getInstance()->onLoad();
698 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
700 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
701 }else if( toolCommand == 26 ){
702 wxContourMainFrame::getInstance()->onUndo();
703 }else if( toolCommand == 25 ){
704 wxContourMainFrame::getInstance()->onRedo();
708 void wxContourViewPanel::removeSceneContours()
710 _sceneManager->removeSceneContours();
713 void wxContourViewPanel::addNameWrapperToScene()
715 int i,size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
716 for(i = 0; i < size;i++)
718 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
719 _sceneManager->addToScene(name, true, true, true, false, false );
722 _sceneManager->SetLabelNumberOfContours( "contours:"+std::to_string(size) );
724 std::vector<int> tempVector;
725 wxContourMainFrame::getInstance()->getInstantVector( tempVector );
727 if (_showBeforeContour==true)
730 std::vector<std::string> lstNameBefor;
732 for (i=tempVector[1]-1; i>=0; i--)
734 lstNameBefor = wxContourMainFrame::getInstance()->getOutlinesName( i );
735 size = lstNameBefor.size();
741 for(i = 0; i < size;i++)
743 // ctrol active showCtr
744 _sceneManager->addToScene(lstNameBefor[i], true, true, false, false, false );
746 } // if _before Contour
748 if (_showAfterContour==true)
751 std::vector<std::string> lstNameAfter;
754 getImageData()->GetExtent(ext);
755 int dimZ=ext[5]-ext[4]+1;
756 for (i=tempVector[1]+1; i<dimZ; i++)
758 lstNameAfter = wxContourMainFrame::getInstance()->getOutlinesName( i );
759 size = lstNameAfter.size();
765 for(i = 0; i < size;i++)
767 // ctrol active showCtr
768 _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false );
770 } // if _after Contour
773 std::vector<std::string> wxContourViewPanel::getSelectedObjects()
775 return _sceneManager->getSelectedObjects();
778 void wxContourViewPanel::RefreshInterface()
780 getWxVtkBaseView()->Refresh();
783 vtkImageData* wxContourViewPanel::getImageData()
785 return _sceneManager->GetImageData();
788 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
790 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
793 int wxContourViewPanel::GetImageDataSizeZ()
795 return _sceneManager->GetImageDataSizeZ();
798 void wxContourViewPanel::GetImageDataRange(double *range)
800 _sceneManager->GetImageDataRange(range);
803 void wxContourViewPanel::SetWidthContour(double width )
805 _sceneManager->SetWidthContour( width );
808 int wxContourViewPanel::getColorWindow()
810 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
811 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
812 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
816 int wxContourViewPanel::getWindowLevel()
818 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
819 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
820 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
824 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
826 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
827 wxvtk2dbaseview->SetColorWindow( colorwindow );
828 wxvtk2dbaseview->SetColorLevel( windowlevel );
831 void wxContourViewPanel::onInterpolation(bool interpolate)
833 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
834 wxvtk2dbaseview->SetInterpolate( interpolate );
837 void wxContourViewPanel::onBeforeAfterContour(bool before, bool after)
839 _showBeforeContour = before;
840 _showAfterContour = after;
843 void wxContourViewPanel::onShowTextContour(bool show)
845 _sceneManager->SetShowTextContour( show );
848 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
850 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
853 void wxContourViewPanel::setImageSlice(int z)
855 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
856 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
857 baseview->SetActualSlice(z);