]> Creatis software - creaContours.git/commitdiff
no message
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 22 Jun 2009 07:47:40 +0000 (07:47 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 22 Jun 2009 07:47:40 +0000 (07:47 +0000)
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
lib/Interface_Icons_NDimensions/interfToolsPanels.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx

index 0cf8b41dee745ef1a0398ccb0e952d81913a66fc..1d4bdfc5d54dad71dfb0ec78dcc0e20b770df102 100644 (file)
@@ -756,3 +756,9 @@ void interfMainPanel::onThresholdPressed()
        showPanel(thresholdPanel);
 }
 
+void interfMainPanel::ShowResultImages(int typeContourGroup)
+{
+       wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup);
+}
+
+
index 90bd7838f3480aa760bd7246abaef76d7b544a20..6e9f6f30d8ac6afb27ed85ca64e3b83813dac4fa 100644 (file)
@@ -209,6 +209,8 @@ public:
 
        virtual bool Show(bool show);
 
+       void ShowResultImages(int typeContourGroup);
+       
 private:
        
 
index 40c630d2eb34d17ee6d70f368ed24563889aaf88..92d9b0a5c18570a8da781985cf14d5d2ea4a9622 100644 (file)
@@ -215,11 +215,16 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
        statisticsContourBtn->SetEventHandler( this );
        Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation ); 
 
+       wxButton *showResultImagesBtn                                           = new wxButton(this,-1,_T("Show result images"),wxDefaultPosition, wxSize(140,35) );
+       showResultImagesBtn->SetEventHandler( this );
+       Connect( showResultImagesBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onShowResultImages ); 
+       
+       
        wxButton *saveResultsBtn                                                = new wxButton(this,-1,_T("Save Results"),wxDefaultPosition, wxSize(140,35) );
        saveResultsBtn->SetEventHandler( this );
        Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults ); 
-
-
+       
+       
        int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
        //_theViewPanel->getSceneManager()->GetImageDataSizeZ();                        
        _mbarrangeSliceInformation                                      =  new mBarRange(this,65,65);
@@ -290,6 +295,7 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
        wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
        sizerB->Add( informationContourLabelsBtn, 1, wxALL ,2 );
        sizerB->Add( statisticsContourBtn, 1, wxALL ,2 );
+       sizerB->Add( showResultImagesBtn, 1, wxALL ,2 );
        sizerB->Add( saveResultsBtn, 1, wxALL ,2 );
 
        wxFlexGridSizer * sizer         = new wxFlexGridSizer(1,8);
@@ -316,6 +322,16 @@ void interfInformationPanel::onInformationContourLabels(wxCommandEvent& event){
        wxBusyCursor wait;
        FillGridWithContoursInformation();
 }
+
+
+void interfInformationPanel::onShowResultImages(wxCommandEvent& event)
+{
+       onExtractInformation( event );
+       int typeContourGroup = _radiolstboxContourGroup->GetSelection();
+       interfMainPanel::getInstance()->ShowResultImages( typeContourGroup );   
+}
+
+
 void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
        wxBusyCursor wait;
        _grid->ClearGrid();
@@ -325,10 +341,9 @@ void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
        int minZ        = _mbarrangeSliceInformation->GetStart();
        int maxZ        = _mbarrangeSliceInformation->GetEnd();
 
-       interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ);
-
-       
+       interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ);    
 }
+
 void interfInformationPanel::onSaveResults(wxCommandEvent& event)
 {
        wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxSAVE );
index 396579bf09f48104a149d22c88f0e4ae61704404..fb21b95d9f419bfeb32d08adc0c8691ae10b8088 100644 (file)
@@ -81,6 +81,7 @@ private:
 
        void onInformationContourLabels(wxCommandEvent& event);
        void onExtractInformation(wxCommandEvent& event);
+       void onShowResultImages(wxCommandEvent& event);
        void onSaveResults(wxCommandEvent& event);
        void FillGridWithContoursInformation();
        
index 89f6c39f741d38bc0ee2f9cefcff02aec367c6c9..b6d2133f84b044328d314268bc7d81e88f567c84 100644 (file)
@@ -62,7 +62,8 @@ 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;
-
+               
+               _contourextractdata                     = NULL;
        }
 
        wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir)         
@@ -101,7 +102,8 @@ char wxContourMainFrame::COPY = 'C';
                {
                        this->setVectImages(images);
                }
-
+               
+               _contourextractdata                     = NULL;
 }
 
 void wxContourMainFrame::setVectImages(std::vector<vtkImageData*> imgs)
@@ -169,6 +171,7 @@ void wxContourMainFrame::setVectImages(std::vector<vtkImageData*> imgs)
 
        wxContourMainFrame :: ~wxContourMainFrame()
        {
+               delete _contourextractdata;
                deleteAllContours();
                _pannew->Close();
                interfMainPanel::resetInstance();
@@ -578,13 +581,50 @@ void wxContourMainFrame::setConceptValue( std::string name, int value ){
        _instantPanel->setConceptValue(name, value);
 }
 
+
 ConceptDataWrap* wxContourMainFrame::getLastConceptData(){
        return _instantPanel->getLastConceptData();
 }
+
+
 bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ){
        return _instantPanel->getIfConceptCheckedAt( name, pos );
 }
 
+
+
+void wxContourMainFrame::ShowResultImages(int typeContourGroup)
+{
+       vtkImageData * mask;
+       vtkImageData * value;
+       this->getMaskValue(&mask, &value, typeContourGroup);
+       
+       std::vector<int> nTypeView;
+       nTypeView.push_back(5);
+       nTypeView.push_back(1);
+       nTypeView.push_back(2);
+       nTypeView.push_back(0); 
+       
+       wxFrame *frame = new wxFrame(this, -1,_T("Result image extracted.."),wxDefaultPosition,wxSize(600,600), wxDEFAULT_FRAME_STYLE|wxSTAY_ON_TOP);
+       wxAuiManager *m_mgr_noteBookViewerResult = new wxAuiManager();
+       m_mgr_noteBookViewerResult->SetManagedWindow(frame);
+       
+       wxAuiNotebook* noteBookViewerResult = new wxAuiNotebook(frame, -1, wxPoint(600, 600), wxSize(430,200), m_notebook_style);
+       m_mgr_noteBookViewerResult->AddPane(noteBookViewerResult, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
+
+       wxPanel *panelViewer1 = new wxMaracas_N_ViewersWidget(noteBookViewerResult, value,&nTypeView);
+       wxPanel *panelViewer2 = new wxMaracas_N_ViewersWidget(noteBookViewerResult, mask,&nTypeView);
+       
+
+       noteBookViewerResult->AddPage( panelViewer1, wxT("Image result") );
+       noteBookViewerResult->AddPage( panelViewer2, wxT("Mask result") );
+       m_mgr_noteBookViewerResult->Update();
+       frame->Show();
+}
+
+
+
+
 void wxContourMainFrame::changeInstant()
 {
                std::vector<int> instantVect;
@@ -604,6 +644,7 @@ void wxContourMainFrame::changeInstant()
 }
 
 
+
 void wxContourMainFrame :: updateInstantOutlines()
 {
        _theViewPanel->removeSceneContours();
@@ -2329,13 +2370,21 @@ std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide){
        return kernelManager->getOutlinesNameAtInstant(tempVector);
 }
 
+
+void wxContourMainFrame::GenerateContourExtractData()
+{
+       if (_contourextractdata==NULL) { _contourextractdata = new ContourExtractData(true); }
+}
+
+
 void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ)
 {
+       GenerateContourExtractData();
+       
        int maxContourGroup     =       0;
 
-       ContourExtractData      *contourextractdata = new ContourExtractData();
        
-       contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+       _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
        std::vector<manualContourModel*> lstManConMod;
        std::vector<manualContourModel*> lstManConModTmp;
@@ -2389,7 +2438,7 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        
 
        totalZ  = maxZ-minZ+1;
-       contourextractdata->SetImage( imagedata);
+       _contourextractdata->SetImage( imagedata);
 
 // For each slice..
        for ( z=minZ ; z<=maxZ ; z++ )
@@ -2402,7 +2451,7 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                //_staticTextInformation->SetLabel(tmpString);
 
                //Extraction data from contours of each slice
-               contourextractdata->SetZtoBeAnalys(z);
+               _contourextractdata->SetZtoBeAnalys(z);
 
                tempVector[1]=z;
                Instant instant(&tempVector);
@@ -2449,18 +2498,18 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                                lstManConModTmp = lstManConModExp;
                        }
 
-                       contourextractdata->SetLstManualContourModel( lstManConModTmp );
+                       _contourextractdata->SetLstManualContourModel( lstManConModTmp );
 
                        pLstValue.clear();
                        pLstValuePosX.clear();
                        pLstValuePosY.clear();
                        pLstValuePosZ.clear();
-                       contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                       _contourextractdata->GetValuesInsideCrown(      &pLstValue,
                                                                                                                &pLstValuePosX,
                                                                                                                &pLstValuePosY,
                                                                                                                &pLstValuePosZ);
                        // Statistics of each slice.
-                       contourextractdata->Statistics( &pLstValue,
+                       _contourextractdata->Statistics( &pLstValue,
                                                                                        minimumZ,
                                                                                        maximumZ,
                                                                                        &resultGrayRangeCount, 
@@ -2518,7 +2567,6 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        }
 
        interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
-       delete contourextractdata;
 }
 
 //AD: 29-05-09
@@ -2580,9 +2628,10 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil
 void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefile,int typeContourGroup)
 {
        wxBusyCursor wait;
-       ContourExtractData      *contourextractdata = new ContourExtractData();
+       GenerateContourExtractData();
+       
        //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-       contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+       _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
        std::vector<manualContourModel*> lstManConMod;
        std::vector<manualContourModel*> lstManConModTmp;
@@ -2609,7 +2658,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
        maxZ    = sizeZ;//_mbarrange->GetEnd();
        totalZ  = maxZ-minZ+1;
 
-       contourextractdata->SetImage( imagedata);
+       _contourextractdata->SetImage( imagedata);
 
 // For each slice..
        for ( z=0 ; z<sizeZ ; z++)
@@ -2624,7 +2673,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
 
 
                //Extraction data from contours of each slice
-               contourextractdata->SetZtoBeAnalys( z);
+               _contourextractdata->SetZtoBeAnalys( z);
 
                tempVector[1]=z;
                Instant instant(&tempVector);
@@ -2659,13 +2708,13 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
                                lstManConModTmp = lstManConModExp;
                        }
 
-                       contourextractdata->SetLstManualContourModel( lstManConModTmp );
+                       _contourextractdata->SetLstManualContourModel( lstManConModTmp );
 
                        pLstValue.clear();
                        pLstValuePosX.clear();
                        pLstValuePosY.clear();
                        pLstValuePosZ.clear();
-                       contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                       _contourextractdata->GetValuesInsideCrown(      &pLstValue,
                                                                                                                &pLstValuePosX,
                                                                                                                &pLstValuePosY,
                                                                                                                &pLstValuePosZ);
@@ -2700,18 +2749,19 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
        } // for z
        interfMainPanel::getInstance()->setStringInfoPanel(_T(""));
        //_staticTextInformation->SetLabel( _T("") );
-       delete contourextractdata;
+
 }
 
 void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup){
        wxBusyCursor wait;
-       ContourExtractData      *contourextractdata = new ContourExtractData( true );
+       GenerateContourExtractData();
+
        //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
        if (typeContourGroup==3)
        {
                typeContourGroup=1;
        }
-       contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+       _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
        std::vector<manualContourModel*> lstManConMod;
        std::vector<manualContourModel*> lstManConModTmp;
@@ -2736,7 +2786,7 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value
        maxZ    = sizeZ;//_mbarrange->GetEnd();
        totalZ  = maxZ-minZ+1;
 
-       contourextractdata->SetImage( imagedata);
+       _contourextractdata->SetImage( imagedata);
 
 // For each slice..
        for ( z=0 ; z<sizeZ ; z++)
@@ -2748,7 +2798,7 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value
                interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
 
                //Extraction data from contours of each slice
-               contourextractdata->SetZtoBeAnalys( z);
+               _contourextractdata->SetZtoBeAnalys( z);
 
                tempVector[1]=z;
                Instant instant(&tempVector);
@@ -2781,15 +2831,15 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value
                                lstManConModTmp = lstManConModExp;
                        }
 
-                       contourextractdata->SetLstManualContourModel( lstManConModTmp );
-                       contourextractdata->CalculateImageResult(); // with actual Z
+                       _contourextractdata->SetLstManualContourModel( lstManConModTmp );
+                       _contourextractdata->CalculateImageResult(); // with actual Z
 
                } // for  iContourGroup
        } // for z
 
-       (*value) = contourextractdata->GetVtkImageValueResult();
-       (*mask) contourextractdata->GetVtkImageMaskResult();
-       delete contourextractdata;
+       (*value) = _contourextractdata->GetVtkImageValueResult();
+       (*mask)  = _contourextractdata->GetVtkImageMaskResult();
+
 }
 
 void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value)
index a217f4aa6444a84ad31d3107a3bc53210435bfee..f686c62036221de2266b7c01aede70874e79e0fb 100644 (file)
@@ -308,6 +308,10 @@ class wxContourMainFrame : public wxPanel {
        void onSnakePressed();
 
        void saveFileWithContoursAutomatique();
+       
+       void ShowResultImages(int typeContourGroup);
+
+
 private:
        //------------------------------------------------------------------------------------------------------------
        //  Private methods
@@ -391,9 +395,10 @@ private:
        //manualContourModel * factoryManualContourModel(int typeContour);
 
        manualContourModel * factoryManualContourModel(wxPanel* panel);
+       
+       ContourExtractData      *_contourextractdata;
 
-
-
+       void GenerateContourExtractData();
        void saveState();
        void loadState(std::string filename);
        void loadContours( FILE *pFile, bool staticContour );
index 9e6a6056428936b7b26421363897f3c4cb87f712..fccc03657f72041a8d8d571ff8f6075cc9345c52 100644 (file)
@@ -146,6 +146,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                {
                        manContourControl       = new manualContourControler();
                        manViewerContour        = new manualViewContour();
+                       manModelContour->SetCloseContour(false);
                }
 
                if (typeContour==2)
@@ -186,7 +187,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                //Configuring the relations between the contour members representation                  
                manViewerContour->SetModel( manModelContour );
                manViewerContour->SetWxVtkBaseView( _wxVtk_BaseView );
-               manViewerContour->SetRange( 2 );
+               manViewerContour->SetRange( 0.5 );
                manViewerContour->SetZ( 1000 );
 
                manViewerContour->SetSpacing(spc);