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 //------------------------------------------------------------------------------------------------------------
57 showingVID = theShowingImage;
60 createHorizontalBar(1,80);
61 createVerticalBar(1,200);
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);
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);
82 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV);
83 _horizontalBar->setDeviceEndMargin( gapH+10 );
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 );
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 );
102 this->SetAutoLayout( true );
103 SetSizer( outSizer );
107 theViewPanel->SetSize(800,600);
108 theViewPanel->GetWindow(1)->SetSize(800,600);
110 outSizer->Fit( this );
111 SetBackgroundColour(wxColour(255,0,0));
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)
118 theShowingImage->GetSpacing(last_spacing);
119 showingVID = theShowingImage;
122 _verticalConceptName = "";
123 _horizontalConceptName = "";
124 createHorizontalBar(1,80);
125 createVerticalBar(1,200);
127 _eventHandler = NULL;
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);
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);
144 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
145 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
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 );
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 );
164 this->SetSizer( outSizer );
165 this->SetAutoLayout( true );
168 //SetSize(1900,1900);
169 //theViewPanel->SetSize(800,600);
170 //theViewPanel->GetWindow(1)->SetSize(800,600);
172 //outSizer->Fit( this );
174 initializeScenceManager();
178 wxContourViewPanel :: ~wxContourViewPanel()
180 delete _sceneManager;
183 void wxContourViewPanel::initializeScenceManager(){
185 //_theViewPanel = theViewPanel;
186 //_theViewPanel->setWxEventHandler( this );
189 this->getSpacing(spc);
190 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
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 );
201 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
202 return _sceneManager;
205 //------------------------------------------------------------------------------------------------------------
206 // Creational and initialization methods
207 //------------------------------------------------------------------------------------------------------------
209 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
211 _eventHandler = theEventHandler;
214 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
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);
225 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
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);
236 //------------------------------------------------------------------------------------------------------------
238 void wxContourViewPanel::createViewPanel()
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);
245 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
247 theViewPanel->SetSize(800,600);
248 theViewPanel->GetWindow(1)->SetSize(800,600);
251 //------------------------------------------------------------------------------------------------------------
253 void wxContourViewPanel::changeImage(vtkImageData* img){
255 theViewPanel->SetImage(img);
258 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
260 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
263 //------------------------------------------------------------------------------------------------------------
264 void wxContourViewPanel::SetVisibleAxis(bool ok)
266 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
269 //------------------------------------------------------------------------------------------------------------
270 int wxContourViewPanel::GetX()
272 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
274 //------------------------------------------------------------------------------------------------------------
275 int wxContourViewPanel::GetY()
277 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
279 //------------------------------------------------------------------------------------------------------------
280 int wxContourViewPanel::GetZ()
282 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
285 //------------------------------------------------------------------------------------------------------------
286 void wxContourViewPanel::Refresh()
288 GetwxVtkMPR2DView()->GetRenWin()->Render();
292 //------------------------------------------------------------------------------------------------------------
293 // Methods for capturing events from the horizontal bar
294 //------------------------------------------------------------------------------------------------------------
297 * Handles the event wxEVT_TSBAR from the horizontal bar
299 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
304 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
306 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
309 int actual = getActualHorizontal();
311 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
314 //int nxActual_h = getActualHorizontal();
317 //if (_eventHandler!=NULL)
319 //-------------------------------------------------
320 // Sending the event of wxINSTANT_CHANGE
321 //-------------------------------------------------
322 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
324 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
325 // cWrap->setActualValue( nxActual_h );
327 // newevent.SetClientData( (void *)cWrap );
328 // _eventHandler->ProcessEvent(newevent);
334 * Handles the event wxEVT_TSBAR_START from the horizontal bar
336 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
338 // int nxStart_h = getStartHorizontal();
341 * Handles the event wxEVT_TSBAR_END from the horizontal bar
343 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
345 // int nxEnd_h = getEndHorizontal();
348 * Handles the event wxEVT_SELECTION_END from the horizontal bar
350 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
355 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
357 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
359 // int nxStart_h = getStartHorizontal();
360 // int nxEnd_h = getEndHorizontal();
364 //------------------------------------------------------------------------------------------------------------
365 // Methods for capturing events from the vertical bar
366 //------------------------------------------------------------------------------------------------------------
369 * Handles the event wxEVT_TSBAR from the vertical bar
371 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
376 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
378 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
380 int actual = getActualVertical();
381 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
384 int nxActual_v = getActualVertical();
386 if (_eventHandler!=NULL)
388 //-------------------------------------------------
389 // Sending the event of wxINSTANT_CHANGE
390 //-------------------------------------------------
391 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
393 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
394 cWrap->setActualValue( nxActual_v );
396 newevent.SetClientData( (void *)cWrap );
397 _eventHandler->ProcessEvent(newevent);
402 * Handles the event wxEVT_TSBAR_START from the vertical bar
404 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
406 // int nxStart_v = getStartVertical();
409 * Handles the event wxEVT_TSBAR_END from the vertical bar
411 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
413 // int nxEnd_v = getEndVertical();
416 * Handles the event wxEVT_SELECTION_END from the vertical bar
418 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
423 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
425 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
427 // int nxStart_v = getStartVertical();
428 // int nxEnd_v = getEndVertical();
432 //------------------------------------------------------------------------------------------------------------
433 // Methods for sending events
434 //------------------------------------------------------------------------------------------------------------
436 //------------------------------------------------------------------------------------------------------------
437 // Attributes getters and setters
438 //------------------------------------------------------------------------------------------------------------
441 * Sets the represented values of the vertical bar
442 * @param minRepresented In the minimum represented value of the bar
443 * @param maxRepresented In the maximum represented value of the bar
445 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
447 if( _verticalBar != NULL && _useVerticalBar )
449 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
454 * Sets the represented values of the horizontal bar
455 * @param minRepresented In the minimum represented value of the bar
456 * @param maxRepresented In the maximum represented value of the bar
458 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
460 if( _horizontalBar != NULL && _useHorizontalBar )
462 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
467 * Gets the StartVertical value
468 * @return The StartVertical
470 int wxContourViewPanel :: getStartVertical()
472 return _verticalBar->GetActual();
475 * Gets the EndVertical value
476 * @return The EndVertical
478 int wxContourViewPanel :: getEndVertical()
480 return _verticalBar->GetEnd();
483 * Gets the ActualVertical value
484 * @return The ActualVertical
486 int wxContourViewPanel :: getActualVertical()
488 return _verticalBar->GetActual();//GetEnd();
492 * Sets the StartVertical value
493 * @param nwValue The new value for the StartVertical
495 void wxContourViewPanel :: setStartVertical( int nwValue )
497 _verticalBar->SetEnd( nwValue );
500 * Sets the EndVertical value
501 * @param nwValue The new value for the EndVertical
503 void wxContourViewPanel :: setEndVertical( int nwValue )
505 _verticalBar->SetEnd( nwValue );
508 * Sets the ActualVertical value
509 * @param nwValue The new value for the ActualVertical
511 void wxContourViewPanel :: setActualVertical( int nwValue )
513 _verticalBar->SetActual( nwValue );
517 * Gets the StartHorizontal value
518 * @return The StartHorizontal
520 int wxContourViewPanel :: getStartHorizontal()
522 return _horizontalBar->GetStart();
525 * Gets the EndHorizontal value
526 * @return The EndHorizontal
528 int wxContourViewPanel :: getEndHorizontal()
530 return _horizontalBar->GetEnd();
533 * Gets the ActualHorizontal value
534 * @return The ActualHorizontal
536 int wxContourViewPanel :: getActualHorizontal()
538 return _horizontalBar->GetActual();
542 * Sets the StartHorizontal value
543 * @param nwValue The new value for the StartHorizontal
545 void wxContourViewPanel :: setStartHorizontal( int nwValue )
547 _horizontalBar->SetStart( nwValue );
550 * Sets the EndHorizontal value
551 * @param nwValue The new value for the EndHorizontal
553 void wxContourViewPanel :: setEndHorizontal( int nwValue )
555 _horizontalBar->SetEnd( nwValue );
558 * Sets the ActualHorizontal value
559 * @param nwValue The new value for the ActualHorizontal
561 void wxContourViewPanel :: setActualHorizontal( int nwValue )
563 _horizontalBar->SetActual( nwValue );
567 * Sets the horizontal concept values and name
568 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
569 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
570 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
571 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
572 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
573 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
575 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
577 setHorizontalConceptName( theHorizontalConcept );
578 setHorizontalRepresentedValues( minRepresent, maxRepresent );
579 setActualHorizontal( actualShow );
580 setStartHorizontal( minShowed );
581 setEndHorizontal( maxShowed );
585 * Sets the vertical concept values and name
586 * @param theVerticalConcept The name of the concept for setting at the vertical bar
587 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
588 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
589 * @param minShowed The minShowed value of the concept for setting at the vertical bar
590 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
591 * @param actualShow The actualShow value of the concept for setting at the vertical bar
593 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
595 setVerticalConceptName( theVerticalConcept );
596 setVerticalRepresentedValues( minRepresent, maxRepresent );
597 setActualVertical( actualShow );
598 setStartVertical( minShowed );
599 setEndVertical( maxShowed );
604 * Sets the horizontal concept name
605 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
607 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
609 _horizontalConceptName = theHorizontalConcept;
613 * Gets the horizontal concept name
614 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
616 std::string wxContourViewPanel :: getHorizontalConceptName( )
618 return _horizontalConceptName;
622 * Sets the vertical concept name
623 * @param theVerticalConcept The name of the concept for setting at the vertical bar
625 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
627 _verticalConceptName = theVerticalConcept;
631 * Gets the vertical concept name
632 * @return _verticalConceptName The name of the concept for setting at the vertical bar
634 std::string wxContourViewPanel :: getVerticalConceptName( )
636 return _verticalConceptName;
639 //------------------------------------------------------------------------------------------------------------
640 // Other functional methods
641 //------------------------------------------------------------------------------------------------------------
643 void wxContourViewPanel :: getSpacing( double * spacing )
645 spacing[0] = last_spacing[0];
646 spacing[1] = last_spacing[1];
647 spacing[2] = last_spacing[2];
650 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
652 return theViewPanel->GetwxVtkBaseView(1);
655 double wxContourViewPanel :: getCurrentDeep()
658 // return theViewPanel->GetZ(1);
659 return theViewPanel->GetZ();
664 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
665 return _sceneManager->isEditableCControler(theKeyName);
668 void wxContourViewPanel::removeFromScene(std::string theKeyName){
670 _sceneManager->deleteCViewerCControler(theKeyName);
675 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
676 ConceptDataWrap * dataConcept = NULL;
677 if ( GetId() == event.GetId() )
679 dataConcept = (ConceptDataWrap *)event.GetClientData();
680 int value = dataConcept->getActualValue();
681 //_instantPanel->setConceptValue( dataConcept->getName(), value );
682 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
686 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
687 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
689 setActualVertical( dataConcept->getActualValue());
690 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
692 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
694 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
697 wxContourMainFrame::getInstance()->changeInstant();
700 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
702 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
704 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
706 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
707 double val = getCurrentDeep();
708 //setActualVertical( (int)val );
709 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
710 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
714 void wxContourViewPanel::changeDeep(){
715 double val = getCurrentDeep();
716 setActualVertical( (int)val );
718 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
721 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
722 // int elementsSelected = currentSelection.size();
723 bool ctrlKey = _sceneManager->isCtrlPressed();
724 char toolCommand = _sceneManager->getLastKeyCode();
727 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
729 wxContourMainFrame::getInstance()->onCopy();
731 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
733 wxContourMainFrame::getInstance()->onPaste();
735 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
737 wxContourMainFrame::getInstance()->onDeleteContour();
739 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
741 //toolCommand = &(CREATE_CONTOUR_KEY);
743 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
745 wxContourMainFrame::getInstance()->onLoad();
747 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
749 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
750 }else if( toolCommand == 26 ){
751 wxContourMainFrame::getInstance()->onUndo();
752 }else if( toolCommand == 25 ){
753 wxContourMainFrame::getInstance()->onRedo();
757 void wxContourViewPanel::removeSceneContours(){
758 _sceneManager->removeSceneContours();
761 void wxContourViewPanel::addNameWrapperToScene(){
762 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
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 );
769 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
770 return _sceneManager->getSelectedObjects();
773 void wxContourViewPanel::RefreshInterface(){
774 getWxVtkBaseView()->Refresh();
777 vtkImageData* wxContourViewPanel::getImageData(){
778 return _sceneManager->GetImageData();
781 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
783 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
786 int wxContourViewPanel::GetImageDataSizeZ()
788 return _sceneManager->GetImageDataSizeZ();
791 void wxContourViewPanel::GetImageDataRange(double *range)
793 _sceneManager->GetImageDataRange(range);
796 void wxContourViewPanel::SetWidthContour(double width )
798 _sceneManager->SetWidthContour( width );
801 int wxContourViewPanel::getColorWindow()
803 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
804 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
805 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
809 int wxContourViewPanel::getWindowLevel()
811 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
812 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
813 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
817 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
819 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
820 wxvtk2dbaseview->SetColorWindow( colorwindow );
821 wxvtk2dbaseview->SetColorLevel( windowlevel );
824 void wxContourViewPanel::onInterpolation(bool interpolate)
826 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
827 wxvtk2dbaseview->SetInterpolate( interpolate );
830 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
832 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
835 void wxContourViewPanel::setImageSlice(int z){
836 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
837 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
838 baseview->SetActualSlice(z);