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 );
198 newstring.append(wxString(_wxtextctrlSpread->GetValue(),wxConvUTF8));
199 newstring.append(wxString(" ",wxConvUTF8));
200 newstring.append(wxString(val.c_str(),wxConvUTF8));
201 _wxtextctrlSpread->SetValue(newstring);
204 void interfSpreadPanel::setStringSpread(std::string stringtemp){
206 wxString newstring(stringtemp.c_str(),wxConvUTF8);
207 //_wxtextctrlSpread->SetEditable(true);
208 _staticTextSpread->SetLabel(newstring);
209 //_wxtextctrlSpread->SetEditable(false);
213 ** Begin of information panel
215 interfInformationPanel::interfInformationPanel(wxWindow * parent)
216 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
218 //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
219 wxString lstOptions[4];
220 lstOptions[0]=_T("Current Slice");
221 lstOptions[1]=_T("Range Slices");
222 // lstOptions[2]=_T("All Slices");
223 _informationRadiobox = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS);
226 wxString lstOptContOperation[5];
227 lstOptContOperation[0]=_T("AND");
228 lstOptContOperation[1]=_T("OR");
229 lstOptContOperation[2]=_T("XOR");
230 lstOptContOperation[3]=_T("ALL");
231 _radiolstboxContourGroup = new wxRadioBox(this, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation, 4, wxRA_SPECIFY_COLS);
232 _radiolstboxContourGroup->SetSelection(1);
233 Connect( _radiolstboxContourGroup->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &interfInformationPanel::onContourGroup );
236 _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") );
237 _XYZValues->SetValue(true);
239 _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") );
240 _contourImage->SetValue(true);
242 _statistics = new wxCheckBox(this, -1, _T("Save Statistics") );
243 _statistics->SetValue(true);
245 wxButton *informationContourLabelsBtn = new wxButton(this,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
246 informationContourLabelsBtn->SetEventHandler( this );
247 Connect( informationContourLabelsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onInformationContourLabels );
249 wxButton *statisticsContourBtn = new wxButton(this,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
250 statisticsContourBtn->SetEventHandler( this );
251 Connect( statisticsContourBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation );
253 wxButton *showResultImagesBtn = new wxButton(this,-1,_T("Show result images"),wxDefaultPosition, wxSize(140,35) );
254 showResultImagesBtn->SetEventHandler( this );
255 Connect( showResultImagesBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onShowResultImages );
258 wxButton *saveResultsBtn = new wxButton(this,-1,_T("Save Results"),wxDefaultPosition, wxSize(140,35) );
259 saveResultsBtn->SetEventHandler( this );
260 Connect( saveResultsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults );
263 int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
264 //_theViewPanel->getSceneManager()->GetImageDataSizeZ();
265 _mbarrangeSliceInformation = new mBarRange(this,65,65);
266 _mbarrangeSliceInformation->SetMin(0);
267 _mbarrangeSliceInformation->SetStart(0);
268 _mbarrangeSliceInformation-> SetOrientation( true );
269 _mbarrangeSliceInformation-> setActiveStateTo(true);
270 _mbarrangeSliceInformation-> setVisibleLabels( true );
271 _mbarrangeSliceInformation-> setDeviceEndMargin(10);
272 _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
273 _mbarrangeSliceInformation-> setDeviceBlitStart(10,10);
274 _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
275 _mbarrangeSliceInformation-> SetStart( 0 );
276 _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );
281 interfMainPanel::getInstance()->getImageRange(range);
283 int min = (int)floor (range[0]);
284 int max = (int)ceil (range[1]);
286 _mbarrangeRangeInformation = new mBarRange(this,65,65);
287 _mbarrangeRangeInformation->SetMin(0);
288 _mbarrangeRangeInformation->SetStart(0);
289 _mbarrangeRangeInformation->SetOrientation( true );
290 _mbarrangeRangeInformation->setActiveStateTo(true);
291 _mbarrangeRangeInformation->setVisibleLabels( true );
292 _mbarrangeRangeInformation->setDeviceEndMargin(10);
293 _mbarrangeRangeInformation->setRepresentedValues( min , max );
294 _mbarrangeRangeInformation->setDeviceBlitStart(10,10);
295 _mbarrangeRangeInformation->setIfWithActualDrawed( false );
296 _mbarrangeRangeInformation->SetStart( min );
297 _mbarrangeRangeInformation->SetEnd( max );
299 // _mbarrangeSliceInformation->PushEventHandler(this);
300 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
301 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
302 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
303 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
304 // Connect(_mbarrangeRangeInformation->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
305 Connect(_mbarrangeRangeInformation->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &interfInformationPanel::onRangeSliceInformation );
308 _staticTextInformation = new wxStaticText(this,-1,_T(" "));
310 _grid = new wxGrid( this,
313 wxSize( 200, 500 ) );
315 int i,gridCol=10,gridRow=sizeZ+2;
316 _grid->CreateGrid( 0, 0 );
317 _grid->AppendRows(gridRow);
318 _grid->AppendCols(gridCol);
320 for (i=0;i<gridRow;i++)
322 _grid->SetRowLabelValue(i, _T(" ") );
324 // _grid->SetColLabelSize(0);
327 FillGridWithContoursInformation();
329 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2);
330 sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: ")) , 1, wxGROW );
331 sizerSave->Add( _XYZValues, 1, wxALL, 2 );
332 sizerSave->Add( _statistics, 1, wxALL, 2 );
333 sizerSave->Add( _contourImage, 1, wxALL, 2 );
335 wxFlexGridSizer * sizerA = new wxFlexGridSizer(10);
336 sizerA->Add( _informationRadiobox, 1, wxALL, 2 );
337 sizerA->Add( _radiolstboxContourGroup, 1, wxALL, 2 );
338 sizerA->Add( sizerSave, 1, wxALL, 2 );
341 wxFlexGridSizer * sizerB = new wxFlexGridSizer(10);
342 sizerB->Add( informationContourLabelsBtn, 1, wxALL, 2 );
343 sizerB->Add( statisticsContourBtn, 1, wxALL, 2 );
344 sizerB->Add( showResultImagesBtn, 1, wxALL, 2 );
345 sizerB->Add( saveResultsBtn, 1, wxALL, 2 );
347 wxFlexGridSizer * sizer = new wxFlexGridSizer(1,8);
348 sizer->Add( sizerA , 1, wxALL , 0 );
349 sizer->Add( new wxStaticText(this ,-1,_T("Slice Range")) , 1, wxALL , 0 );
350 sizer->Add( _mbarrangeSliceInformation , 1, wxALL|wxGROW , 2 );
351 sizer->Add( new wxStaticText(this ,-1,_T("Gray Range")) , 1, wxALL , 0 );
352 sizer->Add( _mbarrangeRangeInformation , 1, wxALL|wxGROW , 2 );
353 sizer->Add( sizerB , 1, wxEXPAND , 0 );
354 sizer->Add( _staticTextInformation , 1, wxEXPAND , 0 );
355 sizer->Add( _grid , 1, wxEXPAND , 0 );
357 this->SetSizer( sizer );
358 this->SetSize( wxSize(1500,1500) );
359 //this->SetBackgroundColour( wxColour(100,100,100) );
360 this->SetAutoLayout( true );
365 interfInformationPanel::~interfInformationPanel()
370 void interfInformationPanel::onRangeSliceInformation(wxCommandEvent& event)
372 int grayRangeMin = _mbarrangeRangeInformation->GetStart();
373 int grayRangeMax = _mbarrangeRangeInformation->GetEnd();
374 interfMainPanel::getInstance()->SetScalarRange(grayRangeMin,grayRangeMax);
375 interfMainPanel::getInstance()->RefreshInterface();
379 void interfInformationPanel::onInformationContourLabels(wxCommandEvent& event){
381 FillGridWithContoursInformation();
385 void interfInformationPanel::onShowResultImages(wxCommandEvent& event)
387 // onExtractInformation( event );
388 int selection = _informationRadiobox->GetSelection();
389 int minZ = _mbarrangeSliceInformation->GetStart();
390 int maxZ = _mbarrangeSliceInformation->GetEnd();
391 int typeContourGroup = _radiolstboxContourGroup->GetSelection();
392 interfMainPanel::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
396 void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
400 int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
401 int selection = _informationRadiobox->GetSelection();
402 int minZ = _mbarrangeSliceInformation->GetStart();
403 int maxZ = _mbarrangeSliceInformation->GetEnd();
404 int grayRangeMin = _mbarrangeRangeInformation->GetStart();
405 int grayRangeMax = _mbarrangeRangeInformation->GetEnd();
407 interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ, grayRangeMin, grayRangeMax);
410 void interfInformationPanel::onSaveResults(wxCommandEvent& event)
412 wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxSAVE );
413 if (dialog.ShowModal() == wxID_OK)
415 onExtractInformation( event );
416 int selection = _informationRadiobox->GetSelection();
417 int minZ = _mbarrangeSliceInformation->GetStart();
418 int maxZ = _mbarrangeSliceInformation->GetEnd();
419 std::string directory = (const char *)(dialog.GetDirectory().mb_str());
420 std::string namefile = (const char *)(dialog.GetFilename().mb_str());
421 std::string filename = (const char *)(dialog.GetPath().mb_str() );
422 int typeContourGroup = _radiolstboxContourGroup->GetSelection();
423 interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename,
426 _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue());
430 void interfInformationPanel::FillGridWithContoursInformation(){
434 _grid->SetColLabelValue(0, _T("A") );
435 _grid->SetColLabelValue(1, _T("B") );
436 _grid->SetColLabelValue(2, _T("C") );
437 _grid->SetColLabelValue(3, _T("D") );
438 _grid->SetColLabelValue(4, _T("E") );
439 _grid->SetColLabelValue(5, _T("F") );
440 //_instantPanel->getInstant( tempVector );
442 int z,sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();//->getSceneManager()->GetImageDataSizeZ();
443 int ii,sizeLstContourThings;
444 for ( z=0 ; z<sizeZ ; z++)
447 std::vector<std::string> lstContourThings = interfMainPanel::getInstance()->getOutlinesName(z);
449 //this->_modelManager->getOutlinesAtInstant( &instant );
451 sizeLstContourThings = lstContourThings.size();
452 tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
453 _grid->SetRowLabelValue(z, tempString );
455 for (ii=0 ; ii<sizeLstContourThings ; ii++)
457 //ContourThing **contourthing = lstContourThings[ii];
458 //tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ;
459 tempString = wxString(lstContourThings[ii].c_str(),wxConvUTF8) ;
460 _grid->SetCellValue( z, ii, tempString );
465 _grid->SetRowLabelValue(sizeZ, _T(" ") );
466 for (ii=0 ; ii<sizeLstContourThings ; ii++)
468 _grid->SetCellValue( sizeZ, ii, _T(" ") );
473 void interfInformationPanel::setStringInfoPanel(wxString tmpString){
474 _staticTextInformation->SetLabel(tmpString);
477 void interfInformationPanel::setRowLabelInfoPanel(int z,wxString tempString){
478 _grid->SetRowLabelValue(z, tempString );
481 int interfInformationPanel::getNumberCols(){
482 return _grid->GetNumberCols();
485 void interfInformationPanel::appendCols(int numcols){
486 _grid->AppendCols(numcols);
489 void interfInformationPanel::setCellValue(int z,int tmpIntA,wxString tempString){
490 _grid->SetCellValue( z, tmpIntA , tempString );
493 void interfInformationPanel::setColLabel(int tmpIntB,wxString tmpTitleString){
494 _grid->SetColLabelValue(tmpIntB, tmpTitleString);
497 wxString interfInformationPanel::getCellValue(int j,int i){
498 return _grid->GetCellValue( j , i );
501 void interfInformationPanel::onContourGroup(wxCommandEvent& event)
503 printf("EED interfInformationPanel::onContourGroup \n");
504 int contourGroup=_radiolstboxContourGroup->GetSelection();
509 interfMainPanel::getInstance()->SetContourGroup( _radiolstboxContourGroup->GetSelection() );
512 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
513 interfCalibrationPanel:: interfCalibrationPanel(wxWindow * parent)
514 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
517 interfMainPanel::getInstance()->getImageRange(range);
523 options[2]=_T("inch");
525 _unitsRadiobox = new wxRadioBox(this, -1, _T("Unit of measurement"), wxPoint(2, 25), wxSize(145,45), 3 , options, 3, wxRA_SPECIFY_COLS);
526 _unitsRadiobox->SetSelection(0);
529 new wxStaticText(this, wxID_ANY, wxT("Real Size: "), wxPoint(2, 5));
532 _size = new wxTextCtrl(this, wxID_ANY, wxT(""), wxPoint(78,3), wxSize(70, 20), 0, wxDefaultValidator, wxTextCtrlNameStr);
535 new wxButton(this, 1, wxT("Calibrate"), wxPoint(78, 70), wxSize(70, 25), 0, wxDefaultValidator, wxT("button"));
537 //Conexion del boton con su respectivo manejador
538 Connect(1, wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &interfCalibrationPanel::onCalibrate);
542 interfCalibrationPanel:: ~interfCalibrationPanel()
546 void interfCalibrationPanel::onCalibrate(wxCommandEvent& event)
548 wxString size =_size->GetValue();
549 int unit = _unitsRadiobox->GetSelection();
550 interfMainPanel::getInstance()->onCalibration(size, unit);
552 //------------------------------------------------------------------------------------------------------------
556 //////////////////////////////////////////////////////////////
558 interfFlipPanel::interfFlipPanel(wxWindow* parent)
559 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
561 wxButton *buttonFlipX = new wxButton(this,wxID_ANY,_T("Flip Horizontally"), wxDefaultPosition, wxSize(200,35) );
562 wxButton *buttonFlipY = new wxButton(this,wxID_ANY,_T("Flip Vertically"), wxDefaultPosition, wxSize(200,35) );
564 wxString lstOptions[3];
565 lstOptions[0]=_T("Flip selected contours");
566 lstOptions[1]=_T("Flip all contours of actual slice");
567 lstOptions[2]=_T("Flip all contours");
568 _wichContoursRadioBox = new wxRadioBox(this, -1, _T("Transform"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions, 1, wxRA_SPECIFY_COLS);
569 _wichContoursRadioBox->SetSelection(2);
572 Connect( buttonFlipX->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipXPressed );
573 Connect( buttonFlipY->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipYPressed );
575 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
576 sizer -> Add( _wichContoursRadioBox, 1, wxGROW );
577 sizer -> Add( buttonFlipX, 1, wxGROW );
578 sizer -> Add( buttonFlipY, 1, wxGROW );
580 this->SetSizer( sizer );
581 this->SetAutoLayout( true );
588 interfFlipPanel::~interfFlipPanel(){
591 void interfFlipPanel::onFlipXPressed(wxCommandEvent& event)
593 std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipXPressed FlipX (btn)" << std::endl;
594 int typeContoursFlip = _wichContoursRadioBox->GetSelection();
595 interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 0 ); // type, direction
598 void interfFlipPanel::onFlipYPressed(wxCommandEvent& event)
600 std::cout << "interfToolsPanels.cxx interfFlipPanel::onFlipYPressed FlipY (btn)" << std::endl;
601 int typeContoursFlip = _wichContoursRadioBox->GetSelection();
602 interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 1 ); // type, direction