]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authordonadio <donadio>
Fri, 29 May 2009 08:25:20 +0000 (08:25 +0000)
committerdonadio <donadio>
Fri, 29 May 2009 08:25:20 +0000 (08:25 +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

index 4f75c89106ed1713e3d62410da764d71ddcaf666..8750c4fc6d8308731a49f27709123e88f54b00f6 100644 (file)
@@ -562,9 +562,9 @@ 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->SetSize( wxSize(500,450) );
+               infoWin->SetSize( wxSize(825,650) );
                
-               wxSize sizepanel(200,300);
+               wxSize sizepanel(825,675);
                informationPanel                                                                        = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
 
                wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
@@ -627,8 +627,11 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString){
 
 }
 
-void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){
-       wxContourMainFrame::getInstance()->onSaveResults(directory, namefile,filename, typeContourGroup);
+void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, 
+                                                                       int typeContourGroup, bool XYZValues, bool contourImage, bool statistics)
+{
+       wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename, 
+               typeContourGroup, XYZValues, contourImage, statistics);
 }
 
 wxString interfMainPanel::getCellValue(int j,int i){
index e9663c27733bbc076e4db51649310d64b7dd79f0..8f5224cfbc47a8965f1abd0622dc8ae3e0afc5cb 100644 (file)
@@ -202,7 +202,8 @@ public:
 
        void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
 
-       void onSaveResults(std::string directory,std::string namefile, std::string filename,int typeContourGroup);
+       void onSaveResults(std::string directory,std::string namefile, std::string filename,
+               int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
 
        wxString getCellValue(int j,int i);
 
index ea46142b8f9c0ccd0c8873c192a9a0bf0b42852c..08f736097b34d432237b9bcbfdf7dc353bcad5a3 100644 (file)
@@ -179,8 +179,8 @@ void interfSpreadPanel::setStringSpread(std::string stringtemp){
 ** Begin of information panel
 **/
 interfInformationPanel::interfInformationPanel(wxWindow * parent)
-: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN){
-
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+{
        //wxPanel *panel                                                                        = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
        wxString lstOptions[4];
        lstOptions[0]=_T("Current Slice");
@@ -195,6 +195,15 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
        lstOptContOperation[3]=_T("ALL");
        _radiolstboxContourGroup                                                = new wxRadioBox(this, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
 
+       _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") );
+       _XYZValues->SetValue(true);
+
+       _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") );
+       _contourImage->SetValue(true);  
+
+       _statistics = new wxCheckBox(this, -1, _T("Save Statistics") );
+       _statistics->SetValue(true);
+
        wxButton *informationContourLabelsBtn                   = new wxButton(this,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
        informationContourLabelsBtn->SetEventHandler( this );
        Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onInformationContourLabels ); 
@@ -203,7 +212,7 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
        statisticsContourBtn->SetEventHandler( this );
        Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation ); 
 
-       wxButton *saveResultsBtn                                                = new wxButton(this,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
+       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 ); 
 
@@ -240,19 +249,12 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
        _mbarrangeRangeInformation-> SetStart( (int)range[0] );
        _mbarrangeRangeInformation-> SetEnd( (int)range[1] );  
 
-
-       _staticTextInformation                                                  = new wxStaticText(this,-1,_T("    "));
-
-
-//                     wxButton *XXXXXXXBtn                    = new wxButton(this,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
-//                     XXXXXXXBtn->SetEventHandler( this );
-//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
-
+       _staticTextInformation  = new wxStaticText(this,-1,_T("    "));
 
        _grid = new wxGrid( this,
                 wxID_ANY,
                 wxPoint( 0, 0 ),
-                wxSize( 100, 100 ) );
+                wxSize( 200, 500 ) );
 
        int i,gridCol=10,gridRow=sizeZ;
        _grid->CreateGrid( 0, 0 );
@@ -268,29 +270,33 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
 
        FillGridWithContoursInformation();
 
+       wxFlexGridSizer * sizerSave             = new wxFlexGridSizer(2,2);
+       sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: "))  , 1, wxGROW );
+       sizerSave->Add( _XYZValues, 1, wxALL ,2 );
+       sizerSave->Add( _statistics, 1, wxALL ,2 );
+       sizerSave->Add( _contourImage, 1, wxALL ,2 );
+
        wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
        sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
        sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
+       sizerA->Add( sizerSave          , 1, wxALL ,2 );
+
 
        wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
-       sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
-       sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
-       sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
+       sizerB->Add( informationContourLabelsBtn, 1, wxALL ,2 );
+       sizerB->Add( statisticsContourBtn, 1, wxALL ,2 );
+       sizerB->Add( saveResultsBtn, 1, wxALL ,2 );
 
-       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-       sizer->AddGrowableCol(0);
-       sizer->AddGrowableRow(7);
+       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1,8);
        sizer->Add( sizerA                                              , 1, wxALL              , 0 );
        sizer->Add( new wxStaticText(this               ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
        sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
        sizer->Add( new wxStaticText(this               ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
        sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
-       sizer->Add( sizerB                                              , 1, wxALL              , 0 );
-       sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
+       sizer->Add( sizerB                                              , 1, wxEXPAND           , 0 );
+       sizer->Add( _staticTextInformation              , 1, wxEXPAND           , 0 );
        sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
 
-
-
        this->SetSizer( sizer );
        this->SetSize( wxSize(1500,1500) );
        //this->SetBackgroundColour( wxColour(100,100,100) );
@@ -318,7 +324,8 @@ void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
 
        
 }
-void interfInformationPanel::onSaveResults(wxCommandEvent& event){
+void interfInformationPanel::onSaveResults(wxCommandEvent& event)
+{
        wxFileDialog dialog(this, _T("Choose a file"), _T(""), _T(""), _T("*.txt"), wxSAVE );
        if (dialog.ShowModal() == wxID_OK)
        {
@@ -327,7 +334,8 @@ void interfInformationPanel::onSaveResults(wxCommandEvent& event){
                std::string namefile=(const char *)(dialog.GetFilename().mb_str());
                std::string filename = (const char *)(dialog.GetPath().mb_str() );
                int typeContourGroup = _radiolstboxContourGroup->GetSelection();
-               interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename, typeContourGroup);
+               interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename, 
+                       typeContourGroup, _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue());
        }
 }
 
index c26d5dd4ab9c03f30a300edc4da3461b5b179930..396579bf09f48104a149d22c88f0e4ae61704404 100644 (file)
@@ -75,7 +75,10 @@ private:
        wxRadioBox* _informationRadiobox;
        wxRadioBox* _radiolstboxContourGroup;
        wxStaticText* _staticTextInformation;
-       
+       wxCheckBox* _XYZValues; 
+       wxCheckBox* _contourImage;      
+       wxCheckBox* _statistics;        
+
        void onInformationContourLabels(wxCommandEvent& event);
        void onExtractInformation(wxCommandEvent& event);
        void onSaveResults(wxCommandEvent& event);
index 80caa583baf24919e62ffee61709d9b9a1f01d11..4261ef1ee6b6c15d9e272d986921fa462ecf9ae8 100644 (file)
@@ -2054,7 +2054,8 @@ std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide){
        return kernelManager->getOutlinesNameAtInstant(tempVector);
 }
 
-void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ){
+void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ)
+{
        int maxContourGroup     =       0;
 
        ContourExtractData      *contourextractdata = new ContourExtractData();
@@ -2126,7 +2127,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);
@@ -2245,43 +2246,54 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        delete contourextractdata;
 }
 
-void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){
-    SaveValuesXYZ( directory , namefile, typeContourGroup );
-
-       vtkImageData* mask, *value;
-       this->getMaskValue(mask, value, typeContourGroup);
-       this->SaveImageResult( directory , namefile, mask, value);
+void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, 
+       int typeContourGroup, bool XYZValues, bool contourImage, bool statistics)
+{
+       if (XYZValues)
+       {
+               SaveValuesXYZ( directory , namefile, typeContourGroup );
+       }
 
+       if (contourImage)
+       {
+               vtkImageData * mask;
+               vtkImageData * value;
+               this->getMaskValue(&mask, &value, typeContourGroup);
+               this->SaveImageResult( directory , namefile, mask, value);
+       }
        
-       FILE *pFile=fopen(filename.c_str(),"w+");
+       if (statistics)
+       {
+               FILE *pFile=fopen(filename.c_str(),"w+");
 
-       int sizeZ = _theViewPanel->GetImageDataSizeZ();
+               int sizeZ = _theViewPanel->GetImageDataSizeZ();
 
-       wxString tmpString;
-       int i,j,maxX,maxY=sizeZ;
-       maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols();
+               wxString tmpString;
+               int i,j,maxX,maxY=sizeZ;
+               maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols();
 
-       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 );
-       }
-       fprintf(pFile,"\n" );
+               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 );
+               }
+               fprintf(pFile,"\n" );
 
 
 
-       for ( j=0; j<maxY ; j++)
-       {
-               fprintf(pFile,"%d\t" , j );
-               for (i=0 ; i<maxX ; i++){
-                       tmpString = interfMainPanel::getInstance()->getCellValue(j, i);//_grid->GetCellValue( j , i );
-                       fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
-               } // for i
-               fprintf(pFile,"\n"  );
-       } // for j
+               for ( j=0; j<maxY ; j++)
+               {
+                       fprintf(pFile,"%d\t" , j );
+                       for (i=0 ; i<maxX ; i++){
+                               tmpString = interfMainPanel::getInstance()->getCellValue(j, i);//_grid->GetCellValue( j , i );
+                               fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
+                       } // for i
+                       fprintf(pFile,"\n"  );
+               } // for j
 
-       fclose(pFile);
+               fclose(pFile);
+       }
 }
 
 void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefile,int typeContourGroup)
@@ -2410,7 +2422,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
        delete contourextractdata;
 }
 
-void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup){
+void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup){
        wxBusyCursor wait;
        ContourExtractData      *contourextractdata = new ContourExtractData( true );
        //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
@@ -2494,8 +2506,8 @@ void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int
                } // for  iContourGroup
        } // for z
 
-       value = contourextractdata->GetVtkImageValueResult();
-       mask = contourextractdata->GetVtkImageMaskResult();
+       (*value) = contourextractdata->GetVtkImageValueResult();
+       (*mask) = contourextractdata->GetVtkImageMaskResult();
        delete contourextractdata;
 }
 
index 4f34fdbd8662f247b362b2a76625f40334e8bbc0..91eac838062a93c4df7b667418fc6ce43c76a1b5 100644 (file)
@@ -153,7 +153,7 @@ class wxContourMainFrame : public wxPanel {
        void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
 
 
-       void getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup);
+       void getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup);
 
        void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
 
@@ -296,7 +296,8 @@ class wxContourMainFrame : public wxPanel {
 
        void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
 
-       void onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup);
+       void onSaveResults(std::string directory,std::string namefile, std::string filename, 
+               int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
 
        void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);