]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.cxx
85%
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourEventHandler.cxx
index ace7008429f3afb300c918ad02c90dc04b527e5c..e53cf8723ecf1c0548232427983564e4c091fe6b 100644 (file)
@@ -1,6 +1,6 @@
 
 
-/*  Diagrama de Secuencia de cambiar un instante
+/*  Diagrama de Secuaencia de cambiar un instante
 wxContourEventHandler :: changeInstant()
        OutlineModelManager :: ->setInstant( _actualInstant );
                OutlineModelManager :: updateToActualInstant()
@@ -84,7 +84,7 @@ digraph example_0 {
 // Includes
 //------------------------------------------------------------------------------------------------------------
 
-#include "wxContour_ActionCommandsID.h"
+#include "wxContour_ActionCommnadsID.h"
 #include "NameWrapper.h"
 #include "ConceptDataWrap.h"
 #include "OutlineGroup.h"
@@ -103,7 +103,6 @@ digraph example_0 {
 #include <vtkImageMapToWindowLevelColors.h>
 
 
-
 //------------------------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------------------------
@@ -119,9 +118,9 @@ PanelBullEyeOptions::PanelBullEyeOptions (wxWindow * parent, wxSize size) :
 
 
        wxString lstOptions[2];
-       lstOptions[0]=_T("General options");
-       lstOptions[1]=_T("Detail options");
-       _radioboxBullEyeGenOpt  = new wxRadioBox(panel, -1, _T("General/Detail options"), wxDefaultPosition, wxSize(200,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
+       lstOptions[0]= wxString("General options",wxConvUTF8);
+       lstOptions[1]= wxString("Detail options",wxConvUTF8);
+       _radioboxBullEyeGenOpt  = new wxRadioBox(panel, -1, wxString("General/Detail options",wxConvUTF8), wxDefaultPosition, wxSize(200,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
        _radioboxBullEyeGenOpt->SetSelection(0);
 
        _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) );
@@ -369,10 +368,7 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
                inundo = 0;
                inredo = 0;
                stundoredo = "data/temp";
-               char buff[3000]; // hope it's enough!
-               sprintf(buff, "mkdir %s;",stundoredo.c_str());
-               system(buff); 
-               //mkdir(stundoredo.c_str());
+               mkdir(stundoredo.c_str(),755);
                stundoredo += "/cont";
        }
        //------------------------------------------------------------------------------------------------------------
@@ -521,7 +517,7 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
 
        void wxContourEventHandler::onSpreadReset( wxCommandEvent& event )
        {
-               _wxtextctrlSpread->SetValue(_T(""));
+               _wxtextctrlSpread->SetValue(wxString("",wxConvUTF8));
                _contourPropagation->resetAppend();
        }
 
@@ -545,13 +541,16 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
 
                        _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
                        wxString newstring;
-                       newstring.Printf(_T("%s %d -"),
-                                        _wxtextctrlSpread->GetValue().c_str(),
-                                        actualSlice );
+                       //newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
+                       newstring.append(wxString(_wxtextctrlSpread->GetValue(),wxConvUTF8));
+                       newstring.append(wxString(" ",wxConvUTF8));
+                       newstring.append(wxString(intToString(actualSlice).c_str(),wxConvUTF8));
                        _wxtextctrlSpread->SetValue(newstring);
                } // if 
        }
 
+       
+
        //------------------------------------------------------------------------------------------------------------
        void wxContourEventHandler::onSpreadGo( wxCommandEvent& event )
        {
@@ -589,7 +588,11 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
                for ( z=(int)minZ ; z<=(int)maxZ ; z++ )
                {
                        porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf( _T(" %d %c            %d/%d            %d"), (int)porcent , 37 , (int)(z-minZ+1), (int)totalZ,z );
+                       int numero = (int)(z-minZ+1)/(int)totalZ;
+                       std::string stringtemp = "  "+intToString(porcent)+"%            "+intToString(numero)+"            "+intToString(z);
+                       tmpString.Append(wxString(stringtemp.c_str(),wxConvUTF8));
+
+                       //tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , (int)(z-minZ+1), (int)totalZ,z );
                        _staticTextSpread->SetLabel(tmpString);
 
                        if (_contourPropagation->ifSliceKeyContourExist(z)==false)
@@ -632,7 +635,7 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
                                } // if addedModel
                        }// ifSliceKeyContourExist
                } // for z
-               _staticTextSpread->SetLabel(_T("   "));
+               _staticTextSpread->SetLabel(wxString("   ",wxConvUTF8));
                //RefreshInterface();
 
 
@@ -703,7 +706,7 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
 
                _contourPropagation                     = new ContourPropagation();
 
-               wxPanel *panel                          = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, /*wxString("")*/  _T("") );
+               wxPanel *panel                                                  = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString("",wxConvUTF8));
 
                wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize );
                wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxDefaultSize);
@@ -712,13 +715,13 @@ double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
                lstOptions[0]=_T("A");
                lstOptions[1]=_T("B");
                lstOptions[2]=_T("C");
-               _spreadMethodRadiobox           = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+               _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
                _spreadMethodRadiobox->SetSelection(2);
 
                wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxDefaultSize);
                _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
 
-               _wxtextctrlSpread           = new wxTextCtrl(panel,-1, _T("") ,wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
+               _wxtextctrlSpread           = new wxTextCtrl(panel,-1, _T(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
 
                
                Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
@@ -1051,7 +1054,7 @@ myfile.close();
                lstOptions[0]=_T("A");
                lstOptions[1]=_T("B");
                lstOptions[2]=_T("C");
-               methodRadiobox                                  = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+               methodRadiobox                                          = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
                methodRadiobox->SetSelection(2);
                _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
 
@@ -1109,7 +1112,7 @@ myfile.close();
                        wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
                        wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
                        wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("GoA"),wxDefaultPosition, wxSize(80,35));
-                       _wxtextctrlTest                 = new wxTextCtrl(panel,-1, _T(""),wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
+                       _wxtextctrlTest                         = new wxTextCtrl(panel,-1, _T(""),wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
 
                        _TestFrame->SetEventHandler( this );
                        Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestReset ); 
@@ -1162,15 +1165,12 @@ myfile.close();
                        } // for
 
                        _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
-                       wxString newstring1( _wxtextctrlTest->GetValue().c_str() , wxConvUTF8);
-                       wxString newstring2;
-                       newstring2.Printf(_T(" %d -"), actualSlice );
-                       
                        wxString newstring;
-                       newstring = newstring1+newstring2;
-                       
-                       //newstring.Printf("%s %d -",_wxtextctrlTest->GetValue(), actualSlice );
-                       
+                       newstring.append(_wxtextctrlTest->GetValue());
+                       newstring.append(_T(" "));
+                       newstring.append(wxString(intToString(actualSlice).c_str(),wxConvUTF8));                        
+                       //newstring.Printf(_T("%s %d -"),,  );
+                       newstring.append(_T(" -"));
                        _wxtextctrlTest->SetValue(newstring);
                } // if 
        }
@@ -1256,6 +1256,7 @@ myfile.close();
        //------------------------------------------------------------------------------------------------------------
        void wxContourEventHandler::FillGridWithContoursInformation()
        {
+               wxString tempString;
                _grid->ClearGrid();
                _grid->SetColLabelValue(0, _T("A") );
                _grid->SetColLabelValue(1, _T("B") );
@@ -1276,19 +1277,14 @@ myfile.close();
                        std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
 
                        sizeLstContourThings = lstContourThings.size();
-                       wxString tempString;
-                       tempString.Printf(_T("%d - %d"),
-                                         z, 
-                                         sizeLstContourThings);
-
+                       tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
                        _grid->SetRowLabelValue(z, tempString );
 
                        for (ii=0 ; ii<sizeLstContourThings ; ii++)
                        {
                                ContourThing **contourthing = lstContourThings[ii];
-                               //wxString tempString =  (*contourthing)->getName()  ;  // Doesn't compile. See Creatis Wiki !
-                               const wxString tempString2((*contourthing)->getName().c_str(),wxConvUTF8 );
-                               _grid->SetCellValue( z, ii, tempString2 );
+                               tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ;
+                               _grid->SetCellValue( z, ii, tempString );
                        }
                }
 
@@ -1536,7 +1532,9 @@ myfile.close();
                {
 
                        porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("Saving Values  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       
+                       tmpString.Printf(_T("Saving Values"));
+                       tmpString.Printf(_T("  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
                        _staticTextInformation->SetLabel(tmpString);
 
 
@@ -1588,7 +1586,14 @@ myfile.close();
                                                                                                                        &pLstValuePosZ);
 
                                wxString filename;
-                               filename.Printf(_T("%s\\%s-slice%d-cont%d.txt"),directory.c_str(),namefile.c_str(),z,iContourGroup);
+                               filename.Printf(_T("%s"),directory.c_str());
+                               filename.Printf(_T("\\"));
+                               filename.Printf(_T("%s"),namefile.c_str());
+                               filename.Printf(_T("-slice"));
+                               filename.Printf(_T("%d"),z);
+                               filename.Printf(_T("-cont"));
+                               filename.Printf(_T("%d"),iContourGroup);
+                               filename.Printf(_T(".txt"));
                                FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
                                fprintf(pFile,"value \t x \t y \t z\n"  );
                                int iLstValue,sizeLstValue=pLstValue.size();
@@ -1646,7 +1651,8 @@ myfile.close();
                {
 
                        porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("Saving Values  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       tmpString.Printf(_T("Saving Values"));
+                       tmpString.Printf(_T("%d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
                        _staticTextInformation->SetLabel(tmpString);
 
                        //Extraction data from contours of each slice
@@ -1700,7 +1706,11 @@ myfile.close();
 
 
                wxString filename;
-               filename.Printf(_T("%s\\%s-Value.mhd"),directory.c_str(),namefile.c_str(),z);
+               //filename.Printf(_T("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z);
+               filename.Printf(_T("%s"),directory.c_str());
+               filename.Printf(_T("\\"));
+               filename.Printf(_T("%s"),namefile.c_str());
+               filename.Printf(_T("-Value.mhd"));
 
 // Image Value
                vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
@@ -1710,7 +1720,11 @@ myfile.close();
                writerValueImage->Write( );
 
 // Image Mask
-               filename.Printf(_T("%s\\%s-Mask.mhd"),directory.c_str(),namefile.c_str(),z);
+               //              filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z);
+               filename.Printf(_T("%s"),directory.c_str());
+               filename.Printf(_T("\\"));
+               filename.Printf(_T("%s"),namefile.c_str());
+               filename.Printf(_T("-Mask.mhd"));
                vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
                writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
                writerMaskImage->SetFileName( (const char *)filename.mb_str() );
@@ -1755,7 +1769,7 @@ myfile.close();
                        int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
                        for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
                        {
-                               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle, tmpString.c_str() );
+                               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.char_str() );
                        }
                        fprintf(pFile,"\n" );
 
@@ -2084,7 +2098,7 @@ myfile.close();
                std::vector<int> tempVector;
                _instantPanel->getInstant( tempVector );
         _performingOperation->reset();
-               _performingOperation->setStartCommand( (char)wxContour_ActionCommandsID::COPY_TOOL );
+               _performingOperation->setStartCommand( (char)wxContour_ActionCommnadsID::COPY_TOOL );
                _performingOperation->setStartOperationInstantVector( tempVector );
                _performingOperation->setKeyNamesOperationElems( keyNamesVector );
 
@@ -2093,7 +2107,7 @@ myfile.close();
        void wxContourEventHandler :: onPasteOutlines( )
        {
                char theStartCommand = _performingOperation->getStartCommand();
-               if (  theStartCommand == wxContour_ActionCommandsID::COPY_TOOL )
+               if (  theStartCommand == wxContour_ActionCommnadsID::COPY_TOOL )
                {
                        //JCP 20-10-08 Undo redo implementation
                        saveState();
@@ -2179,7 +2193,7 @@ myfile.close();
        }
 
        //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteContours( std::vector<std::string> & keyNamesVector )
+       void wxContourEventHandler :: deleteContours( std::vector<std::string>  keyNamesVector )
        {
                int i,size=keyNamesVector.size();
                for (i=0;i<size;i++)
@@ -2740,13 +2754,8 @@ myfile.close();
                //JCP 20-10-08 Undo redo implementation
                saveState();
                //JCP 20-10-08 Undo redo implementation
-               //deleteContours( _sceneManager->GetlstContoursNameActualSlice() );
-               
-               ///\TODO : find something less stupid!
-               
-        std::vector<std::string> oops;
-               oops =  _sceneManager->GetlstContoursNameActualSlice();
-               deleteContours( oops );
+               deleteContours( (std::vector<std::string>)_sceneManager->GetlstContoursNameActualSlice() );
+
                
        }
 
@@ -3035,8 +3044,8 @@ void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
 
                return panel;*/
 
-               wxPanel *panel          = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, _T(""));
-               _withOfContourLine      = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               wxPanel *panel                                                  = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString(_T("")));
+               _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
 
                double range[2];
                this->_sceneManager->GetImageDataRange(range);
@@ -3122,35 +3131,35 @@ void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
        {
                std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
                int elementsSelected = currentSelection.size();
-               if( toolCommand == (wxContour_ActionCommandsID::CREATE_TOOL) )
+               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_TOOL) )
                {
                        onCreateContourFrame();
                }
-               if( toolCommand == (wxContour_ActionCommandsID::CREATE_CONTOUR_KEY) )
+               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_CONTOUR_KEY) )
                {
                        createContour();
                }
-               else if( toolCommand == wxContour_ActionCommandsID::DELETE_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_TOOL )
                {
                        onDeleteFrame( );
                }
-               else if( toolCommand == wxContour_ActionCommandsID::DELETE_KEY )
+               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_KEY )
                {
                        deleteContours( currentSelection );
                }
-               else if( toolCommand == wxContour_ActionCommandsID::SAVE_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_TOOL )
                {
                        saveFileWithContours(  );
                }
-               else if( toolCommand == wxContour_ActionCommandsID::SAVE_KEY )
+               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_KEY )
                {
                        saveFileWithContoursAutomatique(  );
                }
-               else if( toolCommand == wxContour_ActionCommandsID::OPEN_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::OPEN_TOOL )
                {
                        openFileWithContours(  );
                }
-               else if( toolCommand == wxContour_ActionCommandsID::CHANGE_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::CHANGE_TOOL )
                {
                        if ( elementsSelected >= 1 )
                        {
@@ -3158,69 +3167,69 @@ void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
                        }
 
                }
-               else if( toolCommand == wxContour_ActionCommandsID::HIDE_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::HIDE_TOOL )
                {
                        if ( elementsSelected >= 1 )
                        {
                                onHideOutlines( currentSelection );
                        }                       
                }
-               else if( toolCommand == wxContour_ActionCommandsID::SHOW_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::SHOW_TOOL )
                {
                        if ( elementsSelected >= 1 )
                        {
                                onShowOutlines( currentSelection );
                        }
                }
-               else if( toolCommand == wxContour_ActionCommandsID::COPY_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::COPY_TOOL )
                {
                        if ( elementsSelected >= 1 )
                        {
                                onCopyOutlines( currentSelection );
                        }
                }
-               else if( toolCommand == wxContour_ActionCommandsID::PASTE_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::PASTE_TOOL )
                {
                        onPasteOutlines(  );                    
                }
-               else if( toolCommand == wxContour_ActionCommandsID::SPREAD_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::SPREAD_TOOL )
                {
                                onSpread();
                }
-               else if( toolCommand == wxContour_ActionCommandsID::AUTOMATIQUESEGMENTATION_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::AUTOMATIQUESEGMENTATION_TOOL )
                {
                        onAutomatiqueSegmentation(  );                  
                }
 
-               else if( toolCommand == wxContour_ActionCommandsID::SELECT_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::SELECT_TOOL )
                {
                        onSelectOutlines( currentSelection );
                        
                }
-               else if( toolCommand == wxContour_ActionCommandsID::EDIT_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::EDIT_TOOL )
                {
                        if ( elementsSelected >= 1 )
                        {
                                onEditOutlines( currentSelection );
                        }
                }
-               else if( toolCommand == wxContour_ActionCommandsID::UNDO_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::UNDO_TOOL )
                {
                        onUNDO();
                }
-               else if( toolCommand == wxContour_ActionCommandsID::REDO_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::REDO_TOOL )
                {
                        onREDO();
                }               
-               else if( toolCommand == wxContour_ActionCommandsID::INFORMATIONCONTOUR_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::INFORMATIONCONTOUR_TOOL )
                {
                        onInformationContourFrame();
                }               
-               else if( toolCommand == wxContour_ActionCommandsID::INTERFACECONFIGURATION_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::INTERFACECONFIGURATION_TOOL )
                {
                        onInterfaceConfigurationFrame();
                }
-               else if( toolCommand == wxContour_ActionCommandsID::TEST_TOOL )
+               else if( toolCommand == wxContour_ActionCommnadsID::TEST_TOOL )
                {
                        onInterfaceTestFrame();
                }               
@@ -3290,11 +3299,12 @@ void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
                        
                inredo = 0;
 
-               char str[9000];
+               //char str[9000];
                //itoa(inundo, str, 10);
-               sprintf(str, "%d", inundo);
+               std::string str = intToString(inundo);
 
-               std::string temp = stundoredo + *str + ".roi";
+
+               std::string temp = stundoredo + str + ".roi";
                saveFileWithContours(temp);
 
                inundo++;
@@ -3330,12 +3340,12 @@ void wxContourEventHandler :: onREDO()
                        inredo--;
                        inundo++;
 
-            char str[9000];
+                       //char str[9000];
                        //itoa(inundo, str, 10);
-                       sprintf(str, "%d", inundo);
+                       std::string str = intToString(inundo);
 
             
-                       std::string temp = stundoredo + *str + ".roi";
+                       std::string temp = stundoredo + str + ".roi";
                
                        loadState(temp);
 
@@ -3347,25 +3357,25 @@ void wxContourEventHandler :: onREDO()
        void wxContourEventHandler :: onUNDO()
        {
                if(inundo>0){
-                  char str[9000];
                        if(inredo==0){
 
-                               
+                               //char str[9000];
                                //itoa(inundo, str, 10);
-                               sprintf(str, "%d",inundo); 
+                               std::string str = intToString(inundo);
 
-                               std::string temp = stundoredo + *str + ".roi";
+                               std::string temp = stundoredo + str + ".roi";
                                saveFileWithContours(temp);                             
 
                        }
                        inredo++;
                        inundo--;
 
-                       
+                       //char str[9000];
                        //itoa(inundo, str, 10);
-                        sprintf(str, "%d",inundo);
+                       std::string str = intToString(inundo);
+
             
-                       std::string temp = stundoredo + *str + ".roi";
+                       std::string temp = stundoredo + str + ".roi";
                
                        loadState(temp);
                }
@@ -3534,7 +3544,8 @@ void wxContourEventHandler :: onREDO()
                {
 
                        porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("Saving Values  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       tmpString.Printf(_T("Saving Values"));
+                       tmpString.Printf(_T("  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
                        _staticTextInformation->SetLabel(tmpString);
 
                        //Extraction data from contours of each slice
@@ -3606,7 +3617,7 @@ void wxContourEventHandler :: onREDO()
                lstOptions[0]=_T("A");
                lstOptions[1]=_T("B");
                lstOptions[2]=_T("C");
-               methodRadiobox                          = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+               methodRadiobox                                          = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
                methodRadiobox->SetSelection(2);
                _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
 
@@ -3689,9 +3700,9 @@ void wxContourEventHandler :: onREDO()
                                vecZ[i] = actualSlice;
                        } // for
 
-                       wxDialog* dialog = new wxDialog(parent, -1, _T("Snake"));
+                       wxDialog* dialog = new wxDialog(parent, -1, wxString(_T("Snake")));
                        wxPanel* panel = new wxPanel(dialog,-1); 
-                       wxStaticText* sttext = new wxStaticText(panel, -1, _T("Panel para snake"));
+                       wxStaticText* sttext = new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
                        dialog->ShowModal();
                } // if 
 
@@ -3703,4 +3714,14 @@ void wxContourEventHandler :: onREDO()
                        _InformationContourFrame->Show(false);
                }               
        }
+
+       std::string wxContourEventHandler::intToString(int num){
+               std::string result;
+               for(int k = num; k == 0; k++){
+                       char temp = k % 10 + 48;
+                       k = k / 10;
+                       result = temp + result; 
+               }
+               return result;
+       }
 //JCP 21 - 10 - 09