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);
188 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
189 theViewPanel->SetSize(800,600);
190 theViewPanel->GetWindow(1)->SetSize(800,600);
192 //------------------------------------------------------------------------------------------------------------
194 void wxContourViewPanel::changeImage(vtkImageData* img)
196 theViewPanel->SetImage(img);
199 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
201 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
204 //------------------------------------------------------------------------------------------------------------
205 void wxContourViewPanel::SetVisibleAxis(bool ok)
207 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
210 //------------------------------------------------------------------------------------------------------------
211 int wxContourViewPanel::GetX()
213 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
215 //------------------------------------------------------------------------------------------------------------
216 int wxContourViewPanel::GetY()
218 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
220 //------------------------------------------------------------------------------------------------------------
221 int wxContourViewPanel::GetZ()
223 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
226 //------------------------------------------------------------------------------------------------------------
227 void wxContourViewPanel::SetXY(int x, int y)
229 GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x);
230 GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y);
233 //------------------------------------------------------------------------------------------------------------
234 void wxContourViewPanel::Refresh()
236 GetwxVtkMPR2DView()->GetRenWin()->Render();
240 //------------------------------------------------------------------------------------------------------------
241 // Methods for capturing events from the horizontal bar
242 //------------------------------------------------------------------------------------------------------------
245 * Handles the event wxEVT_TSBAR from the horizontal bar
247 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
252 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
254 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
257 int actual = getActualHorizontal();
259 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
262 //int nxActual_h = getActualHorizontal();
265 //if (_eventHandler!=NULL)
267 //-------------------------------------------------
268 // Sending the event of wxINSTANT_CHANGE
269 //-------------------------------------------------
270 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
272 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
273 // cWrap->setActualValue( nxActual_h );
275 // newevent.SetClientData( (void *)cWrap );
276 // _eventHandler->ProcessEvent(newevent);
282 * Handles the event wxEVT_TSBAR_START from the horizontal bar
284 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
286 // int nxStart_h = getStartHorizontal();
289 * Handles the event wxEVT_TSBAR_END from the horizontal bar
291 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
293 // int nxEnd_h = getEndHorizontal();
296 * Handles the event wxEVT_SELECTION_END from the horizontal bar
298 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
303 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
305 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
307 // int nxStart_h = getStartHorizontal();
308 // int nxEnd_h = getEndHorizontal();
312 //------------------------------------------------------------------------------------------------------------
313 // Methods for capturing events from the vertical bar
314 //------------------------------------------------------------------------------------------------------------
317 * Handles the event wxEVT_TSBAR from the vertical bar
319 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
324 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
326 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
328 int actual = getActualVertical();
329 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
332 int nxActual_v = getActualVertical();
334 if (_eventHandler!=NULL)
336 //-------------------------------------------------
337 // Sending the event of wxINSTANT_CHANGE
338 //-------------------------------------------------
339 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
341 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
342 cWrap->setActualValue( nxActual_v );
344 newevent.SetClientData( (void *)cWrap );
345 _eventHandler->ProcessEvent(newevent);
350 * Handles the event wxEVT_TSBAR_START from the vertical bar
352 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
354 // int nxStart_v = getStartVertical();
357 * Handles the event wxEVT_TSBAR_END from the vertical bar
359 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
361 // int nxEnd_v = getEndVertical();
364 * Handles the event wxEVT_SELECTION_END from the vertical bar
366 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
371 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
373 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
375 // int nxStart_v = getStartVertical();
376 // int nxEnd_v = getEndVertical();
380 //------------------------------------------------------------------------------------------------------------
381 // Methods for sending events
382 //------------------------------------------------------------------------------------------------------------
384 //------------------------------------------------------------------------------------------------------------
385 // Attributes getters and setters
386 //------------------------------------------------------------------------------------------------------------
389 * Sets the represented values of the vertical bar
390 * @param minRepresented In the minimum represented value of the bar
391 * @param maxRepresented In the maximum represented value of the bar
393 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
395 if( _verticalBar != NULL && _useVerticalBar )
397 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
402 * Sets the represented values of the horizontal bar
403 * @param minRepresented In the minimum represented value of the bar
404 * @param maxRepresented In the maximum represented value of the bar
406 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
408 if( _horizontalBar != NULL && _useHorizontalBar )
410 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
415 * Gets the StartVertical value
416 * @return The StartVertical
418 int wxContourViewPanel :: getStartVertical()
420 return _verticalBar->GetActual();
423 * Gets the EndVertical value
424 * @return The EndVertical
426 int wxContourViewPanel :: getEndVertical()
428 return _verticalBar->GetEnd();
431 * Gets the ActualVertical value
432 * @return The ActualVertical
434 int wxContourViewPanel :: getActualVertical()
436 return _verticalBar->GetActual();//GetEnd();
440 * Sets the StartVertical value
441 * @param nwValue The new value for the StartVertical
443 void wxContourViewPanel :: setStartVertical( int nwValue )
445 _verticalBar->SetEnd( nwValue );
448 * Sets the EndVertical value
449 * @param nwValue The new value for the EndVertical
451 void wxContourViewPanel :: setEndVertical( int nwValue )
453 _verticalBar->SetEnd( nwValue );
456 * Sets the ActualVertical value
457 * @param nwValue The new value for the ActualVertical
459 void wxContourViewPanel :: setActualVertical( int nwValue )
461 _verticalBar->SetActual( nwValue );
465 * Gets the StartHorizontal value
466 * @return The StartHorizontal
468 int wxContourViewPanel :: getStartHorizontal()
470 return _horizontalBar->GetStart();
473 * Gets the EndHorizontal value
474 * @return The EndHorizontal
476 int wxContourViewPanel :: getEndHorizontal()
478 return _horizontalBar->GetEnd();
481 * Gets the ActualHorizontal value
482 * @return The ActualHorizontal
484 int wxContourViewPanel :: getActualHorizontal()
486 return _horizontalBar->GetActual();
490 * Sets the StartHorizontal value
491 * @param nwValue The new value for the StartHorizontal
493 void wxContourViewPanel :: setStartHorizontal( int nwValue )
495 _horizontalBar->SetStart( nwValue );
498 * Sets the EndHorizontal value
499 * @param nwValue The new value for the EndHorizontal
501 void wxContourViewPanel :: setEndHorizontal( int nwValue )
503 _horizontalBar->SetEnd( nwValue );
506 * Sets the ActualHorizontal value
507 * @param nwValue The new value for the ActualHorizontal
509 void wxContourViewPanel :: setActualHorizontal( int nwValue )
511 _horizontalBar->SetActual( nwValue );
515 * Sets the horizontal concept values and name
516 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
517 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
518 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
519 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
520 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
521 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
523 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
525 setHorizontalConceptName( theHorizontalConcept );
526 setHorizontalRepresentedValues( minRepresent, maxRepresent );
527 setActualHorizontal( actualShow );
528 setStartHorizontal( minShowed );
529 setEndHorizontal( maxShowed );
533 * Sets the vertical concept values and name
534 * @param theVerticalConcept The name of the concept for setting at the vertical bar
535 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
536 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
537 * @param minShowed The minShowed value of the concept for setting at the vertical bar
538 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
539 * @param actualShow The actualShow value of the concept for setting at the vertical bar
541 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
543 setVerticalConceptName( theVerticalConcept );
544 setVerticalRepresentedValues( minRepresent, maxRepresent );
545 setActualVertical( actualShow );
546 setStartVertical( minShowed );
547 setEndVertical( maxShowed );
552 * Sets the horizontal concept name
553 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
555 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
557 _horizontalConceptName = theHorizontalConcept;
561 * Gets the horizontal concept name
562 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
564 std::string wxContourViewPanel :: getHorizontalConceptName( )
566 return _horizontalConceptName;
570 * Sets the vertical concept name
571 * @param theVerticalConcept The name of the concept for setting at the vertical bar
573 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
575 _verticalConceptName = theVerticalConcept;
579 * Gets the vertical concept name
580 * @return _verticalConceptName The name of the concept for setting at the vertical bar
582 std::string wxContourViewPanel :: getVerticalConceptName( )
584 return _verticalConceptName;
587 //------------------------------------------------------------------------------------------------------------
588 // Other functional methods
589 //------------------------------------------------------------------------------------------------------------
591 void wxContourViewPanel :: getSpacing( double * spacing )
593 spacing[0] = last_spacing[0];
594 spacing[1] = last_spacing[1];
595 spacing[2] = last_spacing[2];
598 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
600 return theViewPanel->GetwxVtkBaseView(1);
603 double wxContourViewPanel :: getCurrentDeep()
606 // return theViewPanel->GetZ(1);
607 return theViewPanel->GetZ();
612 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
613 return _sceneManager->isEditableCControler(theKeyName);
616 void wxContourViewPanel::removeFromScene(std::string theKeyName){
618 _sceneManager->deleteCViewerCControler(theKeyName);
623 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
624 ConceptDataWrap * dataConcept = NULL;
625 if ( GetId() == event.GetId() )
627 dataConcept = (ConceptDataWrap *)event.GetClientData();
628 int value = dataConcept->getActualValue();
629 //_instantPanel->setConceptValue( dataConcept->getName(), value );
630 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
634 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
635 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
637 setActualVertical( dataConcept->getActualValue());
638 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
640 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
642 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
645 wxContourMainFrame::getInstance()->changeInstant();
648 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
650 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
652 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
654 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
655 double val = getCurrentDeep();
656 //setActualVertical( (int)val );
657 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
658 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
662 void wxContourViewPanel::changeDeep(){
663 double val = getCurrentDeep();
664 setActualVertical( (int)val );
666 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
669 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
670 // int elementsSelected = currentSelection.size();
671 bool ctrlKey = _sceneManager->isCtrlPressed();
672 char toolCommand = _sceneManager->getLastKeyCode();
675 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
677 wxContourMainFrame::getInstance()->onCopy();
679 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
681 wxContourMainFrame::getInstance()->onPaste();
683 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
685 wxContourMainFrame::getInstance()->onDeleteContour();
687 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
689 //toolCommand = &(CREATE_CONTOUR_KEY);
691 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
693 wxContourMainFrame::getInstance()->onLoad();
695 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
697 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
698 }else if( toolCommand == 26 ){
699 wxContourMainFrame::getInstance()->onUndo();
700 }else if( toolCommand == 25 ){
701 wxContourMainFrame::getInstance()->onRedo();
705 void wxContourViewPanel::removeSceneContours()
707 _sceneManager->removeSceneContours();
710 void wxContourViewPanel::addNameWrapperToScene()
712 int i,size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
713 for(i = 0; i < size;i++)
715 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
716 _sceneManager->addToScene(name, true, true, true, false, false );
719 _sceneManager->SetLabelNumberOfContours( "contours:"+std::to_string(size) );
721 std::vector<int> tempVector;
722 wxContourMainFrame::getInstance()->getInstantVector( tempVector );
724 if (_showBeforeContour==true)
727 std::vector<std::string> lstNameBefor;
729 for (i=tempVector[1]-1; i>=0; i--)
731 lstNameBefor = wxContourMainFrame::getInstance()->getOutlinesName( i );
732 size = lstNameBefor.size();
738 for(i = 0; i < size;i++)
740 // ctrol active showCtr
741 _sceneManager->addToScene(lstNameBefor[i], true, true, false, false, false );
743 } // if _before Contour
745 if (_showAfterContour==true)
748 std::vector<std::string> lstNameAfter;
751 getImageData()->GetExtent(ext);
752 int dimZ=ext[5]-ext[4]+1;
753 for (i=tempVector[1]+1; i<dimZ; i++)
755 lstNameAfter = wxContourMainFrame::getInstance()->getOutlinesName( i );
756 size = lstNameAfter.size();
762 for(i = 0; i < size;i++)
764 // ctrol active showCtr
765 _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false );
767 } // if _after Contour
770 std::vector<std::string> wxContourViewPanel::getSelectedObjects()
772 return _sceneManager->getSelectedObjects();
775 void wxContourViewPanel::RefreshInterface()
777 getWxVtkBaseView()->Refresh();
780 vtkImageData* wxContourViewPanel::getImageData()
782 return _sceneManager->GetImageData();
785 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
787 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
790 int wxContourViewPanel::GetImageDataSizeZ()
792 return _sceneManager->GetImageDataSizeZ();
795 void wxContourViewPanel::GetImageDataRange(double *range)
797 _sceneManager->GetImageDataRange(range);
800 void wxContourViewPanel::SetWidthContour(double width )
802 _sceneManager->SetWidthContour( width );
805 int wxContourViewPanel::getColorWindow()
807 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
808 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
809 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
813 int wxContourViewPanel::getWindowLevel()
815 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
816 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
817 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
821 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
823 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
824 wxvtk2dbaseview->SetColorWindow( colorwindow );
825 wxvtk2dbaseview->SetColorLevel( windowlevel );
828 void wxContourViewPanel::onInterpolation(bool interpolate)
830 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
831 wxvtk2dbaseview->SetInterpolate( interpolate );
834 void wxContourViewPanel::onBeforeAfterContour(bool before, bool after)
836 _showBeforeContour = before;
837 _showAfterContour = after;
840 void wxContourViewPanel::onShowTextContour(bool show)
842 _sceneManager->SetShowTextContour( show );
845 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
847 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
850 void wxContourViewPanel::setImageSlice(int z)
852 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
853 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
854 baseview->SetActualSlice(z);