]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
index 256008211255846d9b8ce3e40c998e1a3949549e..bbee55dfafe9f64bc2523254c2df1512fac714da 100644 (file)
@@ -19,6 +19,7 @@
 //#include "wxContour_ActionCommandsID.h"
 //#include "OutlineModelBuilder.h"
 //#include "wxContourEventHandler.h"
+#include <creaWx.h>
 
 //----------------------------------------------------------------------------------------------------------------
 // Class implementation
@@ -42,26 +43,26 @@ char wxContourMainFrame::COPY = 'C';
                _theViewPanel                           = NULL;
 //             _modelManager                           = NULL;
                _instantPanel                           = NULL;
-               _buttonsBar                                     = NULL;
-               _gridPanel                                      = NULL; 
-               _drawToolsPanel                         = NULL;
-               _operationsToolsPanel           = NULL;
-               _autoFormsPanel                         = NULL; 
-               _standardToolsPanel                     = NULL;
-               _editionToolsPanel                      = NULL;
-               _listViewPanel                          = NULL;
-               _sceneManager                           = NULL;
+//             _buttonsBar                                     = NULL;
+//             _gridPanel                                      = NULL; 
+//             _drawToolsPanel                         = NULL;
+//             _operationsToolsPanel           = NULL;
+               //_autoFormsPanel                               = NULL; 
+//             _standardToolsPanel                     = NULL;
+//             _editionToolsPanel                      = NULL;
+//             _listViewPanel                          = NULL;
+//             _sceneManager                           = NULL;
                //_actualInstant                                = NULL;
                _numberOfVariablesStatistics = 6+1;
 
                // set up default notebook style
-               m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
-               m_notebook_theme = 0;   
+//             m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
+//             m_notebook_theme = 0;   
                //wxContour_ActionCommandsID a;
 
        }
 
-wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style)            
+       wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir)         
                : wxPanel(parent, id, pos, size, style)
        {
                m_mgr.SetManagedWindow(this);
@@ -69,15 +70,15 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
                _theViewPanel                           = NULL;
 //             _modelManager                           = NULL;
                _instantPanel                           = NULL;
-               _buttonsBar                                     = NULL;
-               _gridPanel                                      = NULL; 
-               _drawToolsPanel                         = NULL;
-               _operationsToolsPanel           = NULL;
-               _autoFormsPanel                         = NULL; 
-               _standardToolsPanel                     = NULL;
-               _editionToolsPanel                      = NULL;
-               _listViewPanel                          = NULL;
-               _sceneManager                           = NULL;
+//             _buttonsBar                                     = NULL;
+//             _gridPanel                                      = NULL; 
+//             _drawToolsPanel                         = NULL;
+//             _operationsToolsPanel           = NULL;
+//             _autoFormsPanel                         = NULL; 
+//             _standardToolsPanel                     = NULL;
+//             _editionToolsPanel                      = NULL;
+//             _listViewPanel                          = NULL;
+//             _sceneManager                           = NULL;
                //_actualInstant                                = NULL;
 
                // set up default notebook style
@@ -93,7 +94,7 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
        inredo = 0;
        inundo = 0;
 
-       kernelManager = new KernelManagerContour(images);
+       kernelManager = new KernelManagerContour(images,datadir+"/data/");
        //kernelManager->setVectImages(images);
        //kernelManager->initializeEnvironment();
                        
@@ -146,7 +147,7 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
        //successConfiuration &= this->configurePanels( notebook );
        this->configurePanels( notebook );
 
-       interfMainPanel* pannew = interfMainPanel::getInstance(parent);//, eventHandler);
+       interfMainPanel* pannew = interfMainPanel::getInstance(parent,datadir+"/data/Icons");//, eventHandler);
 
 //JCP 17 -10 - 2008
 
@@ -154,9 +155,9 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
        }
 
 
-       wxContourMainFrame* wxContourMainFrame :: getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style ){
+       wxContourMainFrame* wxContourMainFrame :: getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir ){
                if(instance == NULL){
-                       instance = new wxContourMainFrame(parent, id, title, pos, size, images, style);
+                       instance = new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir);
                }
                return instance;
        }
@@ -219,7 +220,7 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
 
                m_mgr.AddPane(theNoteBook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
                m_mgr.Update();
-               configured &= _buttonsBar!=NULL;
+/*             configured &= _buttonsBar!=NULL;
                if( _buttonsBar!=NULL )
                {                       
                        m_mgr.AddPane(_buttonsBar, wxAuiPaneInfo().
@@ -227,7 +228,7 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
                                        ToolbarPane().Top().
                                        LeftDockable(  ).RightDockable( false ).CloseButton(false));
                        m_mgr.Update();
-               }
+               }*/
                //CreateStatusBar();
                         
                SetMinSize(wxSize(300,300));
@@ -251,45 +252,45 @@ wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const w
                _instantPanel = theInstantChooserPanel; 
        }
 
-       void wxContourMainFrame :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
-       {
-               _buttonsBar = theButtonsBar;
-       }
+//     void wxContourMainFrame :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
+//     {
+//             _buttonsBar = theButtonsBar;
+//     }
 
-       void wxContourMainFrame :: setGrid(  wxContour_Grid * theGridPanel )
-       {
-               _gridPanel = theGridPanel;
-       }
+//     void wxContourMainFrame :: setGrid(  wxContour_Grid * theGridPanel )
+//     {
+//             _gridPanel = theGridPanel;
+//     }
 
-       void wxContourMainFrame :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
-       {
-               _drawToolsPanel = theDrawToolsPanel;
-       }
+//     void wxContourMainFrame :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
+//     {
+//             _drawToolsPanel = theDrawToolsPanel;
+//     }
 
-       void wxContourMainFrame :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
-       {       
-               _operationsToolsPanel = theOperationsToolsPanel;
-       }
+//     void wxContourMainFrame :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
+//     {       
+//             _operationsToolsPanel = theOperationsToolsPanel;
+//     }
 
-       void wxContourMainFrame :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
-       {
-               _autoFormsPanel = theAutoFormsPanel;
-       }
+//     void wxContourMainFrame :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
+//     {
+//             _autoFormsPanel = theAutoFormsPanel;
+//     }
 
-       void wxContourMainFrame :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
-       {
-               _standardToolsPanel= theStandardToolsPanel;
-       }
+//     void wxContourMainFrame :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
+//     {
+//             _standardToolsPanel= theStandardToolsPanel;
+//     }
 
-       void wxContourMainFrame :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
-       {
-               _editionToolsPanel =  theEditionToolsPanel;
-       }
+//     void wxContourMainFrame :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
+//     {
+//             _editionToolsPanel =  theEditionToolsPanel;
+//     }
 
-       void wxContourMainFrame :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
-       {
-               _listViewPanel = theListViewPanel;
-       }
+//     void wxContourMainFrame :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
+//     {
+//             _listViewPanel = theListViewPanel;
+//     }
 
 
 
@@ -611,7 +612,11 @@ void wxContourMainFrame::updateInstantImageData(){
        vtkImageData* img = kernelManager->getImageAtInstant(inst);
        if(img!=NULL){
                _theViewPanel->changeImage(img);
-       }       
+               showAxis(false);
+       }else{
+               int z = _instantPanel->getConceptDataOf("Axe Depth")->getActualValue();
+               _theViewPanel->setImageSlice(z);
+       }
 }
 void wxContourMainFrame::updateInstantAxes(){
 }
@@ -728,6 +733,7 @@ void wxContourMainFrame::onSave(){
        if (dialog.ShowModal() == wxID_OK)
        {
                std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+               kernelManager->setCurrentFileName(fileNameContourROI);
                saveFileWithContours( fileNameContourROI );
        }
 }
@@ -1532,7 +1538,8 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
                        temp = temp + kernelManager->intToString(z) + "-cont" + kernelManager->intToString(iContourGroup);
                        temp = temp + ".txt";
 
-                       wxString filename;
+                       // LG 14/01/09 : using crea
+                       wxString filename = crea::std2wx(temp);
                        /*filename.Printf(_T("%s"),directory.c_str());
                        filename.append(_T("\\"));
                        filename.append(_T("%s"),namefile.c_str());
@@ -1541,7 +1548,10 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
                        filename.append(_T("-cont"));
                        filename.append(_T("%d"),iContourGroup);
                        filename.append(_T(".txt"));*/
-                       filename.Printf(temp.c_str());
+                       //                      filename.Printf(temp.c_str());
+
+                       
+
                        FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
                        fprintf(pFile,"value \t x \t y \t z\n"  );
                        int iLstValue,sizeLstValue=pLstValue.size();
@@ -1653,8 +1663,9 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
 
        std::string temp = directory + "/" + namefile + "-Value.mhd";
 
-       wxString filename;
-       filename.Printf(_T(temp.c_str()));
+       wxString filename = crea::std2wx(temp);
+       // LG 
+       //      filename.Printf(_T(temp.c_str()));
        //filename.Printf(_T("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z);
        /*filename.Printf(_T("%s"),directory.c_str());
        filename.append(_T("\\"));
@@ -1672,7 +1683,9 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
        //              filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z);
        temp = directory + "/" + namefile + "-Mask.mhd";
 
-       filename.Printf(_T(temp.c_str()));
+       // LG 14/01/09 : using crea
+       filename = crea::std2wx(temp);
+       //      filename.Printf(_T(temp.c_str()));
 
        /*filename.Printf(_T("%s"),directory.c_str());
        filename.append(_T("\\"));
@@ -1699,3 +1712,36 @@ void wxContourMainFrame::onChangeInstantInstantPanel(std::string name,int value,
 
        changeInstant();
 }
+
+void wxContourMainFrame::onSnakePressed(){
+       std::vector<double> vecX; 
+       std::vector<double> vecY; 
+       std::vector<double> vecZ; 
+       _theViewPanel->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
+
+       if (vecX.size()!=0){
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+               int i,size=vecZ.size();
+               int actualSlice = tempVector[1];
+               for ( i=0 ; i<size ; i++ )
+               {
+                       vecZ[i] = actualSlice;
+               } // for
+
+               wxDialog* dialog = new wxDialog(this, -1, wxString(_T("Snake")));
+               wxPanel* panel = new wxPanel(dialog,-1); 
+               wxStaticText* sttext = new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
+               dialog->ShowModal();
+       } // if 
+
+}
+
+void wxContourMainFrame::saveFileWithContoursAutomatique(){
+       std::string filename = kernelManager->getCurrentFileName();
+       if(filename.compare("")!=0){
+               saveFileWithContours(filename);
+       }else{
+               onSave();
+       }
+}
\ No newline at end of file