]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authordonadio <donadio>
Wed, 17 Jun 2009 17:30:59 +0000 (17:30 +0000)
committerdonadio <donadio>
Wed, 17 Jun 2009 17:30:59 +0000 (17:30 +0000)
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx
lib/Interface_Icons_NDimensions/interfSegmentationPanels.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h

index fe241ccda59884b2c49d46f8ffb94cf8b1362b4a..0cf8b41dee745ef1a0398ccb0e952d81913a66fc 100644 (file)
@@ -557,7 +557,7 @@ void interfMainPanel::setStringSpread(std::string stringtemp){
 
 void interfMainPanel::onInformationPressed(){
        if(infoWin ==NULL){
-               infoWin                                         = new wxFrame (this, -1,_T("  Spread  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
+               infoWin                                         = new wxFrame (this, -1,_T("  Statistics  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
                infoWin->SetSize( wxSize(825,650) );
                
                wxSize sizepanel(825,675);
index a71b57fdb362964a09c2a6bf982ba0104c96f636..0fa3d18196d39987746a8a9253cfa81f4c3bb349 100644 (file)
@@ -211,18 +211,17 @@ void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event )
 interfMirrorPanel::interfMirrorPanel(wxWindow* parent)
 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
 {
-       wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show Axis"), wxDefaultPosition, wxSize(200,35) );
-       wxButton *axisHideBtn = new wxButton(this,wxID_ANY,_T("Hide Axis"), wxDefaultPosition, wxSize(200,35) );
+       _axisStatus = true;
+
+       wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Axis"), wxDefaultPosition, wxSize(200,35) );
        wxButton *mirrorGoBtn = new wxButton(this,wxID_ANY,_T("Mirror Contour"), wxDefaultPosition, wxSize(200,35) );
        _thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
        
        Connect( axisShowBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisShow );
-       Connect( axisHideBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisHide ); 
        Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); 
 
        wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
        sizer -> Add( axisShowBtn, 1, wxGROW );
-       sizer -> Add( axisHideBtn, 1, wxGROW );
        sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
        sizer -> Add( new wxStaticText(this,-1,_T("Thickness"))  , 1, wxGROW );
        sizer -> Add( _thickness, 1, wxGROW );
@@ -238,17 +237,25 @@ interfMirrorPanel::~interfMirrorPanel(){
 
 void interfMirrorPanel::onAxisShow(wxCommandEvent& event)
 {
-       interfMainPanel::getInstance()->onMirrorAxisShow();
-}
-
-void interfMirrorPanel::onAxisHide(wxCommandEvent& event)
-{
-       interfMainPanel::getInstance()->onMirrorAxisHide();
+       
+       if (!_axisStatus)
+       {
+               interfMainPanel::getInstance()->onMirrorAxisShow();
+               _axisStatus=true;
+       }
+       else
+       {       
+               interfMainPanel::getInstance()->onMirrorAxisHide();
+               _axisStatus=false;              
+       }
 }
 
 void interfMirrorPanel::onMirrorGo(wxCommandEvent& event)
 {
-       interfMainPanel::getInstance()->onMirror();
+       if (_axisStatus)
+       {
+               interfMainPanel::getInstance()->onMirror();
+       }
 }
 
 void interfMirrorPanel::onChangeWidth(wxScrollEvent& event)
index e544d84fff495a2e5e40d5efe3926eeec55688ee..55c74b8a3bee82d0eb543a61775ed7b6918d9e78 100644 (file)
@@ -89,9 +89,9 @@ private:
 
        wxSlider* _thickness;
 
-       void onAxisShow(wxCommandEvent& event);
+       bool _axisStatus;
 
-       void onAxisHide(wxCommandEvent& event);
+       void onAxisShow(wxCommandEvent& event);
 
        void onMirrorGo(wxCommandEvent& event);
 
index 7d2b6948bca4bda0f50ace80c3aa2154452aac8e..89f6c39f741d38bc0ee2f9cefcff02aec367c6c9 100644 (file)
@@ -99,7 +99,6 @@ char wxContourMainFrame::COPY = 'C';
 
                if(images.size() > 0)
                {
-                       
                        this->setVectImages(images);
                }
 
@@ -109,6 +108,7 @@ void wxContourMainFrame::setVectImages(std::vector<vtkImageData*> imgs)
 {
 
        _images = imgs;
+
        #if defined(__GNUC__)
                std::string str_home(getenv("HOME"));
        #elif defined(_WIN32)
@@ -756,43 +756,21 @@ void wxContourMainFrame ::loadState(std::string filename){
 
        fscanf(pFile,"%s",tmp); // Version
        fscanf(pFile,"%s",tmp); // 1.0.2 || 1.0.1 || 1.0.0
-       std::string version(tmp);
 
        deleteAllContours();
 
-       //AD:02-06-09
-       if (version=="1.0.2")
-       {
-               loadContours(pFile);
-       }
-       
-       //AD:02-06-09
-       else if (version=="1.0.1")
-       {
-               loadContours(pFile);
-       }
-       
-       //AD:02-06-09
-       else if (version=="1.0.0")
-       {
-               loadContours(pFile);
-       }
+       loadContours(pFile, false);
+       loadContours(pFile, true);      
 
        fclose(pFile);
 }
 
-void wxContourMainFrame ::loadContours( FILE *pFile )
+void wxContourMainFrame ::loadContours( FILE *pFile, bool staticContour )
 {
        char tmp[255];
-       fscanf(pFile,"%s",tmp); // NumberOfContours 
-       fscanf(pFile,"%s",tmp); // ##
-       int numberOfContours = atoi(tmp);  
 
-       std::vector<int> instantVector;
-       int typeContourModel;
-       manualContourModel *manModelContour;
-       int typeView;
-       
+       if (staticContour==false)
+       {
        fscanf(pFile,"%s",tmp); // ImageDimensions
        fscanf(pFile,"%s",tmp); // X
        fscanf(pFile,"%s",tmp); // Y
@@ -802,6 +780,16 @@ void wxContourMainFrame ::loadContours( FILE *pFile )
        fscanf(pFile,"%s",tmp); // X
        fscanf(pFile,"%s",tmp); // Y
        fscanf(pFile,"%s",tmp); // Z
+       }
+       
+       fscanf(pFile,"%s",tmp); // NumberOfContours 
+       fscanf(pFile,"%s",tmp); // ##
+       int numberOfContours = atoi(tmp);  
+
+       std::vector<int> instantVector;
+       int typeContourModel;
+       manualContourModel *manModelContour;
+       int typeView;
 
        int i;
        for (i=0;i<numberOfContours;i++)
@@ -844,6 +832,12 @@ void wxContourMainFrame ::loadContours( FILE *pFile )
                        //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
                        _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
                }       
+               
+               if (staticContour==true)
+               {
+                       Instant instant(&instantVector);
+                       kernelManager->changeContourOfManager( theName , &instant );
+               }
        }// for  numberOfContours
 }
 
@@ -865,19 +859,21 @@ void wxContourMainFrame::onLoad()
                //AD:02-06-09
                if (version=="1.0.2")
                {
-                       openContours(pFile,2);
+                       openContours(pFile,2,false);
+                       openContours(pFile,2,true);     //Load StaticContours
                }
                
                //AD:02-06-09
                else if (version=="1.0.1")
                {
-                       openContours(pFile,1);
+                       openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing
+                       openContours(pFile,1,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
                }
                
                //AD:02-06-09
                else if (version=="1.0.0")
                {
-                       openContours(pFile,0);
+                       openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing
                }
 
                fclose(pFile);
@@ -907,12 +903,7 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
 
        fprintf(pFile,"--CreaContour--\n");
        fprintf(pFile,"Version %s\n", "1.0.2" );
-
-       // Normal Contours
-       lstNameThings           = kernelManager->GetLstNameThings();
-       sizeLstNameThings       = lstNameThings.size(); 
-       fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
-
+       
        vtkImageData *image = _images[0];
 
        int dimRange[3];
@@ -925,13 +916,24 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
 
        fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
 
+       // Normal Contours
+       
+       lstNameThings           = kernelManager->GetLstNameThings();
+       sizeLstNameThings       = lstNameThings.size(); 
+       fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
+
        for (i=0 ; i<sizeLstNameThings ; i++) 
        {
                kernelManager->SaveThingName( pFile, lstNameThings[i] );
                _theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] );
        }// for i
 
-       //-- Contours Statics 
+       //-- Static Contours
+
+       fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
+       
+       fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
+       
        lstNameThings           = kernelManager->GetLstNameThingsStatic();
        sizeLstNameThings       = lstNameThings.size(); 
        fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
@@ -944,18 +946,10 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
 }
 
 //AD:04-06-09
-void wxContourMainFrame::openContours( FILE *pFile, int version )
+void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticContour )
 {
        char tmp[255];
-       fscanf(pFile,"%s",tmp); // NumberOfContours 
-       fscanf(pFile,"%s",tmp); // ##
-       int numberOfContours = atoi(tmp);  
-
-       std::vector<int> instantVector;
-       int typeContourModel;
-       manualContourModel *manModelContour;
-       int typeView;
-
+       
        vtkImageData *image = _images[0];
        int imageDim[3];
        double imageSpac[3];
@@ -986,12 +980,21 @@ void wxContourMainFrame::openContours( FILE *pFile, int version )
                fscanf(pFile,"%s",tmp); // Z
                tempSpac[2] = atof(tmp);
                
-               //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 3
+               //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 2
                if (imageDim[0]!=tempDim[0] || imageDim[1]!=tempDim[1] || imageSpac[0]!=tempSpac[0] || imageSpac[1]!=tempSpac[1])
                {
                        compatible = false;
                }
        }
+       
+       fscanf(pFile,"%s",tmp); // NumberOfContours 
+       fscanf(pFile,"%s",tmp); // ##
+       int numberOfContours = atoi(tmp);  
+
+       std::vector<int> instantVector;
+       int typeContourModel;
+       manualContourModel *manModelContour;
+       int typeView;
 
        if (compatible==true)
        {
@@ -1039,7 +1042,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version )
                                _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
                        }       
 
-                       if (version==0) //StaticContours (will appear in all slices)
+                       if (staticContour) //StaticContours (will appear in all slices)
                        {
                                Instant instant(&instantVector);
                                kernelManager->changeContourOfManager( theName , &instant );
@@ -1139,7 +1142,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version )
                                _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
                        }       
 
-                       if (version==0) //StaticContours (will appear in all slices)
+                       if (staticContour) //StaticContours (will appear in all slices)
                        {
                                Instant instant(&instantVector);
                                kernelManager->changeContourOfManager( theName , &instant );
index 46b6a2ab7bc0ba6314cf110c1ddc81af0f16b274..a217f4aa6444a84ad31d3107a3bc53210435bfee 100644 (file)
@@ -238,7 +238,7 @@ class wxContourMainFrame : public wxPanel {
        void onLoad();
        void onSave();
        
-       void openContours( FILE *pFile, int version );
+       void openContours( FILE *pFile, int version, bool staticContour );
 
        void RefreshInterface();
 
@@ -396,7 +396,7 @@ private:
 
        void saveState();
        void loadState(std::string filename);
-       void loadContours( FILE *pFile );
+       void loadContours( FILE *pFile, bool staticContour );
 
        void saveFileWithContours( std::string filename );