creaContours_lib
wxContourViewPanel.cxx
Go to the documentation of this file.
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 # pour la Sant�)
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
8 #
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.
15 #
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
20 # liability.
21 #
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 # ------------------------------------------------------------------------ */
25 
26 
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "wxContourViewPanel.h"
31 
32 #include "wxContourMainFrame.h"
33 //----------------------------------------------------------------------------------------------------------------
34 // Other includes
35 //----------------------------------------------------------------------------------------------------------------
36 //#include "ConceptDataWrap.h"
37 
38 //this should be eliminated at some point
39 //#include "wxContourEventHandler.h"
40 //----------------------------------------------------------------------------------------------------------------
41 // Class implementation
42 //----------------------------------------------------------------------------------------------------------------
45 //----------------------------------------------------------------------------------------------------------------
46 // Throwed Events definition
47 //----------------------------------------------------------------------------------------------------------------
48 
49 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
50 
51 
52  //------------------------------------------------------------------------------------------------------------
53  // Constructors & Destructors
54  //------------------------------------------------------------------------------------------------------------
55  /*{
56 
57  showingVID = theShowingImage;
58  int gapH = 20;
59  int gapV = 10;
60  createHorizontalBar(1,80);
61  createVerticalBar(1,200);
62  createViewPanel();
63 
64  wxFlexGridSizer * panelSizer = new wxFlexGridSizer(3,1,0,0);
65  panelSizer->AddSpacer(gapV);
66  panelSizer -> AddGrowableCol(1);
67  panelSizer->Add(theViewPanel, 1, wxEXPAND);
68  panelSizer->AddSpacer(gapV);
69 
70  wxFlexGridSizer * downSizer = new wxFlexGridSizer(1,3,gapV,gapH);
71  downSizer->Add(_verticalBar, 1, wxEXPAND);
72  //downSizer->AddSpacer(gapH);
73  downSizer -> AddGrowableCol(1);
74  downSizer->Add(panelSizer, 1, wxEXPAND|wxALL|wxCENTER);
75  //downSizer->AddSpacer(gapH);
76  outSizer = new wxFlexGridSizer(3,1,1,1);
77  outSizer->Add(_horizontalBar, 1, wxEXPAND);
78  outSizer -> AddGrowableRow(1);
79  outSizer -> AddGrowableCol(1);
80  outSizer->Add(downSizer, 1, wxEXPAND);
81 
82  _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV);
83  _horizontalBar->setDeviceEndMargin( gapH+10 );
84 
85  //Connecting the events to the horizontal bar
86  Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
87  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
88  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
89  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
90  Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
91  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
92 
93  //Connecting the events to the vertical bar
94  Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
95  Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
96  Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
97  Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
98  Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
99  Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
100 
101 
102  this->SetAutoLayout( true );
103  SetSizer( outSizer );
104  this->Layout();
105 
106  SetSize(900,700);
107  theViewPanel->SetSize(800,600);
108  theViewPanel->GetWindow(1)->SetSize(800,600);
109 
110  outSizer->Fit( this );
111  SetBackgroundColour(wxColour(255,0,0));
112 
113  }*/
114  //:wxScrolledWindow(parent, -1, pos, size, style)
115  wxContourViewPanel :: wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
116  :wxPanel(parent, -1, pos, size, style)
117  {
118  theShowingImage->GetSpacing(last_spacing);
119  showingVID = theShowingImage;
120  int gapH = 20;
121  int gapV = 10;
122  _verticalConceptName = "";
123  _horizontalConceptName = "";
124  createHorizontalBar(1,80);
125  createVerticalBar(1,200);
126  createViewPanel();
127  _eventHandler = NULL;
128 
129  wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1, 4, gapV, gapH);
130  panelSizer -> AddGrowableCol(2);
131  panelSizer -> AddGrowableRow(2);
132  panelSizer->Add(_verticalBar, 1, wxGROW);
133  panelSizer->AddSpacer(gapV);
134  panelSizer->Add(theViewPanel, 1, wxGROW);
135  panelSizer->AddSpacer(gapV);
136 
137  outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
138  outSizer -> AddGrowableCol(1);
139  outSizer -> AddGrowableRow(1);
140  outSizer->Add( _horizontalBar, 1, wxGROW);
141  outSizer->Add( panelSizer, 1, wxGROW);
142  outSizer->AddSpacer(gapH);
143 
144  _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
145  _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
146 
147  //Connecting the events to the horizontal bar
148  Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
149  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
150  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
151  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
152  Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
153  Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
154 
155  //Connecting the events to the vertical bar
156  Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
157  Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
158  Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
159  Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
160  Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
161  Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
162 
163 
164  this->SetSizer( outSizer );
165  this->SetAutoLayout( true );
166  this->Layout();
167 
168  //SetSize(1900,1900);
169  //theViewPanel->SetSize(800,600);
170  //theViewPanel->GetWindow(1)->SetSize(800,600);
171 
172  //outSizer->Fit( this );
173 
174  initializeScenceManager();
175  }
176 
177 
179  {
180  delete _sceneManager;
181  }
182 
184 
185  //_theViewPanel = theViewPanel;
186  //_theViewPanel->setWxEventHandler( this );
187 
188  double spc[3];
189  this->getSpacing(spc);
190  _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
191 
192  Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
193  Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
194  Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
195  Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
196  Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
197  Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
198 
199  }
200 
202  return _sceneManager;
203  }
204 
205  //------------------------------------------------------------------------------------------------------------
206  // Creational and initialization methods
207  //------------------------------------------------------------------------------------------------------------
208 
209  void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
210  {
211  _eventHandler = theEventHandler;
212  }
213 
214  void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
215  {
216  _horizontalBar = new mBarRange(this, 1500,80);
217  _horizontalBar -> setVisibleLabels (true);
218  _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
219  _horizontalBar -> setActiveStateTo(true);
220  _horizontalBar -> SetActual( horzStart );
221  _horizontalBar -> setDeviceBlitStart (10,10);
222  _horizontalBar -> setDeviceEndMargin (10);
223  }
224 
225  void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
226  {
227  _verticalBar = new mBarRange(this, 1500,40);
228  _verticalBar -> SetOrientation(false);
229  _verticalBar -> setVisibleLabels (false);
230  _verticalBar -> setRepresentedValues (vertStart, vertEnd);
231  _verticalBar -> setActiveStateTo(true);
232  _verticalBar -> SetActual( vertStart );
233  _verticalBar -> setDeviceBlitStart (10,10);
234  _verticalBar -> setDeviceEndMargin (10);
235  }
236  //------------------------------------------------------------------------------------------------------------
237 
239  {
240  std::vector<int> * numViews = new std::vector<int> ();
241  numViews->push_back(0);
242  theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
243  SetVisibleAxis(false);
244 
245  theViewPanel->SetBackgroundColour(wxColour(0,0,0));
246 
247  theViewPanel->SetSize(800,600);
248  theViewPanel->GetWindow(1)->SetSize(800,600);
249 
250  }
251  //------------------------------------------------------------------------------------------------------------
252 
253  void wxContourViewPanel::changeImage(vtkImageData* img){
254 
255  theViewPanel->SetImage(img);
256 
257  }
259  {
260  return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
261  }
262 
263  //------------------------------------------------------------------------------------------------------------
265  {
266  GetwxVtkMPR2DView()->SetVisibleAxis(ok);
267  }
268 
269  //------------------------------------------------------------------------------------------------------------
271  {
272  return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
273  }
274  //------------------------------------------------------------------------------------------------------------
276  {
277  return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
278  }
279  //------------------------------------------------------------------------------------------------------------
281  {
282  return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
283  }
284 
285  //------------------------------------------------------------------------------------------------------------
287  {
288  GetwxVtkMPR2DView()->GetRenWin()->Render();
289  }
290 
291 
292  //------------------------------------------------------------------------------------------------------------
293  // Methods for capturing events from the horizontal bar
294  //------------------------------------------------------------------------------------------------------------
295 
300  {
301 
302  }
307  {
308 
309  int actual = getActualHorizontal();
310 
312 
313  //JCP 26 - 11 - 08
314  //int nxActual_h = getActualHorizontal();
315 
316 
317  //if (_eventHandler!=NULL)
318  //{
319  //-------------------------------------------------
320  // Sending the event of wxINSTANT_CHANGE
321  //-------------------------------------------------
322  // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
323 
324  // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
325  // cWrap->setActualValue( nxActual_h );
326 
327  // newevent.SetClientData( (void *)cWrap );
328  // _eventHandler->ProcessEvent(newevent);
329 
330  //}
331  //JCP 26 - 11 - 08
332  }
337  {
338 // int nxStart_h = getStartHorizontal();
339  }
344  {
345 // int nxEnd_h = getEndHorizontal();
346  }
351  {
352 
353  }
358  {
359 // int nxStart_h = getStartHorizontal();
360 // int nxEnd_h = getEndHorizontal();
361  }
362 
363 
364  //------------------------------------------------------------------------------------------------------------
365  // Methods for capturing events from the vertical bar
366  //------------------------------------------------------------------------------------------------------------
367 
371  void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
372  {
373 
374  }
379  {
380  int actual = getActualVertical();
382  //JCP 26 - 11 - 08
383  /*
384  int nxActual_v = getActualVertical();
385 
386  if (_eventHandler!=NULL)
387  {
388  //-------------------------------------------------
389  // Sending the event of wxINSTANT_CHANGE
390  //-------------------------------------------------
391  wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
392 
393  ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
394  cWrap->setActualValue( nxActual_v );
395 
396  newevent.SetClientData( (void *)cWrap );
397  _eventHandler->ProcessEvent(newevent);
398  }*/
399  //JCP 26 - 11 - 08
400  }
405  {
406 // int nxStart_v = getStartVertical();
407  }
412  {
413 // int nxEnd_v = getEndVertical();
414  }
419  {
420 
421  }
425  void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
426  {
427 // int nxStart_v = getStartVertical();
428 // int nxEnd_v = getEndVertical();
429  }
430 
431 
432  //------------------------------------------------------------------------------------------------------------
433  // Methods for sending events
434  //------------------------------------------------------------------------------------------------------------
435 
436  //------------------------------------------------------------------------------------------------------------
437  // Attributes getters and setters
438  //------------------------------------------------------------------------------------------------------------
439 
445  void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
446  {
447  if( _verticalBar != NULL && _useVerticalBar )
448  {
449  _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
450  }
451  }
452 
458  void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
459  {
460  if( _horizontalBar != NULL && _useHorizontalBar )
461  {
462  _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
463  }
464  }
465 
471  {
472  return _verticalBar->GetActual();
473  }
479  {
480  return _verticalBar->GetEnd();
481  }
487  {
488  return _verticalBar->GetActual();//GetEnd();
489  }
490 
496  {
497  _verticalBar->SetEnd( nwValue );
498  }
504  {
505  _verticalBar->SetEnd( nwValue );
506  }
512  {
513  _verticalBar->SetActual( nwValue );
514  }
515 
521  {
522  return _horizontalBar->GetStart();
523  }
529  {
530  return _horizontalBar->GetEnd();
531  }
537  {
538  return _horizontalBar->GetActual();
539  }
540 
546  {
547  _horizontalBar->SetStart( nwValue );
548  }
554  {
555  _horizontalBar->SetEnd( nwValue );
556  }
562  {
563  _horizontalBar->SetActual( nwValue );
564  }
565 
575  void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
576  {
577  setHorizontalConceptName( theHorizontalConcept );
578  setHorizontalRepresentedValues( minRepresent, maxRepresent );
579  setActualHorizontal( actualShow );
580  setStartHorizontal( minShowed );
581  setEndHorizontal( maxShowed );
582  }
583 
593  void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
594  {
595  setVerticalConceptName( theVerticalConcept );
596  setVerticalRepresentedValues( minRepresent, maxRepresent );
597  setActualVertical( actualShow );
598  setStartVertical( minShowed );
599  setEndVertical( maxShowed );
600  }
601 
602 
607  void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
608  {
609  _horizontalConceptName = theHorizontalConcept;
610  }
611 
617  {
618  return _horizontalConceptName;
619  }
620 
625  void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
626  {
627  _verticalConceptName = theVerticalConcept;
628  }
629 
635  {
636  return _verticalConceptName;
637  }
638 
639  //------------------------------------------------------------------------------------------------------------
640  // Other functional methods
641  //------------------------------------------------------------------------------------------------------------
642 
643  void wxContourViewPanel :: getSpacing( double * spacing )
644  {
645  spacing[0] = last_spacing[0];
646  spacing[1] = last_spacing[1];
647  spacing[2] = last_spacing[2];
648  }
649 
651  {
652  return theViewPanel->GetwxVtkBaseView(1);
653  }
654 
656  {
657 //EED 08/04/2008
658 // return theViewPanel->GetZ(1);
659  return theViewPanel->GetZ();
660  //return GetZ();
661  }
662 
663 
664  bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
665  return _sceneManager->isEditableCControler(theKeyName);
666  }
667 
668  void wxContourViewPanel::removeFromScene(std::string theKeyName){
669 
671 
672 
673  }
674 
675  void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
676  ConceptDataWrap * dataConcept = NULL;
677  if ( GetId() == event.GetId() )
678  {
679  dataConcept = (ConceptDataWrap *)event.GetClientData();
680  int value = dataConcept->getActualValue();
681  //_instantPanel->setConceptValue( dataConcept->getName(), value );
682  wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
683  }
684  else
685  {
687  if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
688  {
689  setActualVertical( dataConcept->getActualValue());
690  //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
691  }
692  else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
693  {
694  setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
695  }
696  }
698  }
699 
700  void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
701  }
702  void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
703  }
704  void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
705  }
706  void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
707  double val = getCurrentDeep();
708  //setActualVertical( (int)val );
710  //_instantPanel->setConceptValue( "Axe Depth", (int)val );
711 
712 // changeInstant();
713  }
715  double val = getCurrentDeep();
716  setActualVertical( (int)val );
717  }
718  void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
719 
720 
721  std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
722 // int elementsSelected = currentSelection.size();
723  bool ctrlKey = _sceneManager->isCtrlPressed();
724  char toolCommand = _sceneManager->getLastKeyCode();
725 
726 
727  if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
728  {
730  }
731  else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
732  {
734  }
735  else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
736  {
738  }
739  else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
740  {
741  //toolCommand = &(CREATE_CONTOUR_KEY);
742  }
743  else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
744  {
746  }
747  else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
748  {
750  }else if( toolCommand == 26 ){
752  }else if( toolCommand == 25 ){
754  }
755  }
756 
759  }
760 
763  for(int i = 0; i < size;i++){
764  std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
765  _sceneManager->addToScene(name, true, true, true, false, false );
766  }
767  }
768 
769  std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
771  }
772 
774  getWxVtkBaseView()->Refresh();
775  }
776 
778  return _sceneManager->GetImageData();
779  }
780 
781  void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
782  {
783  _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
784  }
785 
787  {
789  }
790 
792  {
794  }
795 
797  {
798  _sceneManager->SetWidthContour( width );
799  }
800 
802  {
803  wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
804  vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
805  int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
806  return colorwindow;
807  }
808 
810  {
811  wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
812  vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
813  int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
814  return windowlevel;
815  }
816 
817  void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
818  {
819  wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
820  vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
821  imageviewer->SetColorWindow(colorwindow);
822  imageviewer->SetColorLevel(windowlevel);
823  }
824 
825  void wxContourViewPanel::onInterpolation(bool interpolate)
826  {
827  wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
828  vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
829 
830  if (interpolate){
831  imageviewer->GetImageActor()->InterpolateOn();
832  } else {
833  imageviewer->GetImageActor()->InterpolateOff();
834  }
835  }
836 
837  void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
838  {
839  _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
840  }
841 
843  vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
844  wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
845  baseview->SetActualSlice(z);
847  }
848