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 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
130 #if wxMAJOR_VERSION <= 2
131 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH);
132 panelSizer -> AddGrowableCol(2);
133 panelSizer -> AddGrowableRow(2);
135 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(4);
136 panelSizer -> AddGrowableCol(2);
138 panelSizer->Add(_verticalBar, 1, wxGROW);
139 panelSizer->AddSpacer(gapV);
140 panelSizer->Add(theViewPanel, 1, wxGROW);
141 panelSizer->AddSpacer(gapV);
143 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
144 #if wxMAJOR_VERSION <= 2
145 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
146 outSizer -> AddGrowableCol(1);
147 outSizer -> AddGrowableRow(1);
149 outSizer = new wxFlexGridSizer(3);
150 outSizer -> AddGrowableCol(1);
152 outSizer->Add( _horizontalBar, 1, wxGROW);
153 outSizer->Add( panelSizer, 1, wxGROW);
154 outSizer->AddSpacer(gapH);
156 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
157 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
159 //Connecting the events to the horizontal bar
160 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
161 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal );
162 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal );
163 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal );
164 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal );
165 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal );
167 //Connecting the events to the vertical bar
168 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
169 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical );
170 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical );
171 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical );
172 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical );
173 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical );
174 this->SetSizer( outSizer );
175 this->SetAutoLayout( true );
177 //SetSize(1900,1900);
178 //theViewPanel->SetSize(800,600);
179 //theViewPanel->GetWindow(1)->SetSize(800,600);
180 //outSizer->Fit( this );
181 initializeScenceManager();
185 wxContourViewPanel :: ~wxContourViewPanel()
187 delete _sceneManager;
190 void wxContourViewPanel::initializeScenceManager()
192 //_theViewPanel = theViewPanel;
193 //_theViewPanel->setWxEventHandler( this );
195 this->getSpacing(spc);
196 _sceneManager = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc );
197 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangeInstant );
198 Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateMultipleROI );
199 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onCreateROI );
200 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStopCreateROI );
201 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onChangedDeep );
202 Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
205 wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
206 return _sceneManager;
209 //------------------------------------------------------------------------------------------------------------
210 // Creational and initialization methods
211 //------------------------------------------------------------------------------------------------------------
213 void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
215 _eventHandler = theEventHandler;
218 void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
220 _horizontalBar = new mBarRange(this, 1500,80);
221 _horizontalBar -> setVisibleLabels (true);
222 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
223 _horizontalBar -> setActiveStateTo(true);
224 _horizontalBar -> SetActual( horzStart );
225 _horizontalBar -> setDeviceBlitStart (10,10);
226 _horizontalBar -> setDeviceEndMargin (10);
229 void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
231 _verticalBar = new mBarRange(this, 1500,40);
232 _verticalBar -> SetOrientation(false);
233 _verticalBar -> setVisibleLabels (false);
234 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
235 _verticalBar -> setActiveStateTo(true);
236 _verticalBar -> SetActual( vertStart );
237 _verticalBar -> setDeviceBlitStart (10,10);
238 _verticalBar -> setDeviceEndMargin (10);
240 //------------------------------------------------------------------------------------------------------------
242 void wxContourViewPanel::createViewPanel()
244 std::vector<int> * numViews = new std::vector<int> ();
245 numViews->push_back(0);
246 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
247 SetVisibleAxis(false);
249 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
251 theViewPanel->SetSize(800,600);
252 theViewPanel->GetWindow(1)->SetSize(800,600);
255 //------------------------------------------------------------------------------------------------------------
257 void wxContourViewPanel::changeImage(vtkImageData* img){
259 theViewPanel->SetImage(img);
262 wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
264 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
267 //------------------------------------------------------------------------------------------------------------
268 void wxContourViewPanel::SetVisibleAxis(bool ok)
270 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
273 //------------------------------------------------------------------------------------------------------------
274 int wxContourViewPanel::GetX()
276 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
278 //------------------------------------------------------------------------------------------------------------
279 int wxContourViewPanel::GetY()
281 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
283 //------------------------------------------------------------------------------------------------------------
284 int wxContourViewPanel::GetZ()
286 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
289 //------------------------------------------------------------------------------------------------------------
290 void wxContourViewPanel::Refresh()
292 GetwxVtkMPR2DView()->GetRenWin()->Render();
296 //------------------------------------------------------------------------------------------------------------
297 // Methods for capturing events from the horizontal bar
298 //------------------------------------------------------------------------------------------------------------
301 * Handles the event wxEVT_TSBAR from the horizontal bar
303 void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
308 * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
310 void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
313 int actual = getActualHorizontal();
315 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
318 //int nxActual_h = getActualHorizontal();
321 //if (_eventHandler!=NULL)
323 //-------------------------------------------------
324 // Sending the event of wxINSTANT_CHANGE
325 //-------------------------------------------------
326 // wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
328 // ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
329 // cWrap->setActualValue( nxActual_h );
331 // newevent.SetClientData( (void *)cWrap );
332 // _eventHandler->ProcessEvent(newevent);
338 * Handles the event wxEVT_TSBAR_START from the horizontal bar
340 void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
342 // int nxStart_h = getStartHorizontal();
345 * Handles the event wxEVT_TSBAR_END from the horizontal bar
347 void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
349 // int nxEnd_h = getEndHorizontal();
352 * Handles the event wxEVT_SELECTION_END from the horizontal bar
354 void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
359 * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
361 void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
363 // int nxStart_h = getStartHorizontal();
364 // int nxEnd_h = getEndHorizontal();
368 //------------------------------------------------------------------------------------------------------------
369 // Methods for capturing events from the vertical bar
370 //------------------------------------------------------------------------------------------------------------
373 * Handles the event wxEVT_TSBAR from the vertical bar
375 void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
380 * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
382 void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
384 int actual = getActualVertical();
385 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
388 int nxActual_v = getActualVertical();
390 if (_eventHandler!=NULL)
392 //-------------------------------------------------
393 // Sending the event of wxINSTANT_CHANGE
394 //-------------------------------------------------
395 wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
397 ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
398 cWrap->setActualValue( nxActual_v );
400 newevent.SetClientData( (void *)cWrap );
401 _eventHandler->ProcessEvent(newevent);
406 * Handles the event wxEVT_TSBAR_START from the vertical bar
408 void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
410 // int nxStart_v = getStartVertical();
413 * Handles the event wxEVT_TSBAR_END from the vertical bar
415 void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
417 // int nxEnd_v = getEndVertical();
420 * Handles the event wxEVT_SELECTION_END from the vertical bar
422 void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
427 * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
429 void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
431 // int nxStart_v = getStartVertical();
432 // int nxEnd_v = getEndVertical();
436 //------------------------------------------------------------------------------------------------------------
437 // Methods for sending events
438 //------------------------------------------------------------------------------------------------------------
440 //------------------------------------------------------------------------------------------------------------
441 // Attributes getters and setters
442 //------------------------------------------------------------------------------------------------------------
445 * Sets the represented values of the vertical bar
446 * @param minRepresented In the minimum represented value of the bar
447 * @param maxRepresented In the maximum represented value of the bar
449 void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
451 if( _verticalBar != NULL && _useVerticalBar )
453 _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
458 * Sets the represented values of the horizontal bar
459 * @param minRepresented In the minimum represented value of the bar
460 * @param maxRepresented In the maximum represented value of the bar
462 void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
464 if( _horizontalBar != NULL && _useHorizontalBar )
466 _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
471 * Gets the StartVertical value
472 * @return The StartVertical
474 int wxContourViewPanel :: getStartVertical()
476 return _verticalBar->GetActual();
479 * Gets the EndVertical value
480 * @return The EndVertical
482 int wxContourViewPanel :: getEndVertical()
484 return _verticalBar->GetEnd();
487 * Gets the ActualVertical value
488 * @return The ActualVertical
490 int wxContourViewPanel :: getActualVertical()
492 return _verticalBar->GetActual();//GetEnd();
496 * Sets the StartVertical value
497 * @param nwValue The new value for the StartVertical
499 void wxContourViewPanel :: setStartVertical( int nwValue )
501 _verticalBar->SetEnd( nwValue );
504 * Sets the EndVertical value
505 * @param nwValue The new value for the EndVertical
507 void wxContourViewPanel :: setEndVertical( int nwValue )
509 _verticalBar->SetEnd( nwValue );
512 * Sets the ActualVertical value
513 * @param nwValue The new value for the ActualVertical
515 void wxContourViewPanel :: setActualVertical( int nwValue )
517 _verticalBar->SetActual( nwValue );
521 * Gets the StartHorizontal value
522 * @return The StartHorizontal
524 int wxContourViewPanel :: getStartHorizontal()
526 return _horizontalBar->GetStart();
529 * Gets the EndHorizontal value
530 * @return The EndHorizontal
532 int wxContourViewPanel :: getEndHorizontal()
534 return _horizontalBar->GetEnd();
537 * Gets the ActualHorizontal value
538 * @return The ActualHorizontal
540 int wxContourViewPanel :: getActualHorizontal()
542 return _horizontalBar->GetActual();
546 * Sets the StartHorizontal value
547 * @param nwValue The new value for the StartHorizontal
549 void wxContourViewPanel :: setStartHorizontal( int nwValue )
551 _horizontalBar->SetStart( nwValue );
554 * Sets the EndHorizontal value
555 * @param nwValue The new value for the EndHorizontal
557 void wxContourViewPanel :: setEndHorizontal( int nwValue )
559 _horizontalBar->SetEnd( nwValue );
562 * Sets the ActualHorizontal value
563 * @param nwValue The new value for the ActualHorizontal
565 void wxContourViewPanel :: setActualHorizontal( int nwValue )
567 _horizontalBar->SetActual( nwValue );
571 * Sets the horizontal concept values and name
572 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
573 * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
574 * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
575 * @param minShowed The minShowed value of the concept for setting at the horizontal bar
576 * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
577 * @param actualShow The actualShow value of the concept for setting at the horizontal bar
579 void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
581 setHorizontalConceptName( theHorizontalConcept );
582 setHorizontalRepresentedValues( minRepresent, maxRepresent );
583 setActualHorizontal( actualShow );
584 setStartHorizontal( minShowed );
585 setEndHorizontal( maxShowed );
589 * Sets the vertical concept values and name
590 * @param theVerticalConcept The name of the concept for setting at the vertical bar
591 * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
592 * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
593 * @param minShowed The minShowed value of the concept for setting at the vertical bar
594 * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
595 * @param actualShow The actualShow value of the concept for setting at the vertical bar
597 void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
599 setVerticalConceptName( theVerticalConcept );
600 setVerticalRepresentedValues( minRepresent, maxRepresent );
601 setActualVertical( actualShow );
602 setStartVertical( minShowed );
603 setEndVertical( maxShowed );
608 * Sets the horizontal concept name
609 * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
611 void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
613 _horizontalConceptName = theHorizontalConcept;
617 * Gets the horizontal concept name
618 * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
620 std::string wxContourViewPanel :: getHorizontalConceptName( )
622 return _horizontalConceptName;
626 * Sets the vertical concept name
627 * @param theVerticalConcept The name of the concept for setting at the vertical bar
629 void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
631 _verticalConceptName = theVerticalConcept;
635 * Gets the vertical concept name
636 * @return _verticalConceptName The name of the concept for setting at the vertical bar
638 std::string wxContourViewPanel :: getVerticalConceptName( )
640 return _verticalConceptName;
643 //------------------------------------------------------------------------------------------------------------
644 // Other functional methods
645 //------------------------------------------------------------------------------------------------------------
647 void wxContourViewPanel :: getSpacing( double * spacing )
649 spacing[0] = last_spacing[0];
650 spacing[1] = last_spacing[1];
651 spacing[2] = last_spacing[2];
654 wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
656 return theViewPanel->GetwxVtkBaseView(1);
659 double wxContourViewPanel :: getCurrentDeep()
662 // return theViewPanel->GetZ(1);
663 return theViewPanel->GetZ();
668 bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
669 return _sceneManager->isEditableCControler(theKeyName);
672 void wxContourViewPanel::removeFromScene(std::string theKeyName){
674 _sceneManager->deleteCViewerCControler(theKeyName);
679 void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
680 ConceptDataWrap * dataConcept = NULL;
681 if ( GetId() == event.GetId() )
683 dataConcept = (ConceptDataWrap *)event.GetClientData();
684 int value = dataConcept->getActualValue();
685 //_instantPanel->setConceptValue( dataConcept->getName(), value );
686 wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
690 dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
691 if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
693 setActualVertical( dataConcept->getActualValue());
694 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
696 else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
698 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
701 wxContourMainFrame::getInstance()->changeInstant();
704 void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
706 void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
708 void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
710 void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
711 double val = getCurrentDeep();
712 //setActualVertical( (int)val );
713 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
714 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
718 void wxContourViewPanel::changeDeep(){
719 double val = getCurrentDeep();
720 setActualVertical( (int)val );
722 void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
725 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
726 // int elementsSelected = currentSelection.size();
727 bool ctrlKey = _sceneManager->isCtrlPressed();
728 char toolCommand = _sceneManager->getLastKeyCode();
731 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
733 wxContourMainFrame::getInstance()->onCopy();
735 else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
737 wxContourMainFrame::getInstance()->onPaste();
739 else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
741 wxContourMainFrame::getInstance()->onDeleteContour();
743 else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
745 //toolCommand = &(CREATE_CONTOUR_KEY);
747 else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
749 wxContourMainFrame::getInstance()->onLoad();
751 else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
753 wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
754 }else if( toolCommand == 26 ){
755 wxContourMainFrame::getInstance()->onUndo();
756 }else if( toolCommand == 25 ){
757 wxContourMainFrame::getInstance()->onRedo();
761 void wxContourViewPanel::removeSceneContours(){
762 _sceneManager->removeSceneContours();
765 void wxContourViewPanel::addNameWrapperToScene(){
766 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
767 for(int i = 0; i < size;i++){
768 std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
769 _sceneManager->addToScene(name, true, true, true, false, false );
773 std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
774 return _sceneManager->getSelectedObjects();
777 void wxContourViewPanel::RefreshInterface(){
778 getWxVtkBaseView()->Refresh();
781 vtkImageData* wxContourViewPanel::getImageData(){
782 return _sceneManager->GetImageData();
785 void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
787 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
790 int wxContourViewPanel::GetImageDataSizeZ()
792 return _sceneManager->GetImageDataSizeZ();
795 void wxContourViewPanel::GetImageDataRange(double *range)
797 _sceneManager->GetImageDataRange(range);
800 void wxContourViewPanel::SetWidthContour(double width )
802 _sceneManager->SetWidthContour( width );
805 int wxContourViewPanel::getColorWindow()
807 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
808 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
809 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
813 int wxContourViewPanel::getWindowLevel()
815 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
816 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
817 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
821 void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
823 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
824 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
825 imageviewer->SetColorWindow(colorwindow);
826 imageviewer->SetColorLevel(windowlevel);
829 void wxContourViewPanel::onInterpolation(bool interpolate)
831 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
832 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
835 imageviewer->GetImageActor()->InterpolateOn();
837 imageviewer->GetImageActor()->InterpolateOff();
841 void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
843 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
846 void wxContourViewPanel::setImageSlice(int z){
847 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
848 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
849 baseview->SetActualSlice(z);