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 # ------------------------------------------------------------------------ */
26 #include "interfToolsPanels.h"
27 #include "interfMainPanel.h"
29 interfConfigurationPanel::interfConfigurationPanel(wxWindow * parent)
30 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
32 // wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString(_T("")));
33 _withOfContourLine = new wxSlider(this, -1, 1 , 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
36 interfMainPanel::getInstance()->getImageRange(range);
37 //this->_theViewPanel->getSceneManager()->GetImageDataRange(range);
39 //wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
40 //vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
41 //int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
42 //int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
44 int colorwindow = interfMainPanel::getInstance()->getColorWindow();
45 int windowlevel = interfMainPanel::getInstance()->getWindowLevel();
47 int min = (int)floor (range[0]);
48 int max = (int)ceil (range[1]);
51 _brithtnessWindowLevel = new wxSlider(this, -1, windowlevel , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
52 _brithtnessColorLevel = new wxSlider(this, -1, colorwindow , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
54 _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image Interpolation") );
55 _interpolationCheckBox->SetValue(true);
57 _beforContourCheckBox = new wxCheckBox(this, -1, _T("Befor Contour") );
58 _beforContourCheckBox->SetValue(false);
60 _afterContourCheckBox = new wxCheckBox(this, -1, _T("After Contour") );
61 _afterContourCheckBox->SetValue(false);
64 Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour);
65 Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour);
67 Connect( _brithtnessWindowLevel->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
68 Connect( _brithtnessWindowLevel->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
69 Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
70 Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
71 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnInterpolation);
72 Connect( _beforContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour);
73 Connect( _afterContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour);
75 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
76 sizer -> Add( new wxStaticText(this,-1, _T("Contour width")) , 1, wxGROW );
77 sizer -> Add( _withOfContourLine , 1, wxGROW );
78 sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
79 sizer -> Add( new wxStaticText(this,-1, _T("Window level")) , 1, wxGROW );
80 sizer -> Add( _brithtnessWindowLevel , 1, wxGROW );
81 sizer -> Add( new wxStaticText(this,-1, _T("Color level")) , 1, wxGROW );
82 sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
83 sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
84 sizer -> Add( _interpolationCheckBox , 1, wxGROW );
85 sizer -> Add( _beforContourCheckBox , 1, wxGROW );
86 sizer -> Add( _afterContourCheckBox , 1, wxGROW );
88 this->SetSizer( sizer );
90 //panel->SetSize( sizepanel );
92 this->SetAutoLayout( true );
98 interfConfigurationPanel::~interfConfigurationPanel()
102 void interfConfigurationPanel::onWidthOfContour(wxScrollEvent& event)
104 double width = (double)_withOfContourLine->GetValue() / 2.0;
105 interfMainPanel::getInstance()->onWidthOfContour(width);
108 void interfConfigurationPanel::onBrigthnessColorWindowLevel(wxScrollEvent& event){
109 int colorwindow = _brithtnessColorLevel->GetValue();
110 int windowlevel = _brithtnessWindowLevel->GetValue();
111 interfMainPanel::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
114 void interfConfigurationPanel::OnInterpolation(wxCommandEvent& event)
116 interfMainPanel::getInstance()->onInterpolation(_interpolationCheckBox->GetValue());
119 void interfConfigurationPanel::OnBeforAfterContour(wxCommandEvent& event)
121 interfMainPanel::getInstance()->onBeforAfterContour(_beforContourCheckBox->GetValue() , _afterContourCheckBox->GetValue() );
126 ** Begin of the spread panel
129 interfSpreadPanel::interfSpreadPanel(wxWindow* parent)
130 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
133 //wxPanel *panel = new wxPanel(parent,-1);
135 //_contourPropagation = new ContourPropagation();
137 //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString("",wxConvUTF8));
139 wxButton *spreadResetBtn = new wxButton(this,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize );
140 wxButton *spreadAddBtn = new wxButton(this,-1,_T("Add key contour "),wxDefaultPosition, wxDefaultSize);
141 wxButton *spreadAddAllBtn = new wxButton(this,-1,_T("Add All to key contour"),wxDefaultPosition, wxDefaultSize);
143 wxString lstOptions[3];
144 lstOptions[0]=_T("A");
145 lstOptions[1]=_T("B");
146 lstOptions[2]=_T("C");
147 _spreadMethodRadiobox = new wxRadioBox(this, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions, 3, wxRA_SPECIFY_COLS);
148 _spreadMethodRadiobox->SetSelection(2);
150 wxButton *spreadGoBtn = new wxButton(this,-1,_T("Go"),wxDefaultPosition, wxDefaultSize);
151 _staticTextSpread = new wxStaticText(this,-1,_T(" "));
153 _wxtextctrlSpread = new wxTextCtrl(this,-1, _T(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
154 _wxtextctrlSpread->SetEditable(false);
156 Connect( spreadResetBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadReset );
157 Connect( spreadAddBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAdd );
158 Connect( spreadAddAllBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAddAll );
159 Connect( spreadGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadGo );
161 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
162 sizer -> Add( spreadResetBtn , 1, wxGROW );
163 sizer -> Add( spreadAddBtn , 1, wxGROW );
164 sizer -> Add( spreadAddAllBtn , 1, wxGROW );
165 sizer -> Add( _spreadMethodRadiobox , 1, wxGROW );
166 sizer -> Add( spreadGoBtn , 1, wxGROW );
167 sizer -> Add( _staticTextSpread , 1, wxGROW );
168 sizer -> Add( _wxtextctrlSpread , 1, wxGROW );
171 this->SetSizer( sizer );
172 //this->SetSize( wxDefaultSize );
173 this->SetAutoLayout( true );
178 interfSpreadPanel::~interfSpreadPanel(){
181 void interfSpreadPanel::onSpreadReset(wxCommandEvent& event){
182 setStringSpread(" ");
183 _wxtextctrlSpread->SetValue(wxString("",wxConvUTF8));
184 interfMainPanel::getInstance()->resetAppend();
187 void interfSpreadPanel::onSpreadAdd(wxCommandEvent& event){
188 interfMainPanel::getInstance()->onSpreadAdd();
191 void interfSpreadPanel::onSpreadAddAll(wxCommandEvent& event){
192 interfMainPanel::getInstance()->onSpreadAddAll();
195 void interfSpreadPanel::onSpreadGo(wxCommandEvent& event){
196 setStringSpread(" ");
197 int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
198 printf("EED interfSpreadPanel::onSpreadGo %d\n",typeMethodFindCtrlPoints);
199 interfMainPanel::getInstance()->onSpreadGo(typeMethodFindCtrlPoints);
203 void interfSpreadPanel::appendStringSpread(std::string val){
206 //newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
208 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
209 #if wxMAJOR_VERSION <= 2
210 newstring.append(wxString(_wxtextctrlSpread->GetValue(),wxConvUTF8));
212 newstring.append( _wxtextctrlSpread->GetValue() );
216 newstring.append(wxString(" ",wxConvUTF8));
217 newstring.append(wxString(val.c_str(),wxConvUTF8));
218 _wxtextctrlSpread->SetValue(newstring);
221 void interfSpreadPanel::setStringSpread(std::string stringtemp){
223 wxString newstring(stringtemp.c_str(),wxConvUTF8);
224 //_wxtextctrlSpread->SetEditable(true);
225 _staticTextSpread->SetLabel(newstring);
226 //_wxtextctrlSpread->SetEditable(false);
230 ** Begin of information panel
232 interfInformationPanel::interfInformationPanel(wxWindow * parent)
233 //: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
234 : wxPanel(parent, -1)
236 printf("EED interfInformationPanel::interfInformationPanel Start\n");
237 //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
238 wxString lstOptions[4];
239 lstOptions[0]=_T("Current Slice");
240 lstOptions[1]=_T("Range Slices");
241 // lstOptions[2]=_T("All Slices");
242 _informationRadiobox = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS);
244 wxString lstOptContOperation[5];
245 lstOptContOperation[0]=_T("AND");
246 lstOptContOperation[1]=_T("OR");
247 lstOptContOperation[2]=_T("XOR");
248 lstOptContOperation[3]=_T("ALL");
249 _radiolstboxContourGroup = new wxRadioBox(this, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation, 4, wxRA_SPECIFY_COLS);
250 _radiolstboxContourGroup->SetSelection(1);
251 Connect( _radiolstboxContourGroup->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &interfInformationPanel::onContourGroup );
253 printf("EED interfInformationPanel::interfInformationPanel 1\n");
256 _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") );
257 _XYZValues->SetValue(true);
258 _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") );
259 _contourImage->SetValue(true);
260 _statistics = new wxCheckBox(this, -1, _T("Save Statistics") );
261 _statistics->SetValue(true);
264 wxButton *informationContourLabelsBtn = new wxButton(this,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
265 #if wxMAJOR_VERSION <= 2
266 informationContourLabelsBtn->SetEventHandler( this );
268 // informationContourLabelsBtn->SetEventHandler( this );
269 printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo informationContourLabelsBtn->SetEventHandler \n");
271 Connect( informationContourLabelsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onInformationContourLabels );
273 wxButton *statisticsContourBtn = new wxButton(this,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
274 #if wxMAJOR_VERSION <= 2
275 statisticsContourBtn->SetEventHandler( this );
277 //statisticsContourBtn->SetEventHandler( this );
278 printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo statisticsContourBtn->SetEventHandler \n");
280 Connect( statisticsContourBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation );
282 wxButton *showResultImagesBtn = new wxButton(this,-1,_T("Show result images"),wxDefaultPosition, wxSize(140,35) );
283 #if wxMAJOR_VERSION <= 2
284 showResultImagesBtn->SetEventHandler( this );
286 //showResultImagesBtn->SetEventHandler( this );
287 printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo showResultImagesBtn->SetEventHandler \n");
289 Connect( showResultImagesBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onShowResultImages );
291 wxButton *saveResultsBtn = new wxButton(this,-1,_T("Save Results"),wxDefaultPosition, wxSize(140,35) );
292 #if wxMAJOR_VERSION <= 2
293 saveResultsBtn->SetEventHandler( this );
295 //EED saveResultsBtn->SetEventHandler( this );
296 printf("EED interfInformationPanel::interfInformationPanel OOOjjjooooooo saveResultsBtn->SetEventHandler \n");
299 Connect( saveResultsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults );
301 int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
303 //_theViewPanel->getSceneManager()->GetImageDataSizeZ();
304 _mbarrangeSliceInformation = new mBarRange(this,65,65);
305 _mbarrangeSliceInformation->SetMin(0);
306 _mbarrangeSliceInformation->SetStart(0);
307 _mbarrangeSliceInformation->SetOrientation( true );
308 _mbarrangeSliceInformation->setActiveStateTo(true);
309 _mbarrangeSliceInformation->setVisibleLabels( true );
310 _mbarrangeSliceInformation->setDeviceEndMargin(10);
311 _mbarrangeSliceInformation->setRepresentedValues( 0 , sizeZ-1 );
312 _mbarrangeSliceInformation->setDeviceBlitStart(10,10);
313 _mbarrangeSliceInformation->setIfWithActualDrawed( false );
314 _mbarrangeSliceInformation->SetStart( 0 );
315 _mbarrangeSliceInformation->SetEnd( sizeZ-1 );
318 interfMainPanel::getInstance()->getImageRange(range);
319 printf("EED interfInformationPanel::interfInformationPanel 2\n");
321 int min = (int)floor (range[0]);
322 int max = (int)ceil (range[1]);
324 _mbarrangeRangeInformation = new mBarRange(this,65,65);
325 _mbarrangeRangeInformation->SetMin(0);
326 _mbarrangeRangeInformation->SetStart(0);
327 _mbarrangeRangeInformation->SetOrientation( true );
328 _mbarrangeRangeInformation->setActiveStateTo(true);
329 _mbarrangeRangeInformation->setVisibleLabels( true );
330 _mbarrangeRangeInformation->setDeviceEndMargin(10);
331 _mbarrangeRangeInformation->setRepresentedValues( min , max );
332 _mbarrangeRangeInformation->setDeviceBlitStart(10,10);
333 _mbarrangeRangeInformation->setIfWithActualDrawed( false );
334 _mbarrangeRangeInformation->SetStart( min );
335 _mbarrangeRangeInformation->SetEnd( max );
337 // _mbarrangeSliceInformation->PushEventHandler(this);
338 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
339 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
340 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
341 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
342 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
343 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
346 printf("EED interfInformationPanel::interfInformationPanel 3\n");
347 _staticTextInformation = new wxStaticText(this,-1,_T(" "));
348 _grid = new wxGrid( this,
351 wxSize( 200, 250 ) );
352 int i,gridCol=10,gridRow=sizeZ+2;
353 _grid->CreateGrid( 0, 0 );
354 _grid->AppendRows(gridRow);
355 _grid->AppendCols(gridCol);
356 for (i=0;i<gridRow;i++)
358 _grid->SetRowLabelValue(i, _T(" ") );
360 // _grid->SetColLabelSize(0);
361 FillGridWithContoursInformation();
364 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
365 #if wxMAJOR_VERSION <= 2
366 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2);
368 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2,0,0);
370 sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: ")) , 1, wxGROW );
371 sizerSave->Add( _XYZValues, 1, wxALL, 2 );
372 sizerSave->Add( _statistics, 1, wxALL, 2 );
373 sizerSave->Add( _contourImage, 1, wxALL, 2 );
376 printf("EED interfInformationPanel::interfInformationPanel 4\n");
377 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
378 #if wxMAJOR_VERSION <= 2
379 wxFlexGridSizer * sizerA = new wxFlexGridSizer(10);
381 wxFlexGridSizer * sizerA = new wxFlexGridSizer(1,10,0,0);
383 sizerA->Add( _informationRadiobox, 1, wxALL, 2 );
384 sizerA->Add( _radiolstboxContourGroup, 1, wxALL, 2 );
385 sizerA->Add( sizerSave, 1, wxALL, 2 );
388 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
389 #if wxMAJOR_VERSION <= 2
390 wxFlexGridSizer * sizerB = new wxFlexGridSizer(10);
392 wxFlexGridSizer * sizerB = new wxFlexGridSizer(1,4,0,0);
394 sizerB->Add( informationContourLabelsBtn, 1, wxALL, 2 );
395 sizerB->Add( statisticsContourBtn, 1, wxALL, 2 );
396 sizerB->Add( showResultImagesBtn, 1, wxALL, 2 );
397 sizerB->Add( saveResultsBtn, 1, wxALL, 2 );
399 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
400 #if wxMAJOR_VERSION <= 2
401 wxFlexGridSizer * sizer = new wxFlexGridSizer(1,8);
403 wxFlexGridSizer * sizer = new wxFlexGridSizer(20,1,0,0);
405 printf("EED interfInformationPanel::interfInformationPanel 5\n");
406 sizer->Add( sizerA , 1, wxALL , 0 );
407 printf("EED interfInformationPanel::interfInformationPanel 5.1\n");
408 sizer->Add( new wxStaticText(this ,1,_T("Slice Range")) , 1, wxALL , 0 );
409 printf("EED interfInformationPanel::interfInformationPanel 5.2\n");
410 sizer->Add( _mbarrangeSliceInformation , 1, wxALL|wxGROW , 2 );
411 printf("EED interfInformationPanel::interfInformationPanel 5.3\n");
412 sizer->Add( new wxStaticText(this ,1,_T("Gray Range")) , 1, wxALL , 0 );
413 printf("EED interfInformationPanel::interfInformationPanel 5.4\n");
414 sizer->Add( _mbarrangeRangeInformation , 1, wxALL|wxGROW , 2 );
417 sizer->Add( sizerB , 1, wxEXPAND , 0 );
418 sizer->Add( _staticTextInformation , 1, wxEXPAND , 0 );
419 sizer->Add( _grid , 1, wxEXPAND , 0 );
420 this->SetSizer( sizer );
421 this->SetSize( wxSize(1500,1500) );
422 this->SetAutoLayout( true );
423 printf("EED interfInformationPanel::interfInformationPanel 5.10\n");
427 printf("EED interfInformationPanel::interfInformationPanel End\n");
431 interfInformationPanel::~interfInformationPanel()
436 void interfInformationPanel::onRangeSliceInformation(wxCommandEvent& event)
438 int grayRangeMin = _mbarrangeRangeInformation->GetStart();
439 int grayRangeMax = _mbarrangeRangeInformation->GetEnd();
440 interfMainPanel::getInstance()->SetScalarRange(grayRangeMin,grayRangeMax);
441 interfMainPanel::getInstance()->RefreshInterface();
445 void interfInformationPanel::onInformationContourLabels(wxCommandEvent& event){
447 FillGridWithContoursInformation();
451 void interfInformationPanel::onShowResultImages(wxCommandEvent& event)
453 // onExtractInformation( event );
454 int selection = _informationRadiobox->GetSelection();
455 int minZ = _mbarrangeSliceInformation->GetStart();
456 int maxZ = _mbarrangeSliceInformation->GetEnd();
457 int typeContourGroup = _radiolstboxContourGroup->GetSelection();
458 interfMainPanel::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
462 void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
466 int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
467 int selection = _informationRadiobox->GetSelection();
468 int minZ = _mbarrangeSliceInformation->GetStart();
469 int maxZ = _mbarrangeSliceInformation->GetEnd();
470 int grayRangeMin = _mbarrangeRangeInformation->GetStart();
471 int grayRangeMax = _mbarrangeRangeInformation->GetEnd();
473 interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ, grayRangeMin, grayRangeMax);
476 void interfInformationPanel::onSaveResults(wxCommandEvent& event)
478 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
479 #if wxMAJOR_VERSION <= 2
480 wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxSAVE );
482 wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxFD_SAVE );
484 if (dialog.ShowModal() == wxID_OK)
486 onExtractInformation( event );
487 int selection = _informationRadiobox->GetSelection();
488 int minZ = _mbarrangeSliceInformation->GetStart();
489 int maxZ = _mbarrangeSliceInformation->GetEnd();
490 std::string directory = (const char *)(dialog.GetDirectory().mb_str());
491 std::string namefile = (const char *)(dialog.GetFilename().mb_str());
492 std::string filename = (const char *)(dialog.GetPath().mb_str() );
493 int typeContourGroup = _radiolstboxContourGroup->GetSelection();
494 interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename,
497 _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue());
501 void interfInformationPanel::FillGridWithContoursInformation(){
505 _grid->SetColLabelValue(0, _T("A") );
506 _grid->SetColLabelValue(1, _T("B") );
507 _grid->SetColLabelValue(2, _T("C") );
508 _grid->SetColLabelValue(3, _T("D") );
509 _grid->SetColLabelValue(4, _T("E") );
510 _grid->SetColLabelValue(5, _T("F") );
511 //_instantPanel->getInstant( tempVector );
513 int z,sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();//->getSceneManager()->GetImageDataSizeZ();
514 int ii,sizeLstContourThings;
515 for ( z=0 ; z<sizeZ ; z++)
518 std::vector<std::string> lstContourThings = interfMainPanel::getInstance()->getOutlinesName(z);
520 //this->_modelManager->getOutlinesAtInstant( &instant );
522 sizeLstContourThings = lstContourThings.size();
523 tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
524 _grid->SetRowLabelValue(z, tempString );
526 for (ii=0 ; ii<sizeLstContourThings ; ii++)
528 //ContourThing **contourthing = lstContourThings[ii];
529 //tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ;
530 tempString = wxString(lstContourThings[ii].c_str(),wxConvUTF8) ;
531 _grid->SetCellValue( z, ii, tempString );
536 _grid->SetRowLabelValue(sizeZ, _T(" ") );
537 for (ii=0 ; ii<sizeLstContourThings ; ii++)
539 _grid->SetCellValue( sizeZ, ii, _T(" ") );
544 void interfInformationPanel::setStringInfoPanel(wxString tmpString){
545 _staticTextInformation->SetLabel(tmpString);
548 void interfInformationPanel::setRowLabelInfoPanel(int z,wxString tempString){
549 _grid->SetRowLabelValue(z, tempString );
552 int interfInformationPanel::getNumberCols(){
553 return _grid->GetNumberCols();
556 void interfInformationPanel::appendCols(int numcols){
557 _grid->AppendCols(numcols);
560 void interfInformationPanel::setCellValue(int z,int tmpIntA,wxString tempString){
561 _grid->SetCellValue( z, tmpIntA , tempString );
564 void interfInformationPanel::setColLabel(int tmpIntB,wxString tmpTitleString){
565 _grid->SetColLabelValue(tmpIntB, tmpTitleString);
568 wxString interfInformationPanel::getCellValue(int j,int i){
569 return _grid->GetCellValue( j , i );
572 void interfInformationPanel::onContourGroup(wxCommandEvent& event)
574 printf("EED interfInformationPanel::onContourGroup \n");
575 int contourGroup=_radiolstboxContourGroup->GetSelection();
580 interfMainPanel::getInstance()->SetContourGroup( _radiolstboxContourGroup->GetSelection() );
583 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
584 interfCalibrationPanel:: interfCalibrationPanel(wxWindow * parent)
585 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
588 interfMainPanel::getInstance()->getImageRange(range);
594 options[2]=_T("inch");
596 _unitsRadiobox = new wxRadioBox(this, -1, _T("Unit of measurement"), wxPoint(2, 25), wxSize(145,45), 3 , options, 3, wxRA_SPECIFY_COLS);
597 _unitsRadiobox->SetSelection(0);
600 new wxStaticText(this, wxID_ANY, wxT("Real Size: "), wxPoint(2, 5));
603 _size = new wxTextCtrl(this, wxID_ANY, wxT(""), wxPoint(78,3), wxSize(70, 20), 0, wxDefaultValidator, wxTextCtrlNameStr);
606 new wxButton(this, 1, wxT("Calibrate"), wxPoint(78, 70), wxSize(70, 25), 0, wxDefaultValidator, wxT("button"));
608 //Conexion del boton con su respectivo manejador
609 Connect(1, wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &interfCalibrationPanel::onCalibrate);
613 interfCalibrationPanel:: ~interfCalibrationPanel()
617 void interfCalibrationPanel::onCalibrate(wxCommandEvent& event)
619 wxString size =_size->GetValue();
620 int unit = _unitsRadiobox->GetSelection();
621 interfMainPanel::getInstance()->onCalibration(size, unit);
623 //------------------------------------------------------------------------------------------------------------
627 //////////////////////////////////////////////////////////////
629 interfFlipPanel::interfFlipPanel(wxWindow* parent)
630 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
632 wxButton *buttonFlipX = new wxButton(this,wxID_ANY,_T("Flip Horizontally"), wxDefaultPosition, wxSize(200,35) );
633 wxButton *buttonFlipY = new wxButton(this,wxID_ANY,_T("Flip Vertically"), wxDefaultPosition, wxSize(200,35) );
635 wxString lstOptions[3];
636 lstOptions[0]=_T("Flip selected contours");
637 lstOptions[1]=_T("Flip all contours of actual slice");
638 lstOptions[2]=_T("Flip all contours");
639 _wichContoursRadioBox = new wxRadioBox(this, -1, _T("Transform"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions, 1, wxRA_SPECIFY_COLS);
640 _wichContoursRadioBox->SetSelection(2);
643 Connect( buttonFlipX->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipXPressed );
644 Connect( buttonFlipY->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipYPressed );
646 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
647 sizer -> Add( _wichContoursRadioBox, 1, wxGROW );
648 sizer -> Add( buttonFlipX, 1, wxGROW );
649 sizer -> Add( buttonFlipY, 1, wxGROW );
651 this->SetSizer( sizer );
652 this->SetAutoLayout( true );
659 interfFlipPanel::~interfFlipPanel(){
662 void interfFlipPanel::onFlipXPressed(wxCommandEvent& event)
664 std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipXPressed FlipX (btn)" << std::endl;
665 int typeContoursFlip = _wichContoursRadioBox->GetSelection();
666 interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 0 ); // type, direction
669 void interfFlipPanel::onFlipYPressed(wxCommandEvent& event)
671 std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipYPressed FlipY (btn)" << std::endl;
672 int typeContoursFlip = _wichContoursRadioBox->GetSelection();
673 interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 1 ); // type, direction