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 printf("EED wxContourViewPanel::wxContourViewPanel Start\n");
119 theShowingImage->GetSpacing(last_spacing);
120 showingVID = theShowingImage;
123 _verticalConceptName = "";
124 _horizontalConceptName = "";
125 createHorizontalBar(1,80);
126 createVerticalBar(1,200);
128 _eventHandler = NULL;
130 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
131 #if wxMAJOR_VERSION <= 2
132 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH);
133 panelSizer -> AddGrowableCol(2);
134 panelSizer -> AddGrowableRow(2);
136 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(4);
137 panelSizer -> AddGrowableCol(2);
139 printf("EED wxContourViewPanel::wxContourViewPanel 01\n");
140 printf("EED wxContourViewPanel::wxContourViewPanel 1\n");
141 panelSizer->Add(_verticalBar, 1, wxGROW);
142 printf("EED wxContourViewPanel::wxContourViewPanel 2\n");
143 panelSizer->AddSpacer(gapV);
144 printf("EED wxContourViewPanel::wxContourViewPanel 3\n");
145 panelSizer->Add(theViewPanel, 1, wxGROW);
146 printf("EED wxContourViewPanel::wxContourViewPanel 4\n");
147 panelSizer->AddSpacer(gapV);
149 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
150 #if wxMAJOR_VERSION <= 2
151 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
152 outSizer -> AddGrowableCol(1);
153 outSizer -> AddGrowableRow(1);
155 outSizer = new wxFlexGridSizer(3);
156 outSizer -> AddGrowableCol(1);
158 printf("EED wxContourViewPanel::wxContourViewPanel 5\n");
159 printf("EED wxContourViewPanel::wxContourViewPanel 7\n");
160 outSizer->Add( _horizontalBar, 1, wxGROW);
161 outSizer->Add( panelSizer, 1, wxGROW);
162 outSizer->AddSpacer(gapH);
164 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
165 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
167 printf("EED wxContourViewPanel::wxContourViewPanel 8\n");
168 //Connecting the events to the horizontal bar
169 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
170 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
171 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
172 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
173 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
174 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
175 printf("EED wxContourViewPanel::wxContourViewPanel 9\n");
177 //Connecting the events to the vertical bar
178 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
179 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
180 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
181 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
182 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
183 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
184 printf("EED wxContourViewPanel::wxContourViewPanel 9.1\n");
185 this->SetSizer( outSizer );
186 printf("EED wxContourViewPanel::wxContourViewPanel 9.2\n");
187 this->SetAutoLayout( true );
188 printf("EED wxContourViewPanel::wxContourViewPanel 9.3\n");
190 //SetSize(1900,1900);
191 //theViewPanel->SetSize(800,600);
192 //theViewPanel->GetWindow(1)->SetSize(800,600);
193 //outSizer->Fit( this );
194 printf("EED wxContourViewPanel::wxContourViewPanel 10\n");
195 initializeScenceManager();
196 printf("EED wxContourViewPanel::wxContourViewPanel End\n");
200 wxContourViewPanel :: ~wxContourViewPanel()
202 delete _sceneManager;
205 void wxContourViewPanel::initializeScenceManager()
207 //_theViewPanel = theViewPanel;
208 //_theViewPanel->setWxEventHandler( this );
210 this->getSpacing(spc);
211 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
212 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
213 Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
214 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
215 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
216 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
217 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
220 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
221 return _sceneManager;
224 //------------------------------------------------------------------------------------------------------------
225 // Creational and initialization methods
226 //------------------------------------------------------------------------------------------------------------
228 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
230 _eventHandler = theEventHandler;
233 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
235 _horizontalBar = new mBarRange(this, 1500,80);
236 _horizontalBar -> setVisibleLabels (true);
237 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
238 _horizontalBar -> setActiveStateTo(true);
239 _horizontalBar -> SetActual( horzStart );
240 _horizontalBar -> setDeviceBlitStart (10,10);
241 _horizontalBar -> setDeviceEndMargin (10);
244 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
246 _verticalBar = new mBarRange(this, 1500,40);
247 _verticalBar -> SetOrientation(false);
248 _verticalBar -> setVisibleLabels (false);
249 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
250 _verticalBar -> setActiveStateTo(true);
251 _verticalBar -> SetActual( vertStart );
252 _verticalBar -> setDeviceBlitStart (10,10);
253 _verticalBar -> setDeviceEndMargin (10);
255 //------------------------------------------------------------------------------------------------------------
257 void wxContourViewPanel::createViewPanel()
259 std::vector<int> * numViews = new std::vector<int> ();
260 numViews->push_back(0);
261 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
262 SetVisibleAxis(false);
264 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
266 theViewPanel->SetSize(800,600);
267 theViewPanel->GetWindow(1)->SetSize(800,600);
270 //------------------------------------------------------------------------------------------------------------
272 void wxContourViewPanel::changeImage(vtkImageData* img){
274 theViewPanel->SetImage(img);
277 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
279 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
282 //------------------------------------------------------------------------------------------------------------
283 void wxContourViewPanel::SetVisibleAxis(bool ok)
285 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
288 //------------------------------------------------------------------------------------------------------------
289 int wxContourViewPanel::GetX()
291 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
293 //------------------------------------------------------------------------------------------------------------
294 int wxContourViewPanel::GetY()
296 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
298 //------------------------------------------------------------------------------------------------------------
299 int wxContourViewPanel::GetZ()
301 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
304 //------------------------------------------------------------------------------------------------------------
305 void wxContourViewPanel::Refresh()
307 GetwxVtkMPR2DView()->GetRenWin()->Render();
311 //------------------------------------------------------------------------------------------------------------
312 // Methods for capturing events from the horizontal bar
313 //------------------------------------------------------------------------------------------------------------
316 * Handles the event wxEVT_TSBAR from the horizontal bar
318 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
323 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
325 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
328 int actual = getActualHorizontal();
330 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
333 //int nxActual_h = getActualHorizontal();
336 //if (_eventHandler!=NULL)
338 //-------------------------------------------------
339 // Sending the event of wxINSTANT_CHANGE
340 //-------------------------------------------------
341 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
343 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
344 // cWrap->setActualValue( nxActual_h );
346 // newevent.SetClientData( (void *)cWrap );
347 // _eventHandler->ProcessEvent(newevent);
353 * Handles the event wxEVT_TSBAR_START from the horizontal bar
355 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
357 // int nxStart_h = getStartHorizontal();
360 * Handles the event wxEVT_TSBAR_END from the horizontal bar
362 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
364 // int nxEnd_h = getEndHorizontal();
367 * Handles the event wxEVT_SELECTION_END from the horizontal bar
369 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
374 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
376 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
378 // int nxStart_h = getStartHorizontal();
379 // int nxEnd_h = getEndHorizontal();
383 //------------------------------------------------------------------------------------------------------------
384 // Methods for capturing events from the vertical bar
385 //------------------------------------------------------------------------------------------------------------
388 * Handles the event wxEVT_TSBAR from the vertical bar
390 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
395 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
397 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
399 int actual = getActualVertical();
400 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
403 int nxActual_v = getActualVertical();
405 if (_eventHandler!=NULL)
407 //-------------------------------------------------
408 // Sending the event of wxINSTANT_CHANGE
409 //-------------------------------------------------
410 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
412 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
413 cWrap->setActualValue( nxActual_v );
415 newevent.SetClientData( (void *)cWrap );
416 _eventHandler->ProcessEvent(newevent);
421 * Handles the event wxEVT_TSBAR_START from the vertical bar
423 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
425 // int nxStart_v = getStartVertical();
428 * Handles the event wxEVT_TSBAR_END from the vertical bar
430 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
432 // int nxEnd_v = getEndVertical();
435 * Handles the event wxEVT_SELECTION_END from the vertical bar
437 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
442 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
444 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
446 // int nxStart_v = getStartVertical();
447 // int nxEnd_v = getEndVertical();
451 //------------------------------------------------------------------------------------------------------------
452 // Methods for sending events
453 //------------------------------------------------------------------------------------------------------------
455 //------------------------------------------------------------------------------------------------------------
456 // Attributes getters and setters
457 //------------------------------------------------------------------------------------------------------------
460 * Sets the represented values of the vertical bar
461 * @param minRepresented In the minimum represented value of the bar
462 * @param maxRepresented In the maximum represented value of the bar
464 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
466 if( _verticalBar != NULL && _useVerticalBar )
468 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
473 * Sets the represented values of the horizontal bar
474 * @param minRepresented In the minimum represented value of the bar
475 * @param maxRepresented In the maximum represented value of the bar
477 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
479 if( _horizontalBar != NULL && _useHorizontalBar )
481 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
486 * Gets the StartVertical value
487 * @return The StartVertical
489 int wxContourViewPanel :: getStartVertical()
491 return _verticalBar->GetActual();
494 * Gets the EndVertical value
495 * @return The EndVertical
497 int wxContourViewPanel :: getEndVertical()
499 return _verticalBar->GetEnd();
502 * Gets the ActualVertical value
503 * @return The ActualVertical
505 int wxContourViewPanel :: getActualVertical()
507 return _verticalBar->GetActual();//GetEnd();
511 * Sets the StartVertical value
512 * @param nwValue The new value for the StartVertical
514 void wxContourViewPanel :: setStartVertical( int nwValue )
516 _verticalBar->SetEnd( nwValue );
519 * Sets the EndVertical value
520 * @param nwValue The new value for the EndVertical
522 void wxContourViewPanel :: setEndVertical( int nwValue )
524 _verticalBar->SetEnd( nwValue );
527 * Sets the ActualVertical value
528 * @param nwValue The new value for the ActualVertical
530 void wxContourViewPanel :: setActualVertical( int nwValue )
532 _verticalBar->SetActual( nwValue );
536 * Gets the StartHorizontal value
537 * @return The StartHorizontal
539 int wxContourViewPanel :: getStartHorizontal()
541 return _horizontalBar->GetStart();
544 * Gets the EndHorizontal value
545 * @return The EndHorizontal
547 int wxContourViewPanel :: getEndHorizontal()
549 return _horizontalBar->GetEnd();
552 * Gets the ActualHorizontal value
553 * @return The ActualHorizontal
555 int wxContourViewPanel :: getActualHorizontal()
557 return _horizontalBar->GetActual();
561 * Sets the StartHorizontal value
562 * @param nwValue The new value for the StartHorizontal
564 void wxContourViewPanel :: setStartHorizontal( int nwValue )
566 _horizontalBar->SetStart( nwValue );
569 * Sets the EndHorizontal value
570 * @param nwValue The new value for the EndHorizontal
572 void wxContourViewPanel :: setEndHorizontal( int nwValue )
574 _horizontalBar->SetEnd( nwValue );
577 * Sets the ActualHorizontal value
578 * @param nwValue The new value for the ActualHorizontal
580 void wxContourViewPanel :: setActualHorizontal( int nwValue )
582 _horizontalBar->SetActual( nwValue );
586 * Sets the horizontal concept values and name
587 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
588 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
589 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
590 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
591 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
592 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
594 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
596 setHorizontalConceptName( theHorizontalConcept );
597 setHorizontalRepresentedValues( minRepresent, maxRepresent );
598 setActualHorizontal( actualShow );
599 setStartHorizontal( minShowed );
600 setEndHorizontal( maxShowed );
604 * Sets the vertical concept values and name
605 * @param theVerticalConcept The name of the concept for setting at the vertical bar
606 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
607 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
608 * @param minShowed The minShowed value of the concept for setting at the vertical bar
609 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
610 * @param actualShow The actualShow value of the concept for setting at the vertical bar
612 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
614 setVerticalConceptName( theVerticalConcept );
615 setVerticalRepresentedValues( minRepresent, maxRepresent );
616 setActualVertical( actualShow );
617 setStartVertical( minShowed );
618 setEndVertical( maxShowed );
623 * Sets the horizontal concept name
624 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
626 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
628 _horizontalConceptName = theHorizontalConcept;
632 * Gets the horizontal concept name
633 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
635 std::string wxContourViewPanel :: getHorizontalConceptName( )
637 return _horizontalConceptName;
641 * Sets the vertical concept name
642 * @param theVerticalConcept The name of the concept for setting at the vertical bar
644 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
646 _verticalConceptName = theVerticalConcept;
650 * Gets the vertical concept name
651 * @return _verticalConceptName The name of the concept for setting at the vertical bar
653 std::string wxContourViewPanel :: getVerticalConceptName( )
655 return _verticalConceptName;
658 //------------------------------------------------------------------------------------------------------------
659 // Other functional methods
660 //------------------------------------------------------------------------------------------------------------
662 void wxContourViewPanel :: getSpacing( double * spacing )
664 spacing[0] = last_spacing[0];
665 spacing[1] = last_spacing[1];
666 spacing[2] = last_spacing[2];
669 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
671 return theViewPanel->GetwxVtkBaseView(1);
674 double wxContourViewPanel :: getCurrentDeep()
677 // return theViewPanel->GetZ(1);
678 return theViewPanel->GetZ();
683 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
684 return _sceneManager->isEditableCControler(theKeyName);
687 void wxContourViewPanel::removeFromScene(std::string theKeyName){
689 _sceneManager->deleteCViewerCControler(theKeyName);
694 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
695 ConceptDataWrap * dataConcept = NULL;
696 if ( GetId() == event.GetId() )
698 dataConcept = (ConceptDataWrap *)event.GetClientData();
699 int value = dataConcept->getActualValue();
700 //_instantPanel->setConceptValue( dataConcept->getName(), value );
701 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
705 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
706 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
708 setActualVertical( dataConcept->getActualValue());
709 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
711 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
713 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
716 wxContourMainFrame::getInstance()->changeInstant();
719 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
721 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
723 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
725 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
726 double val = getCurrentDeep();
727 //setActualVertical( (int)val );
728 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
729 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
733 void wxContourViewPanel::changeDeep(){
734 double val = getCurrentDeep();
735 setActualVertical( (int)val );
737 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
740 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
741 // int elementsSelected = currentSelection.size();
742 bool ctrlKey = _sceneManager->isCtrlPressed();
743 char toolCommand = _sceneManager->getLastKeyCode();
746 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
748 wxContourMainFrame::getInstance()->onCopy();
750 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
752 wxContourMainFrame::getInstance()->onPaste();
754 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
756 wxContourMainFrame::getInstance()->onDeleteContour();
758 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
760 //toolCommand = &(CREATE_CONTOUR_KEY);
762 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
764 wxContourMainFrame::getInstance()->onLoad();
766 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
768 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
769 }else if( toolCommand == 26 ){
770 wxContourMainFrame::getInstance()->onUndo();
771 }else if( toolCommand == 25 ){
772 wxContourMainFrame::getInstance()->onRedo();
776 void wxContourViewPanel::removeSceneContours(){
777 _sceneManager->removeSceneContours();
780 void wxContourViewPanel::addNameWrapperToScene(){
781 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
782 for(int i = 0; i < size;i++){
783 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
784 _sceneManager->addToScene(name, true, true, true, false, false );
788 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
789 return _sceneManager->getSelectedObjects();
792 void wxContourViewPanel::RefreshInterface(){
793 getWxVtkBaseView()->Refresh();
796 vtkImageData* wxContourViewPanel::getImageData(){
797 return _sceneManager->GetImageData();
800 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
802 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
805 int wxContourViewPanel::GetImageDataSizeZ()
807 return _sceneManager->GetImageDataSizeZ();
810 void wxContourViewPanel::GetImageDataRange(double *range)
812 _sceneManager->GetImageDataRange(range);
815 void wxContourViewPanel::SetWidthContour(double width )
817 _sceneManager->SetWidthContour( width );
820 int wxContourViewPanel::getColorWindow()
822 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
823 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
824 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
828 int wxContourViewPanel::getWindowLevel()
830 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
831 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
832 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
836 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
838 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
839 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
840 imageviewer->SetColorWindow(colorwindow);
841 imageviewer->SetColorLevel(windowlevel);
844 void wxContourViewPanel::onInterpolation(bool interpolate)
846 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
847 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
850 imageviewer->GetImageActor()->InterpolateOn();
852 imageviewer->GetImageActor()->InterpolateOff();
856 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
858 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
861 void wxContourViewPanel::setImageSlice(int z){
862 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
863 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
864 baseview->SetActualSlice(z);