]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
index e81e73084b2cd0225ef3ecb515e20eb8240cd06d..4cfa08134be989b9946325c498bb01b7ab4ca905 100644 (file)
@@ -72,19 +72,8 @@ char wxContourMainFrame::COPY = 'C';
                m_mgr.SetManagedWindow(this);
                _creatingContoursActive         = false;
                _theViewPanel                           = NULL;
-//             _modelManager                           = NULL;
-               _instantPanel                           = NULL;
-//             _buttonsBar                                     = NULL;
-//             _gridPanel                                      = NULL; 
-//             _drawToolsPanel                         = NULL;
-//             _operationsToolsPanel           = NULL;
-//             _autoFormsPanel                         = NULL; 
-//             _standardToolsPanel                     = NULL;
-//             _editionToolsPanel                      = NULL;
-//             _listViewPanel                          = NULL;
-//             _sceneManager                           = NULL;
-//             _actualInstant                          = NULL;
 
+               _instantPanel                           = NULL;
                _refLineControl                         = NULL;
                _refLineModel                           = NULL;
                _refLineView                            = NULL;
@@ -93,48 +82,48 @@ char wxContourMainFrame::COPY = 'C';
                m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
                m_notebook_theme = 0;   
                //wxContour_ActionCommandsID a;
-               _numberOfVariablesStatistics = 6+1;
-
+               _numberOfVariablesStatistics = 7;
 
-               _performingOperation                    = new PerformingOperation();
-//JCP 17 - 10 - 2008
+               _datadir = datadir;
 
+       
        inredo = 0;
        inundo = 0;
 
-       kernelManager = new KernelManagerContour(images,datadir+"/data/");
-       //kernelManager->setVectImages(images);
-       //kernelManager->initializeEnvironment();
-                       
-       //vtkImageData* selectedimage = kernelManager->getVectImages()[0];
-       
-//-------------------------------------------------------------
+       interfMainPanel* pannew = interfMainPanel::getInstance(parent,datadir+"/data/Icons");//, eventHandler);
+       _performingOperation                    = new PerformingOperation();
+
+
 
-       /*frame = new wxContourMainFrame(_builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(),  _builder->getContourEnv(),NULL, wxID_ANY, wxT("ROI Application Sample"), wxPoint(50,50), wxSize(800, 600)); 
-       frame->Show(TRUE);*/
+       if(images.size() > 0){
+               this->setVectImages(images);
+       }
 
-       //Creating the evtHandler of the panels
-       //wxContourEventHandler * eventHandler = new wxContourEventHandler();
+}
 
-       //Creating the window that will show the panels
+void wxContourMainFrame::setVectImages( std::vector<vtkImageData*> images ){
 
-       //Getting the parent for the panels ( using aui )
-       wxAuiNotebook * notebook = this->createNotebook();
+       #if defined(__GNUC__)
+               std::string str_home(getenv("HOME"));
+       #elif defined(_WIN32)
+                       std::string str_home(getenv("USERPROFILE"));
+       #endif
+               std::string strCreaContourDataTmp = str_home + "/.creaContourDataTemp/";
 
-       //JCP 17 - 11 - 08
-       //wxInstantChooserPanel * instantPanel                          = new wxInstantChooserPanel( notebook, "Instant Chooser", true);
-       //JCP 17 - 11 - 08
        std::vector<std::string> conceptNameVect;
        std::vector<int> conceptSizeVect;
-       
 
+       wxAuiNotebook * notebook = this->createNotebook();              
 
-       _instantPanel                           = new wxInstantChooserPanel( notebook, "Instant Chooser", true, false, "c" );
-       _theViewPanel                           = new wxContourViewPanel( kernelManager->getSourceImage(), notebook );  
 
+       kernelManager = new KernelManagerContour( images , _datadir+"/data/" , strCreaContourDataTmp );
 
 
-    kernelManager->getConceptsInformation(conceptNameVect, conceptSizeVect);
+       _instantPanel                           = new wxInstantChooserPanel( notebook, "Instant Chooser", true, false, "c" );
+       _theViewPanel                           = new wxContourViewPanel( kernelManager->getSourceImage(), notebook );  
+               
+//-------------------------------------------------------------
+       kernelManager->getConceptsInformation(conceptNameVect, conceptSizeVect);
        _instantPanel->addConcepts(conceptNameVect, conceptSizeVect);
                
 
@@ -145,22 +134,9 @@ char wxContourMainFrame::COPY = 'C';
        //*******************changeInstant();
        _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(),  data->getMaxShowedValue(), data->getActualValue() );
 
-       //eventHandler->setModelManager( kernelManager->getOutlineModelManager() );
-       //eventHandler->setViewPanel( _theViewPanel );
-       //_theViewPanel->initializeScenceManager();
-       //eventHandler->setInstantChooserPanel( _instantPanel );
-       
-       //bool successConfiuration = eventHandler->configureEventsHandling();
-
-       //successConfiuration &= this->configurePanels( notebook );
        this->configurePanels( notebook );
 
-       interfMainPanel* pannew = interfMainPanel::getInstance(parent,datadir+"/data/Icons");//, eventHandler);
-
-//JCP 17 -10 - 2008
-
-
-       }
+}
 
 
        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 ){
@@ -709,10 +685,10 @@ void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName,
 
        double pnt1X = refPoint1->GetX();
        double pnt1Y = refPoint1->GetY();
-       double pnt1Z = refPoint1->GetZ();
+//     double pnt1Z = refPoint1->GetZ();
        double pnt2X = refPoint2->GetX();
        double pnt2Y = refPoint2->GetY();
-       double pnt2Z = refPoint2->GetZ();
+//     double pnt2Z = refPoint2->GetZ();
 
        double angle = (atan2(pnt2Y - pnt1Y, pnt2X - pnt1X) * 180 / 3.1415926535897932384626433832795)+90;
        vtkTransform *t = vtkTransform::New();
@@ -1483,8 +1459,8 @@ myfile.close();
        {
                id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
                p       = polyDataResult->GetPoint(id);
-               double x=p[0];
-               double y=p[1];
+//             double x=p[0];
+//             double y=p[1];
                vecX.push_back( p[0] );
                vecY.push_back( p[1] );
                vecZ.push_back( -900 );
@@ -1611,21 +1587,21 @@ void wxContourMainFrame::referenceLine()
        viewer2D->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _refLineControl );
        _refLineModel->SetCloseContour(false);
        _refLineControl->CreateNewManualContour();
-/*
+
        double z = _refLineControl->GetZ();
+/*
+       _refLineControl->AddPoint(50,100,z);
+       _refLineControl->AddPoint(80,40,z);
+       _refLineControl->SetCompleteCreation(true);
 
        _refLineModel->AddPoint(50,100,z);
        _refLineModel->AddPoint(80,40,z);
-
-       _refLineControl->AddPoint(50,100,z);
-       _refLineControl->AddPoint(80,40,z);
+       _refLineModel->UpdateSpline();
 
        _refLineView->UpdateViewPoint(0);
        _refLineView->UpdateViewPoint(1);
-
-       _refLineControl->SetCompleteCreation(true);
-       _refLineControl->SetEditable(true);
 */
+
        _refLineControl->SetActive(true);
        _refLineView->RefreshContour();
 }
@@ -1635,7 +1611,9 @@ void wxContourMainFrame::refLineHide()
 {
        if (_refLineControl!=NULL)
        {
-               _refLineView->RemoveCompleteContourActor();     
+               _refLineView->RemoveCompleteContourActor();
+               _refLineControl->SetEditable(false);
+               _refLineControl->SetActive(false);
        }
 }
 
@@ -1654,8 +1632,7 @@ void wxContourMainFrame::refLineShow()
                _refLineControl->SetModelView( _refLineModel , _refLineView );
                viewer2D->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _refLineControl );
                _refLineControl->CreateNewManualContour();
-               //_refLineControl->SetActive(true);
-               //_refLineControl->SetEditable(true);
+               _refLineControl->SetActive(true);
                _refLineView->RefreshContour();
        }
 }
@@ -2049,7 +2026,8 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil
        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.c_str() );
+               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle );
        }
        fprintf(pFile,"\n" );
 
@@ -2358,7 +2336,8 @@ void wxContourMainFrame::onSnakePressed(){
 
                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")));
+               //              wxStaticText* sttext = new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
+         new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
                dialog->ShowModal();
        } // if