2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "wxContourViewPanel.h"
7 #include "wxContourMainFrame.h"
8 //----------------------------------------------------------------------------------------------------------------
10 //----------------------------------------------------------------------------------------------------------------
11 //#include "ConceptDataWrap.h"
13 //this should be eliminated at some point
14 //#include "wxContourEventHandler.h"
15 //----------------------------------------------------------------------------------------------------------------
16 // Class implementation
17 //----------------------------------------------------------------------------------------------------------------
18 /** @file wxContourViewPanel.cxx */
20 //----------------------------------------------------------------------------------------------------------------
21 // Throwed Events definition
22 //----------------------------------------------------------------------------------------------------------------
24 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
27 //------------------------------------------------------------------------------------------------------------
28 // Constructors & Destructors
29 //------------------------------------------------------------------------------------------------------------
32 showingVID = theShowingImage;
35 createHorizontalBar(1,80);
36 createVerticalBar(1,200);
39 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(3,1,0,0);
40 panelSizer->AddSpacer(gapV);
41 panelSizer -> AddGrowableCol(1);
42 panelSizer->Add(theViewPanel, 1, wxEXPAND);
43 panelSizer->AddSpacer(gapV);
45 wxFlexGridSizer * downSizer = new wxFlexGridSizer(1,3,gapV,gapH);
46 downSizer->Add(_verticalBar, 1, wxEXPAND);
47 //downSizer->AddSpacer(gapH);
48 downSizer -> AddGrowableCol(1);
49 downSizer->Add(panelSizer, 1, wxEXPAND|wxALL|wxCENTER);
50 //downSizer->AddSpacer(gapH);
51 outSizer = new wxFlexGridSizer(3,1,1,1);
52 outSizer->Add(_horizontalBar, 1, wxEXPAND);
53 outSizer -> AddGrowableRow(1);
54 outSizer -> AddGrowableCol(1);
55 outSizer->Add(downSizer, 1, wxEXPAND);
57 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV);
58 _horizontalBar->setDeviceEndMargin( gapH+10 );
60 //Connecting the events to the horizontal bar
61 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
62 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
63 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
64 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
65 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
66 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
68 //Connecting the events to the vertical bar
69 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
70 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
71 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
72 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
73 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
74 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
77 this->SetAutoLayout( true );
82 theViewPanel->SetSize(800,600);
83 theViewPanel->GetWindow(1)->SetSize(800,600);
85 outSizer->Fit( this );
86 SetBackgroundColour(wxColour(255,0,0));
89 //:wxScrolledWindow(parent, -1, pos, size, style)
90 wxContourViewPanel :: wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
91 :wxPanel(parent, -1, pos, size, style)
93 theShowingImage->GetSpacing(last_spacing);
95 showingVID = theShowingImage;
98 _verticalConceptName = "";
99 _horizontalConceptName = "";
100 createHorizontalBar(1,80);
101 createVerticalBar(1,200);
103 _eventHandler = NULL;
105 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1, 4, gapV, gapH);
106 panelSizer -> AddGrowableCol(2);
107 panelSizer -> AddGrowableRow(2);
108 panelSizer->Add(_verticalBar, 1, wxGROW);
109 panelSizer->AddSpacer(gapV);
110 panelSizer->Add(theViewPanel, 1, wxGROW);
111 panelSizer->AddSpacer(gapV);
113 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
114 outSizer -> AddGrowableCol(1);
115 outSizer -> AddGrowableRow(1);
116 outSizer->Add( _horizontalBar, 1, wxGROW);
117 outSizer->Add( panelSizer, 1, wxGROW);
118 outSizer->AddSpacer(gapH);
120 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
121 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
123 //Connecting the events to the horizontal bar
124 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
125 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
126 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
127 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
128 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
129 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
131 //Connecting the events to the vertical bar
132 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
133 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
134 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
135 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
136 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
137 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
140 SetSizer( outSizer );
141 this->SetAutoLayout( true );
144 //SetSize(1900,1900);
145 //theViewPanel->SetSize(800,600);
146 //theViewPanel->GetWindow(1)->SetSize(800,600);
148 //outSizer->Fit( this );
150 initializeScenceManager();
155 wxContourViewPanel :: ~wxContourViewPanel()
160 void wxContourViewPanel::initializeScenceManager(){
162 //_theViewPanel = theViewPanel;
163 //_theViewPanel->setWxEventHandler( this );
166 this->getSpacing(spc);
167 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
169 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
170 Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
171 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
172 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
173 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
174 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
178 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
179 return _sceneManager;
182 //------------------------------------------------------------------------------------------------------------
183 // Creational and initialization methods
184 //------------------------------------------------------------------------------------------------------------
186 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
188 _eventHandler = theEventHandler;
191 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
193 _horizontalBar = new mBarRange(this, 1500,80);
194 _horizontalBar -> setVisibleLabels (true);
195 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
196 _horizontalBar -> setActiveStateTo(true);
197 _horizontalBar -> SetActual( horzStart );
198 _horizontalBar -> setDeviceBlitStart (10,10);
199 _horizontalBar -> setDeviceEndMargin (10);
202 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
204 _verticalBar = new mBarRange(this, 1500,40);
205 _verticalBar -> SetOrientation(false);
206 _verticalBar -> setVisibleLabels (false);
207 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
208 _verticalBar -> setActiveStateTo(true);
209 _verticalBar -> SetActual( vertStart );
210 _verticalBar -> setDeviceBlitStart (10,10);
211 _verticalBar -> setDeviceEndMargin (10);
213 //------------------------------------------------------------------------------------------------------------
215 void wxContourViewPanel :: createViewPanel()
217 std::vector<int> * numViews = new std::vector<int> ();
218 numViews->push_back(2);
219 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
220 SetVisibleAxis(false);
222 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
224 theViewPanel->SetSize(800,600);
225 theViewPanel->GetWindow(1)->SetSize(800,600);
227 //------------------------------------------------------------------------------------------------------------
229 void wxContourViewPanel::changeImage(vtkImageData* img){
231 theViewPanel->SetImage(img);
234 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
236 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
239 //------------------------------------------------------------------------------------------------------------
240 void wxContourViewPanel::SetVisibleAxis(bool ok)
242 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
245 //------------------------------------------------------------------------------------------------------------
246 int wxContourViewPanel::GetX()
248 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
250 //------------------------------------------------------------------------------------------------------------
251 int wxContourViewPanel::GetY()
253 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
255 //------------------------------------------------------------------------------------------------------------
256 int wxContourViewPanel::GetZ()
258 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
261 //------------------------------------------------------------------------------------------------------------
262 void wxContourViewPanel::Refresh()
264 GetwxVtkMPR2DView()->GetRenWin()->Render();
268 //------------------------------------------------------------------------------------------------------------
269 // Methods for capturing events from the horizontal bar
270 //------------------------------------------------------------------------------------------------------------
273 * Handles the event wxEVT_TSBAR from the horizontal bar
275 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
280 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
282 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
285 int actual = getActualHorizontal();
287 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
290 //int nxActual_h = getActualHorizontal();
293 //if (_eventHandler!=NULL)
295 //-------------------------------------------------
296 // Sending the event of wxINSTANT_CHANGE
297 //-------------------------------------------------
298 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
300 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
301 // cWrap->setActualValue( nxActual_h );
303 // newevent.SetClientData( (void *)cWrap );
304 // _eventHandler->ProcessEvent(newevent);
310 * Handles the event wxEVT_TSBAR_START from the horizontal bar
312 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
314 int nxStart_h = getStartHorizontal();
317 * Handles the event wxEVT_TSBAR_END from the horizontal bar
319 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
321 int nxEnd_h = getEndHorizontal();
324 * Handles the event wxEVT_SELECTION_END from the horizontal bar
326 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
331 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
333 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
335 int nxStart_h = getStartHorizontal();
336 int nxEnd_h = getEndHorizontal();
340 //------------------------------------------------------------------------------------------------------------
341 // Methods for capturing events from the vertical bar
342 //------------------------------------------------------------------------------------------------------------
345 * Handles the event wxEVT_TSBAR from the vertical bar
347 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
352 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
354 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
356 int actual = getActualVertical();
357 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
360 int nxActual_v = getActualVertical();
362 if (_eventHandler!=NULL)
364 //-------------------------------------------------
365 // Sending the event of wxINSTANT_CHANGE
366 //-------------------------------------------------
367 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
369 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
370 cWrap->setActualValue( nxActual_v );
372 newevent.SetClientData( (void *)cWrap );
373 _eventHandler->ProcessEvent(newevent);
378 * Handles the event wxEVT_TSBAR_START from the vertical bar
380 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
382 int nxStart_v = getStartVertical();
385 * Handles the event wxEVT_TSBAR_END from the vertical bar
387 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
389 int nxEnd_v = getEndVertical();
392 * Handles the event wxEVT_SELECTION_END from the vertical bar
394 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
399 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
401 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
403 int nxStart_v = getStartVertical();
404 int nxEnd_v = getEndVertical();
408 //------------------------------------------------------------------------------------------------------------
409 // Methods for sending events
410 //------------------------------------------------------------------------------------------------------------
412 //------------------------------------------------------------------------------------------------------------
413 // Attributes getters and setters
414 //------------------------------------------------------------------------------------------------------------
417 * Sets the represented values of the vertical bar
418 * @param minRepresented In the minimum represented value of the bar
419 * @param maxRepresented In the maximum represented value of the bar
421 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
423 if( _verticalBar != NULL && _useVerticalBar )
425 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
430 * Sets the represented values of the horizontal bar
431 * @param minRepresented In the minimum represented value of the bar
432 * @param maxRepresented In the maximum represented value of the bar
434 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
436 if( _horizontalBar != NULL && _useHorizontalBar )
438 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
443 * Gets the StartVertical value
444 * @return The StartVertical
446 int wxContourViewPanel :: getStartVertical()
448 return _verticalBar->GetActual();
451 * Gets the EndVertical value
452 * @return The EndVertical
454 int wxContourViewPanel :: getEndVertical()
456 return _verticalBar->GetEnd();
459 * Gets the ActualVertical value
460 * @return The ActualVertical
462 int wxContourViewPanel :: getActualVertical()
464 return _verticalBar->GetActual();//GetEnd();
468 * Sets the StartVertical value
469 * @param nwValue The new value for the StartVertical
471 void wxContourViewPanel :: setStartVertical( int nwValue )
473 _verticalBar->SetEnd( nwValue );
476 * Sets the EndVertical value
477 * @param nwValue The new value for the EndVertical
479 void wxContourViewPanel :: setEndVertical( int nwValue )
481 _verticalBar->SetEnd( nwValue );
484 * Sets the ActualVertical value
485 * @param nwValue The new value for the ActualVertical
487 void wxContourViewPanel :: setActualVertical( int nwValue )
489 _verticalBar->SetActual( nwValue );
493 * Gets the StartHorizontal value
494 * @return The StartHorizontal
496 int wxContourViewPanel :: getStartHorizontal()
498 return _horizontalBar->GetStart();
501 * Gets the EndHorizontal value
502 * @return The EndHorizontal
504 int wxContourViewPanel :: getEndHorizontal()
506 return _horizontalBar->GetEnd();
509 * Gets the ActualHorizontal value
510 * @return The ActualHorizontal
512 int wxContourViewPanel :: getActualHorizontal()
514 return _horizontalBar->GetActual();
518 * Sets the StartHorizontal value
519 * @param nwValue The new value for the StartHorizontal
521 void wxContourViewPanel :: setStartHorizontal( int nwValue )
523 _horizontalBar->SetStart( nwValue );
526 * Sets the EndHorizontal value
527 * @param nwValue The new value for the EndHorizontal
529 void wxContourViewPanel :: setEndHorizontal( int nwValue )
531 _horizontalBar->SetEnd( nwValue );
534 * Sets the ActualHorizontal value
535 * @param nwValue The new value for the ActualHorizontal
537 void wxContourViewPanel :: setActualHorizontal( int nwValue )
539 _horizontalBar->SetActual( nwValue );
543 * Sets the horizontal concept values and name
544 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
545 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
546 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
547 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
548 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
549 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
551 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
553 setHorizontalConceptName( theHorizontalConcept );
554 setHorizontalRepresentedValues( minRepresent, maxRepresent );
555 setActualHorizontal( actualShow );
556 setStartHorizontal( minShowed );
557 setEndHorizontal( maxShowed );
561 * Sets the vertical concept values and name
562 * @param theVerticalConcept The name of the concept for setting at the vertical bar
563 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
564 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
565 * @param minShowed The minShowed value of the concept for setting at the vertical bar
566 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
567 * @param actualShow The actualShow value of the concept for setting at the vertical bar
569 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
571 setVerticalConceptName( theVerticalConcept );
572 setVerticalRepresentedValues( minRepresent, maxRepresent );
573 setActualVertical( actualShow );
574 setStartVertical( minShowed );
575 setEndVertical( maxShowed );
580 * Sets the horizontal concept name
581 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
583 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
585 _horizontalConceptName = theHorizontalConcept;
589 * Gets the horizontal concept name
590 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
592 std::string wxContourViewPanel :: getHorizontalConceptName( )
594 return _horizontalConceptName;
598 * Sets the vertical concept name
599 * @param theVerticalConcept The name of the concept for setting at the vertical bar
601 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
603 _verticalConceptName = theVerticalConcept;
607 * Gets the vertical concept name
608 * @return _verticalConceptName The name of the concept for setting at the vertical bar
610 std::string wxContourViewPanel :: getVerticalConceptName( )
612 return _verticalConceptName;
615 //------------------------------------------------------------------------------------------------------------
616 // Other functional methods
617 //------------------------------------------------------------------------------------------------------------
619 void wxContourViewPanel :: getSpacing( double * spacing )
621 spacing[0] = last_spacing[0];
622 spacing[1] = last_spacing[1];
623 spacing[2] = last_spacing[2];
626 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
628 return theViewPanel->GetwxVtkBaseView(1);
631 double wxContourViewPanel :: getCurrentDeep()
634 // return theViewPanel->GetZ(1);
635 return theViewPanel->GetZ();
640 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
641 return _sceneManager->isEditableCControler(theKeyName);
644 void wxContourViewPanel::removeFromScene(std::string theKeyName){
646 _sceneManager->deleteCViewerCControler(theKeyName);
651 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
652 ConceptDataWrap * dataConcept = NULL;
653 if ( GetId() == event.GetId() )
655 dataConcept = (ConceptDataWrap *)event.GetClientData();
656 int value = dataConcept->getActualValue();
657 //_instantPanel->setConceptValue( dataConcept->getName(), value );
658 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
662 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
663 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
665 setActualVertical( dataConcept->getActualValue());
666 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
668 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
670 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
673 wxContourMainFrame::getInstance()->changeInstant();
675 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
677 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
679 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
681 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
682 double val = getCurrentDeep();
683 //setActualVertical( (int)val );
684 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
685 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
689 void wxContourViewPanel::changeDeep(){
690 double val = getCurrentDeep();
691 setActualVertical( (int)val );
693 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
696 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
697 int elementsSelected = currentSelection.size();
698 bool ctrlKey = _sceneManager->isCtrlPressed();
699 char toolCommand = _sceneManager->getLastKeyCode();
702 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
704 wxContourMainFrame::getInstance()->onCopy();
706 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
708 wxContourMainFrame::getInstance()->onPaste();
710 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
712 wxContourMainFrame::getInstance()->onDeleteContour();
714 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
716 //toolCommand = &(CREATE_CONTOUR_KEY);
718 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
720 wxContourMainFrame::getInstance()->onLoad();
722 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
724 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
725 }else if( toolCommand == 26 ){
726 wxContourMainFrame::getInstance()->onUndo();
727 }else if( toolCommand == 25 ){
728 wxContourMainFrame::getInstance()->onRedo();
732 void wxContourViewPanel::removeSceneContours(){
733 _sceneManager->removeSceneContours();
736 void wxContourViewPanel::addNameWrapperToScene(){
737 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
738 for(int i = 0; i < size;i++){
739 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
740 _sceneManager->addToScene(name, true, true, true, false, false );
744 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
745 return _sceneManager->getSelectedObjects();
748 void wxContourViewPanel::RefreshInterface(){
749 getWxVtkBaseView()->Refresh();
752 vtkImageData* wxContourViewPanel::getImageData(){
753 return _sceneManager->GetImageData();
756 void wxContourViewPanel::configureViewControlTo(std::string theName,manualContourModel* manModelContour,double* spc,int typeofcontour){
757 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
760 int wxContourViewPanel::GetImageDataSizeZ(){
761 return _sceneManager->GetImageDataSizeZ();
764 void wxContourViewPanel::GetImageDataRange(double *range){
765 _sceneManager->GetImageDataRange(range);
768 void wxContourViewPanel::SetWidthContour(double width ){
769 _sceneManager->SetWidthContour( width );
772 int wxContourViewPanel::getColorWindow(){
773 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
774 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
775 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
779 int wxContourViewPanel::getWindowLevel(){
780 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
781 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
782 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
786 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel){
787 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
788 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
789 imageviewer->SetColorWindow(colorwindow);
790 imageviewer->SetColorLevel(windowlevel);
793 void wxContourViewPanel::onInterpolation(bool interpolate){
794 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
795 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
798 imageviewer->GetImageActor()->InterpolateOn();
800 imageviewer->GetImageActor()->InterpolateOff();
804 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ ){
805 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
808 void wxContourViewPanel::setImageSlice(int z){
809 _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView()->GetWxVtk2DBaseView()->SetActualSlice(z);