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);
94 showingVID = theShowingImage;
97 _verticalConceptName = "";
98 _horizontalConceptName = "";
99 createHorizontalBar(1,80);
100 createVerticalBar(1,200);
102 _eventHandler = NULL;
104 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1, 4, gapV, gapH);
105 panelSizer -> AddGrowableCol(2);
106 panelSizer -> AddGrowableRow(2);
107 panelSizer->Add(_verticalBar, 1, wxGROW);
108 panelSizer->AddSpacer(gapV);
109 panelSizer->Add(theViewPanel, 1, wxGROW);
110 panelSizer->AddSpacer(gapV);
112 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
113 outSizer -> AddGrowableCol(1);
114 outSizer -> AddGrowableRow(1);
115 outSizer->Add( _horizontalBar, 1, wxGROW);
116 outSizer->Add( panelSizer, 1, wxGROW);
117 outSizer->AddSpacer(gapH);
119 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
120 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
122 //Connecting the events to the horizontal bar
123 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
124 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
125 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
126 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
127 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
128 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
130 //Connecting the events to the vertical bar
131 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
132 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
133 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
134 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
135 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
136 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
139 this->SetSizer( outSizer );
140 this->SetAutoLayout( true );
143 //SetSize(1900,1900);
144 //theViewPanel->SetSize(800,600);
145 //theViewPanel->GetWindow(1)->SetSize(800,600);
147 //outSizer->Fit( this );
149 initializeScenceManager();
153 wxContourViewPanel :: ~wxContourViewPanel()
155 delete _sceneManager;
158 void wxContourViewPanel::initializeScenceManager(){
160 //_theViewPanel = theViewPanel;
161 //_theViewPanel->setWxEventHandler( this );
164 this->getSpacing(spc);
165 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
167 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
168 Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
169 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
170 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
171 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
172 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
176 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
177 return _sceneManager;
180 //------------------------------------------------------------------------------------------------------------
181 // Creational and initialization methods
182 //------------------------------------------------------------------------------------------------------------
184 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
186 _eventHandler = theEventHandler;
189 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
191 _horizontalBar = new mBarRange(this, 1500,80);
192 _horizontalBar -> setVisibleLabels (true);
193 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
194 _horizontalBar -> setActiveStateTo(true);
195 _horizontalBar -> SetActual( horzStart );
196 _horizontalBar -> setDeviceBlitStart (10,10);
197 _horizontalBar -> setDeviceEndMargin (10);
200 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
202 _verticalBar = new mBarRange(this, 1500,40);
203 _verticalBar -> SetOrientation(false);
204 _verticalBar -> setVisibleLabels (false);
205 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
206 _verticalBar -> setActiveStateTo(true);
207 _verticalBar -> SetActual( vertStart );
208 _verticalBar -> setDeviceBlitStart (10,10);
209 _verticalBar -> setDeviceEndMargin (10);
211 //------------------------------------------------------------------------------------------------------------
213 void wxContourViewPanel::createViewPanel()
215 std::vector<int> * numViews = new std::vector<int> ();
216 numViews->push_back(0);
217 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
218 SetVisibleAxis(false);
220 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
222 theViewPanel->SetSize(800,600);
223 theViewPanel->GetWindow(1)->SetSize(800,600);
226 //------------------------------------------------------------------------------------------------------------
228 void wxContourViewPanel::changeImage(vtkImageData* img){
230 theViewPanel->SetImage(img);
233 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
235 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
238 //------------------------------------------------------------------------------------------------------------
239 void wxContourViewPanel::SetVisibleAxis(bool ok)
241 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
244 //------------------------------------------------------------------------------------------------------------
245 int wxContourViewPanel::GetX()
247 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
249 //------------------------------------------------------------------------------------------------------------
250 int wxContourViewPanel::GetY()
252 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
254 //------------------------------------------------------------------------------------------------------------
255 int wxContourViewPanel::GetZ()
257 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
260 //------------------------------------------------------------------------------------------------------------
261 void wxContourViewPanel::Refresh()
263 GetwxVtkMPR2DView()->GetRenWin()->Render();
267 //------------------------------------------------------------------------------------------------------------
268 // Methods for capturing events from the horizontal bar
269 //------------------------------------------------------------------------------------------------------------
272 * Handles the event wxEVT_TSBAR from the horizontal bar
274 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
279 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
281 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
284 int actual = getActualHorizontal();
286 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
289 //int nxActual_h = getActualHorizontal();
292 //if (_eventHandler!=NULL)
294 //-------------------------------------------------
295 // Sending the event of wxINSTANT_CHANGE
296 //-------------------------------------------------
297 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
299 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
300 // cWrap->setActualValue( nxActual_h );
302 // newevent.SetClientData( (void *)cWrap );
303 // _eventHandler->ProcessEvent(newevent);
309 * Handles the event wxEVT_TSBAR_START from the horizontal bar
311 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
313 // int nxStart_h = getStartHorizontal();
316 * Handles the event wxEVT_TSBAR_END from the horizontal bar
318 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
320 // int nxEnd_h = getEndHorizontal();
323 * Handles the event wxEVT_SELECTION_END from the horizontal bar
325 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
330 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
332 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
334 // int nxStart_h = getStartHorizontal();
335 // int nxEnd_h = getEndHorizontal();
339 //------------------------------------------------------------------------------------------------------------
340 // Methods for capturing events from the vertical bar
341 //------------------------------------------------------------------------------------------------------------
344 * Handles the event wxEVT_TSBAR from the vertical bar
346 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
351 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
353 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
355 int actual = getActualVertical();
356 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
359 int nxActual_v = getActualVertical();
361 if (_eventHandler!=NULL)
363 //-------------------------------------------------
364 // Sending the event of wxINSTANT_CHANGE
365 //-------------------------------------------------
366 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
368 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
369 cWrap->setActualValue( nxActual_v );
371 newevent.SetClientData( (void *)cWrap );
372 _eventHandler->ProcessEvent(newevent);
377 * Handles the event wxEVT_TSBAR_START from the vertical bar
379 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
381 // int nxStart_v = getStartVertical();
384 * Handles the event wxEVT_TSBAR_END from the vertical bar
386 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
388 // int nxEnd_v = getEndVertical();
391 * Handles the event wxEVT_SELECTION_END from the vertical bar
393 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
398 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
400 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
402 // int nxStart_v = getStartVertical();
403 // int nxEnd_v = getEndVertical();
407 //------------------------------------------------------------------------------------------------------------
408 // Methods for sending events
409 //------------------------------------------------------------------------------------------------------------
411 //------------------------------------------------------------------------------------------------------------
412 // Attributes getters and setters
413 //------------------------------------------------------------------------------------------------------------
416 * Sets the represented values of the vertical bar
417 * @param minRepresented In the minimum represented value of the bar
418 * @param maxRepresented In the maximum represented value of the bar
420 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
422 if( _verticalBar != NULL && _useVerticalBar )
424 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
429 * Sets the represented values of the horizontal bar
430 * @param minRepresented In the minimum represented value of the bar
431 * @param maxRepresented In the maximum represented value of the bar
433 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
435 if( _horizontalBar != NULL && _useHorizontalBar )
437 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
442 * Gets the StartVertical value
443 * @return The StartVertical
445 int wxContourViewPanel :: getStartVertical()
447 return _verticalBar->GetActual();
450 * Gets the EndVertical value
451 * @return The EndVertical
453 int wxContourViewPanel :: getEndVertical()
455 return _verticalBar->GetEnd();
458 * Gets the ActualVertical value
459 * @return The ActualVertical
461 int wxContourViewPanel :: getActualVertical()
463 return _verticalBar->GetActual();//GetEnd();
467 * Sets the StartVertical value
468 * @param nwValue The new value for the StartVertical
470 void wxContourViewPanel :: setStartVertical( int nwValue )
472 _verticalBar->SetEnd( nwValue );
475 * Sets the EndVertical value
476 * @param nwValue The new value for the EndVertical
478 void wxContourViewPanel :: setEndVertical( int nwValue )
480 _verticalBar->SetEnd( nwValue );
483 * Sets the ActualVertical value
484 * @param nwValue The new value for the ActualVertical
486 void wxContourViewPanel :: setActualVertical( int nwValue )
488 _verticalBar->SetActual( nwValue );
492 * Gets the StartHorizontal value
493 * @return The StartHorizontal
495 int wxContourViewPanel :: getStartHorizontal()
497 return _horizontalBar->GetStart();
500 * Gets the EndHorizontal value
501 * @return The EndHorizontal
503 int wxContourViewPanel :: getEndHorizontal()
505 return _horizontalBar->GetEnd();
508 * Gets the ActualHorizontal value
509 * @return The ActualHorizontal
511 int wxContourViewPanel :: getActualHorizontal()
513 return _horizontalBar->GetActual();
517 * Sets the StartHorizontal value
518 * @param nwValue The new value for the StartHorizontal
520 void wxContourViewPanel :: setStartHorizontal( int nwValue )
522 _horizontalBar->SetStart( nwValue );
525 * Sets the EndHorizontal value
526 * @param nwValue The new value for the EndHorizontal
528 void wxContourViewPanel :: setEndHorizontal( int nwValue )
530 _horizontalBar->SetEnd( nwValue );
533 * Sets the ActualHorizontal value
534 * @param nwValue The new value for the ActualHorizontal
536 void wxContourViewPanel :: setActualHorizontal( int nwValue )
538 _horizontalBar->SetActual( nwValue );
542 * Sets the horizontal concept values and name
543 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
544 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
545 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
546 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
547 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
548 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
550 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
552 setHorizontalConceptName( theHorizontalConcept );
553 setHorizontalRepresentedValues( minRepresent, maxRepresent );
554 setActualHorizontal( actualShow );
555 setStartHorizontal( minShowed );
556 setEndHorizontal( maxShowed );
560 * Sets the vertical concept values and name
561 * @param theVerticalConcept The name of the concept for setting at the vertical bar
562 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
563 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
564 * @param minShowed The minShowed value of the concept for setting at the vertical bar
565 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
566 * @param actualShow The actualShow value of the concept for setting at the vertical bar
568 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
570 setVerticalConceptName( theVerticalConcept );
571 setVerticalRepresentedValues( minRepresent, maxRepresent );
572 setActualVertical( actualShow );
573 setStartVertical( minShowed );
574 setEndVertical( maxShowed );
579 * Sets the horizontal concept name
580 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
582 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
584 _horizontalConceptName = theHorizontalConcept;
588 * Gets the horizontal concept name
589 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
591 std::string wxContourViewPanel :: getHorizontalConceptName( )
593 return _horizontalConceptName;
597 * Sets the vertical concept name
598 * @param theVerticalConcept The name of the concept for setting at the vertical bar
600 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
602 _verticalConceptName = theVerticalConcept;
606 * Gets the vertical concept name
607 * @return _verticalConceptName The name of the concept for setting at the vertical bar
609 std::string wxContourViewPanel :: getVerticalConceptName( )
611 return _verticalConceptName;
614 //------------------------------------------------------------------------------------------------------------
615 // Other functional methods
616 //------------------------------------------------------------------------------------------------------------
618 void wxContourViewPanel :: getSpacing( double * spacing )
620 spacing[0] = last_spacing[0];
621 spacing[1] = last_spacing[1];
622 spacing[2] = last_spacing[2];
625 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
627 return theViewPanel->GetwxVtkBaseView(1);
630 double wxContourViewPanel :: getCurrentDeep()
633 // return theViewPanel->GetZ(1);
634 return theViewPanel->GetZ();
639 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
640 return _sceneManager->isEditableCControler(theKeyName);
643 void wxContourViewPanel::removeFromScene(std::string theKeyName){
645 _sceneManager->deleteCViewerCControler(theKeyName);
650 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
651 ConceptDataWrap * dataConcept = NULL;
652 if ( GetId() == event.GetId() )
654 dataConcept = (ConceptDataWrap *)event.GetClientData();
655 int value = dataConcept->getActualValue();
656 //_instantPanel->setConceptValue( dataConcept->getName(), value );
657 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
661 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
662 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
664 setActualVertical( dataConcept->getActualValue());
665 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
667 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
669 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
672 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,manualBaseModel* manModelContour,double* spc,int typeofcontour)
758 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
761 int wxContourViewPanel::GetImageDataSizeZ()
763 return _sceneManager->GetImageDataSizeZ();
766 void wxContourViewPanel::GetImageDataRange(double *range)
768 _sceneManager->GetImageDataRange(range);
771 void wxContourViewPanel::SetWidthContour(double width )
773 _sceneManager->SetWidthContour( width );
776 int wxContourViewPanel::getColorWindow()
778 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
779 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
780 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
784 int wxContourViewPanel::getWindowLevel()
786 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
787 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
788 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
792 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
794 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
795 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
796 imageviewer->SetColorWindow(colorwindow);
797 imageviewer->SetColorLevel(windowlevel);
800 void wxContourViewPanel::onInterpolation(bool interpolate)
802 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
803 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
806 imageviewer->GetImageActor()->InterpolateOn();
808 imageviewer->GetImageActor()->InterpolateOff();
812 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
814 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
817 void wxContourViewPanel::setImageSlice(int z){
818 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
819 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
820 baseview->SetActualSlice(z);