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 Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour);
58 Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour);
60 Connect( _brithtnessWindowLevel->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
61 Connect( _brithtnessWindowLevel->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
62 Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
63 Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
64 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnInterpolation);
66 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
67 sizer -> Add( new wxStaticText(this,-1, _T("Contour width")) , 1, wxGROW );
68 sizer -> Add( _withOfContourLine , 1, wxGROW );
69 sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
70 sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
71 sizer -> Add( new wxStaticText(this,-1, _T("Brightness of the image")) , 1, wxGROW );
72 sizer -> Add( new wxStaticText(this,-1, _T("--Window level--")) , 1, wxGROW );
73 sizer -> Add( _brithtnessWindowLevel , 1, wxGROW );
74 sizer -> Add( new wxStaticText(this,-1, _T("--Color level--")) , 1, wxGROW );
75 sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
76 sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
77 sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
78 sizer -> Add( _interpolationCheckBox , 1, wxGROW );
80 this->SetSizer( sizer );
82 //panel->SetSize( sizepanel );
84 this->SetAutoLayout( true );
90 interfConfigurationPanel::~interfConfigurationPanel()
94 void interfConfigurationPanel::onWidthOfContour(wxScrollEvent& event){
96 double width = (double)_withOfContourLine->GetValue() / 2.0;
97 interfMainPanel::getInstance()->onWidthOfContour(width);
100 void interfConfigurationPanel::onBrigthnessColorWindowLevel(wxScrollEvent& event){
101 int colorwindow = _brithtnessColorLevel->GetValue();
102 int windowlevel = _brithtnessWindowLevel->GetValue();
104 interfMainPanel::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
108 void interfConfigurationPanel::OnInterpolation(wxCommandEvent& event)
111 interfMainPanel::getInstance()->onInterpolation(_interpolationCheckBox->GetValue());
117 ** Begin of the spread panel
120 interfSpreadPanel::interfSpreadPanel(wxWindow* parent)
121 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
124 //wxPanel *panel = new wxPanel(parent,-1);
126 //_contourPropagation = new ContourPropagation();
128 //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString("",wxConvUTF8));
130 wxButton *spreadResetBtn = new wxButton(this,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize );
131 wxButton *spreadAddBtn = new wxButton(this,-1,_T("Add key contour "),wxDefaultPosition, wxDefaultSize);
132 wxButton *spreadAddAllBtn = new wxButton(this,-1,_T("Add All to key contour"),wxDefaultPosition, wxDefaultSize);
134 wxString lstOptions[3];
135 lstOptions[0]=_T("A");
136 lstOptions[1]=_T("B");
137 lstOptions[2]=_T("C");
138 _spreadMethodRadiobox = new wxRadioBox(this, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions, 3, wxRA_SPECIFY_COLS);
139 _spreadMethodRadiobox->SetSelection(2);
141 wxButton *spreadGoBtn = new wxButton(this,-1,_T("Go"),wxDefaultPosition, wxDefaultSize);
142 _staticTextSpread = new wxStaticText(this,-1,_T(" "));
144 _wxtextctrlSpread = new wxTextCtrl(this,-1, _T(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
145 _wxtextctrlSpread->SetEditable(false);
147 Connect( spreadResetBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadReset );
148 Connect( spreadAddBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAdd );
149 Connect( spreadAddAllBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAddAll );
150 Connect( spreadGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadGo );
152 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
153 sizer -> Add( spreadResetBtn , 1, wxGROW );
154 sizer -> Add( spreadAddBtn , 1, wxGROW );
155 sizer -> Add( spreadAddAllBtn , 1, wxGROW );
156 sizer -> Add( _spreadMethodRadiobox , 1, wxGROW );
157 sizer -> Add( spreadGoBtn , 1, wxGROW );
158 sizer -> Add( _staticTextSpread , 1, wxGROW );
159 sizer -> Add( _wxtextctrlSpread , 1, wxGROW );
162 this->SetSizer( sizer );
163 //this->SetSize( wxDefaultSize );
164 this->SetAutoLayout( true );
169 interfSpreadPanel::~interfSpreadPanel(){
172 void interfSpreadPanel::onSpreadReset(wxCommandEvent& event){
173 setStringSpread(" ");
174 _wxtextctrlSpread->SetValue(wxString("",wxConvUTF8));
175 interfMainPanel::getInstance()->resetAppend();
178 void interfSpreadPanel::onSpreadAdd(wxCommandEvent& event){
179 interfMainPanel::getInstance()->onSpreadAdd();
182 void interfSpreadPanel::onSpreadAddAll(wxCommandEvent& event){
183 interfMainPanel::getInstance()->onSpreadAddAll();
186 void interfSpreadPanel::onSpreadGo(wxCommandEvent& event){
187 setStringSpread(" ");
188 int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
189 printf("EED interfSpreadPanel::onSpreadGo %d\n",typeMethodFindCtrlPoints);
190 interfMainPanel::getInstance()->onSpreadGo(typeMethodFindCtrlPoints);
194 void interfSpreadPanel::appendStringSpread(std::string val){
197 //newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
199 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
200 #if wxMAJOR_VERSION <= 2
201 newstring.append(wxString(_wxtextctrlSpread->GetValue(),wxConvUTF8));
203 newstring.append( _wxtextctrlSpread->GetValue() );
207 newstring.append(wxString(" ",wxConvUTF8));
208 newstring.append(wxString(val.c_str(),wxConvUTF8));
209 _wxtextctrlSpread->SetValue(newstring);
212 void interfSpreadPanel::setStringSpread(std::string stringtemp){
214 wxString newstring(stringtemp.c_str(),wxConvUTF8);
215 //_wxtextctrlSpread->SetEditable(true);
216 _staticTextSpread->SetLabel(newstring);
217 //_wxtextctrlSpread->SetEditable(false);
221 ** Begin of information panel
223 interfInformationPanel::interfInformationPanel(wxWindow * parent)
224 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
226 //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
227 wxString lstOptions[4];
228 lstOptions[0]=_T("Current Slice");
229 lstOptions[1]=_T("Range Slices");
230 // lstOptions[2]=_T("All Slices");
231 _informationRadiobox = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS);
234 wxString lstOptContOperation[5];
235 lstOptContOperation[0]=_T("AND");
236 lstOptContOperation[1]=_T("OR");
237 lstOptContOperation[2]=_T("XOR");
238 lstOptContOperation[3]=_T("ALL");
239 _radiolstboxContourGroup = new wxRadioBox(this, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation, 4, wxRA_SPECIFY_COLS);
240 _radiolstboxContourGroup->SetSelection(1);
241 Connect( _radiolstboxContourGroup->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &interfInformationPanel::onContourGroup );
244 _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") );
245 _XYZValues->SetValue(true);
247 _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") );
248 _contourImage->SetValue(true);
250 _statistics = new wxCheckBox(this, -1, _T("Save Statistics") );
251 _statistics->SetValue(true);
253 wxButton *informationContourLabelsBtn = new wxButton(this,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
254 informationContourLabelsBtn->SetEventHandler( this );
255 Connect( informationContourLabelsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onInformationContourLabels );
257 wxButton *statisticsContourBtn = new wxButton(this,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
258 statisticsContourBtn->SetEventHandler( this );
259 Connect( statisticsContourBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation );
261 wxButton *showResultImagesBtn = new wxButton(this,-1,_T("Show result images"),wxDefaultPosition, wxSize(140,35) );
262 showResultImagesBtn->SetEventHandler( this );
263 Connect( showResultImagesBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onShowResultImages );
266 wxButton *saveResultsBtn = new wxButton(this,-1,_T("Save Results"),wxDefaultPosition, wxSize(140,35) );
267 saveResultsBtn->SetEventHandler( this );
268 Connect( saveResultsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults );
271 int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
272 //_theViewPanel->getSceneManager()->GetImageDataSizeZ();
273 _mbarrangeSliceInformation = new mBarRange(this,65,65);
274 _mbarrangeSliceInformation->SetMin(0);
275 _mbarrangeSliceInformation->SetStart(0);
276 _mbarrangeSliceInformation-> SetOrientation( true );
277 _mbarrangeSliceInformation-> setActiveStateTo(true);
278 _mbarrangeSliceInformation-> setVisibleLabels( true );
279 _mbarrangeSliceInformation-> setDeviceEndMargin(10);
280 _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
281 _mbarrangeSliceInformation-> setDeviceBlitStart(10,10);
282 _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
283 _mbarrangeSliceInformation-> SetStart( 0 );
284 _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );
289 interfMainPanel::getInstance()->getImageRange(range);
291 int min = (int)floor (range[0]);
292 int max = (int)ceil (range[1]);
294 _mbarrangeRangeInformation = new mBarRange(this,65,65);
295 _mbarrangeRangeInformation->SetMin(0);
296 _mbarrangeRangeInformation->SetStart(0);
297 _mbarrangeRangeInformation->SetOrientation( true );
298 _mbarrangeRangeInformation->setActiveStateTo(true);
299 _mbarrangeRangeInformation->setVisibleLabels( true );
300 _mbarrangeRangeInformation->setDeviceEndMargin(10);
301 _mbarrangeRangeInformation->setRepresentedValues( min , max );
302 _mbarrangeRangeInformation->setDeviceBlitStart(10,10);
303 _mbarrangeRangeInformation->setIfWithActualDrawed( false );
304 _mbarrangeRangeInformation->SetStart( min );
305 _mbarrangeRangeInformation->SetEnd( max );
307 // _mbarrangeSliceInformation->PushEventHandler(this);
308 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
309 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
310 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
311 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
312 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
313 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
316 _staticTextInformation = new wxStaticText(this,-1,_T(" "));
318 _grid = new wxGrid( this,
321 wxSize( 200, 500 ) );
323 int i,gridCol=10,gridRow=sizeZ+2;
324 _grid->CreateGrid( 0, 0 );
325 _grid->AppendRows(gridRow);
326 _grid->AppendCols(gridCol);
328 for (i=0;i<gridRow;i++)
330 _grid->SetRowLabelValue(i, _T(" ") );
332 // _grid->SetColLabelSize(0);
335 FillGridWithContoursInformation();
337 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
338 #if wxMAJOR_VERSION <= 2
339 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2);
341 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2);
343 sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: ")) , 1, wxGROW );
344 sizerSave->Add( _XYZValues, 1, wxALL, 2 );
345 sizerSave->Add( _statistics, 1, wxALL, 2 );
346 sizerSave->Add( _contourImage, 1, wxALL, 2 );
348 wxFlexGridSizer * sizerA = new wxFlexGridSizer(10);
349 sizerA->Add( _informationRadiobox, 1, wxALL, 2 );
350 sizerA->Add( _radiolstboxContourGroup, 1, wxALL, 2 );
351 sizerA->Add( sizerSave, 1, wxALL, 2 );
354 wxFlexGridSizer * sizerB = new wxFlexGridSizer(10);
355 sizerB->Add( informationContourLabelsBtn, 1, wxALL, 2 );
356 sizerB->Add( statisticsContourBtn, 1, wxALL, 2 );
357 sizerB->Add( showResultImagesBtn, 1, wxALL, 2 );
358 sizerB->Add( saveResultsBtn, 1, wxALL, 2 );
360 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
361 #if wxMAJOR_VERSION <= 2
362 wxFlexGridSizer * sizer = new wxFlexGridSizer(1,8);
364 wxFlexGridSizer * sizer = new wxFlexGridSizer(8);
366 sizer->Add( sizerA , 1, wxALL , 0 );
367 sizer->Add( new wxStaticText(this ,-1,_T("Slice Range")) , 1, wxALL , 0 );
368 sizer->Add( _mbarrangeSliceInformation , 1, wxALL|wxGROW , 2 );
369 sizer->Add( new wxStaticText(this ,-1,_T("Gray Range")) , 1, wxALL , 0 );
370 sizer->Add( _mbarrangeRangeInformation , 1, wxALL|wxGROW , 2 );
371 sizer->Add( sizerB , 1, wxEXPAND , 0 );
372 sizer->Add( _staticTextInformation , 1, wxEXPAND , 0 );
373 sizer->Add( _grid , 1, wxEXPAND , 0 );
375 this->SetSizer( sizer );
376 this->SetSize( wxSize(1500,1500) );
377 //this->SetBackgroundColour( wxColour(100,100,100) );
378 this->SetAutoLayout( true );
383 interfInformationPanel::~interfInformationPanel()
388 void interfInformationPanel::onRangeSliceInformation(wxCommandEvent& event)
390 int grayRangeMin = _mbarrangeRangeInformation->GetStart();
391 int grayRangeMax = _mbarrangeRangeInformation->GetEnd();
392 interfMainPanel::getInstance()->SetScalarRange(grayRangeMin,grayRangeMax);
393 interfMainPanel::getInstance()->RefreshInterface();
397 void interfInformationPanel::onInformationContourLabels(wxCommandEvent& event){
399 FillGridWithContoursInformation();
403 void interfInformationPanel::onShowResultImages(wxCommandEvent& event)
405 // onExtractInformation( event );
406 int selection = _informationRadiobox->GetSelection();
407 int minZ = _mbarrangeSliceInformation->GetStart();
408 int maxZ = _mbarrangeSliceInformation->GetEnd();
409 int typeContourGroup = _radiolstboxContourGroup->GetSelection();
410 interfMainPanel::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
414 void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
418 int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
419 int selection = _informationRadiobox->GetSelection();
420 int minZ = _mbarrangeSliceInformation->GetStart();
421 int maxZ = _mbarrangeSliceInformation->GetEnd();
422 int grayRangeMin = _mbarrangeRangeInformation->GetStart();
423 int grayRangeMax = _mbarrangeRangeInformation->GetEnd();
425 interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ, grayRangeMin, grayRangeMax);
428 void interfInformationPanel::onSaveResults(wxCommandEvent& event)
430 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
431 #if wxMAJOR_VERSION <= 2
432 wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxSAVE );
434 wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxFD_SAVE );
436 if (dialog.ShowModal() == wxID_OK)
438 onExtractInformation( event );
439 int selection = _informationRadiobox->GetSelection();
440 int minZ = _mbarrangeSliceInformation->GetStart();
441 int maxZ = _mbarrangeSliceInformation->GetEnd();
442 std::string directory = (const char *)(dialog.GetDirectory().mb_str());
443 std::string namefile = (const char *)(dialog.GetFilename().mb_str());
444 std::string filename = (const char *)(dialog.GetPath().mb_str() );
445 int typeContourGroup = _radiolstboxContourGroup->GetSelection();
446 interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename,
449 _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue());
453 void interfInformationPanel::FillGridWithContoursInformation(){
457 _grid->SetColLabelValue(0, _T("A") );
458 _grid->SetColLabelValue(1, _T("B") );
459 _grid->SetColLabelValue(2, _T("C") );
460 _grid->SetColLabelValue(3, _T("D") );
461 _grid->SetColLabelValue(4, _T("E") );
462 _grid->SetColLabelValue(5, _T("F") );
463 //_instantPanel->getInstant( tempVector );
465 int z,sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();//->getSceneManager()->GetImageDataSizeZ();
466 int ii,sizeLstContourThings;
467 for ( z=0 ; z<sizeZ ; z++)
470 std::vector<std::string> lstContourThings = interfMainPanel::getInstance()->getOutlinesName(z);
472 //this->_modelManager->getOutlinesAtInstant( &instant );
474 sizeLstContourThings = lstContourThings.size();
475 tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
476 _grid->SetRowLabelValue(z, tempString );
478 for (ii=0 ; ii<sizeLstContourThings ; ii++)
480 //ContourThing **contourthing = lstContourThings[ii];
481 //tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ;
482 tempString = wxString(lstContourThings[ii].c_str(),wxConvUTF8) ;
483 _grid->SetCellValue( z, ii, tempString );
488 _grid->SetRowLabelValue(sizeZ, _T(" ") );
489 for (ii=0 ; ii<sizeLstContourThings ; ii++)
491 _grid->SetCellValue( sizeZ, ii, _T(" ") );
496 void interfInformationPanel::setStringInfoPanel(wxString tmpString){
497 _staticTextInformation->SetLabel(tmpString);
500 void interfInformationPanel::setRowLabelInfoPanel(int z,wxString tempString){
501 _grid->SetRowLabelValue(z, tempString );
504 int interfInformationPanel::getNumberCols(){
505 return _grid->GetNumberCols();
508 void interfInformationPanel::appendCols(int numcols){
509 _grid->AppendCols(numcols);
512 void interfInformationPanel::setCellValue(int z,int tmpIntA,wxString tempString){
513 _grid->SetCellValue( z, tmpIntA , tempString );
516 void interfInformationPanel::setColLabel(int tmpIntB,wxString tmpTitleString){
517 _grid->SetColLabelValue(tmpIntB, tmpTitleString);
520 wxString interfInformationPanel::getCellValue(int j,int i){
521 return _grid->GetCellValue( j , i );
524 void interfInformationPanel::onContourGroup(wxCommandEvent& event)
526 printf("EED interfInformationPanel::onContourGroup \n");
527 int contourGroup=_radiolstboxContourGroup->GetSelection();
532 interfMainPanel::getInstance()->SetContourGroup( _radiolstboxContourGroup->GetSelection() );
535 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
536 interfCalibrationPanel:: interfCalibrationPanel(wxWindow * parent)
537 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
540 interfMainPanel::getInstance()->getImageRange(range);
546 options[2]=_T("inch");
548 _unitsRadiobox = new wxRadioBox(this, -1, _T("Unit of measurement"), wxPoint(2, 25), wxSize(145,45), 3 , options, 3, wxRA_SPECIFY_COLS);
549 _unitsRadiobox->SetSelection(0);
552 new wxStaticText(this, wxID_ANY, wxT("Real Size: "), wxPoint(2, 5));
555 _size = new wxTextCtrl(this, wxID_ANY, wxT(""), wxPoint(78,3), wxSize(70, 20), 0, wxDefaultValidator, wxTextCtrlNameStr);
558 new wxButton(this, 1, wxT("Calibrate"), wxPoint(78, 70), wxSize(70, 25), 0, wxDefaultValidator, wxT("button"));
560 //Conexion del boton con su respectivo manejador
561 Connect(1, wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &interfCalibrationPanel::onCalibrate);
565 interfCalibrationPanel:: ~interfCalibrationPanel()
569 void interfCalibrationPanel::onCalibrate(wxCommandEvent& event)
571 wxString size =_size->GetValue();
572 int unit = _unitsRadiobox->GetSelection();
573 interfMainPanel::getInstance()->onCalibration(size, unit);
575 //------------------------------------------------------------------------------------------------------------
579 //////////////////////////////////////////////////////////////
581 interfFlipPanel::interfFlipPanel(wxWindow* parent)
582 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
584 wxButton *buttonFlipX = new wxButton(this,wxID_ANY,_T("Flip Horizontally"), wxDefaultPosition, wxSize(200,35) );
585 wxButton *buttonFlipY = new wxButton(this,wxID_ANY,_T("Flip Vertically"), wxDefaultPosition, wxSize(200,35) );
587 wxString lstOptions[3];
588 lstOptions[0]=_T("Flip selected contours");
589 lstOptions[1]=_T("Flip all contours of actual slice");
590 lstOptions[2]=_T("Flip all contours");
591 _wichContoursRadioBox = new wxRadioBox(this, -1, _T("Transform"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions, 1, wxRA_SPECIFY_COLS);
592 _wichContoursRadioBox->SetSelection(2);
595 Connect( buttonFlipX->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipXPressed );
596 Connect( buttonFlipY->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipYPressed );
598 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
599 sizer -> Add( _wichContoursRadioBox, 1, wxGROW );
600 sizer -> Add( buttonFlipX, 1, wxGROW );
601 sizer -> Add( buttonFlipY, 1, wxGROW );
603 this->SetSizer( sizer );
604 this->SetAutoLayout( true );
611 interfFlipPanel::~interfFlipPanel(){
614 void interfFlipPanel::onFlipXPressed(wxCommandEvent& event)
616 std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipXPressed FlipX (btn)" << std::endl;
617 int typeContoursFlip = _wichContoursRadioBox->GetSelection();
618 interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 0 ); // type, direction
621 void interfFlipPanel::onFlipYPressed(wxCommandEvent& event)
623 std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipYPressed FlipY (btn)" << std::endl;
624 int typeContoursFlip = _wichContoursRadioBox->GetSelection();
625 interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 1 ); // type, direction