]> Creatis software - creaContours.git/commitdiff
no message
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 29 Jun 2009 11:05:56 +0000 (11:05 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 29 Jun 2009 11:05:56 +0000 (11:05 +0000)
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/128002
lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/2.session

index 7bf581dc8ae2e0c7ae677ca7258eedb2045bf266..1597c26c53b792ccd2911433fc98801b3f4d206a 100644 (file)
@@ -592,8 +592,8 @@ std::vector<std::string> interfMainPanel::getOutlinesName(int slide){
        return wxContourMainFrame::getInstance()->getOutlinesName(slide);
 }
 
-void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ){
-       wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ);
+void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax){
+       wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax);
 }
 
 void interfMainPanel::setStringInfoPanel(wxString tmpString){
@@ -624,10 +624,10 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString){
 }
 
 void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, 
-                                                                       int typeContourGroup, bool XYZValues, bool contourImage, bool statistics)
+                                                                       int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics)
 {
        wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename, 
-               typeContourGroup, XYZValues, contourImage, statistics);
+               typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics);
 }
 
 wxString interfMainPanel::getCellValue(int j,int i){
@@ -756,9 +756,9 @@ void interfMainPanel::onThresholdPressed()
        showPanel(thresholdPanel);
 }
 
-void interfMainPanel::ShowResultImages(int typeContourGroup)
+void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
 {
-       wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup);
+       wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ);
 }
 
 
index 6e9f6f30d8ac6afb27ed85ca64e3b83813dac4fa..0e85143eca89da36511e17e45617d011f63a4fa3 100644 (file)
@@ -186,7 +186,7 @@ public:
 
        std::vector<std::string> getOutlinesName(int slide);
 
-       void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ);
+       void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
 
        void setStringInfoPanel(wxString tmpString);    
 
@@ -201,7 +201,7 @@ public:
        void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
 
        void onSaveResults(std::string directory,std::string namefile, std::string filename,
-               int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
+               int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
 
        wxString getCellValue(int j,int i);
 
@@ -209,7 +209,7 @@ public:
 
        virtual bool Show(bool show);
 
-       void ShowResultImages(int typeContourGroup);
+       void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
        
 private:
        
index 145d5110f8dc1dfe4dd1474f41cb6870b5b300d2..5b2b1c29b241c53dceda1b6d718795c17a46899a 100644 (file)
@@ -188,8 +188,8 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
        wxString lstOptions[4];
        lstOptions[0]=_T("Current Slice");
        lstOptions[1]=_T("Range Slices");
-       lstOptions[2]=_T("All Slices");
-       _informationRadiobox                                                    = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+//     lstOptions[2]=_T("All Slices");
+       _informationRadiobox                                                    = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
 
        wxString lstOptContOperation[5];
        lstOptContOperation[0]=_T("AND");
@@ -266,7 +266,7 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent)
                 wxPoint( 0, 0 ),
                 wxSize( 200, 500 ) );
 
-       int i,gridCol=10,gridRow=sizeZ;
+       int i,gridCol=10,gridRow=sizeZ+2;
        _grid->CreateGrid( 0, 0 );
        _grid->AppendRows(gridRow);
        _grid->AppendCols(gridCol);
@@ -327,8 +327,11 @@ void interfInformationPanel::onInformationContourLabels(wxCommandEvent& event){
 void interfInformationPanel::onShowResultImages(wxCommandEvent& event)
 {
 //     onExtractInformation( event );
+       int selection           = _informationRadiobox->GetSelection();
+       int minZ                        = _mbarrangeSliceInformation->GetStart();
+       int maxZ                        = _mbarrangeSliceInformation->GetEnd();
        int typeContourGroup = _radiolstboxContourGroup->GetSelection();
-       interfMainPanel::getInstance()->ShowResultImages( typeContourGroup );   
+       interfMainPanel::getInstance()->ShowResultImages( typeContourGroup , selection, minZ, maxZ);    
 }
 
 
@@ -337,11 +340,13 @@ void interfInformationPanel::onExtractInformation(wxCommandEvent& event){
        _grid->ClearGrid();
 
        int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-       int selection = _informationRadiobox->GetSelection();
-       int minZ        = _mbarrangeSliceInformation->GetStart();
-       int maxZ        = _mbarrangeSliceInformation->GetEnd();
-
-       interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ);    
+       int selection           = _informationRadiobox->GetSelection();
+       int minZ                        = _mbarrangeSliceInformation->GetStart();
+       int maxZ                        = _mbarrangeSliceInformation->GetEnd();
+       int     grayRangeMin    = _mbarrangeRangeInformation->GetStart();
+       int     grayRangeMax    = _mbarrangeRangeInformation->GetEnd();
+       
+       interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax);  
 }
 
 void interfInformationPanel::onSaveResults(wxCommandEvent& event)
@@ -350,12 +355,17 @@ void interfInformationPanel::onSaveResults(wxCommandEvent& event)
        if (dialog.ShowModal() == wxID_OK)
        {
                onExtractInformation( event );
+               int selection           = _informationRadiobox->GetSelection();
+               int minZ                        = _mbarrangeSliceInformation->GetStart();
+               int maxZ                        = _mbarrangeSliceInformation->GetEnd();
                std::string directory=(const char *)(dialog.GetDirectory().mb_str());
                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, _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue());
+                       typeContourGroup,
+                       selection,minZ,maxZ,
+                       _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue());
        }
 }
 
@@ -390,8 +400,16 @@ void interfInformationPanel::FillGridWithContoursInformation(){
                        //tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ;
                        tempString = wxString(lstContourThings[ii].c_str(),wxConvUTF8) ;
                        _grid->SetCellValue( z, ii, tempString );
-               }
-       }
+               } // for ii
+       }// for z
+       
+       // Last line
+       _grid->SetRowLabelValue(sizeZ, _T(" ") );
+       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+       {
+               _grid->SetCellValue( sizeZ, ii, _T(" ") );
+       } // for ii
+       
 }
 
 void interfInformationPanel::setStringInfoPanel(wxString tmpString){
index 58c3ec6f7c557cbc62cf6ae3d74dd5c4dc7d4e9d..aef8ba2b6772a6957d5cf48781d293730da80891 100644 (file)
@@ -593,11 +593,11 @@ bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ){
 
 
 
-void wxContourMainFrame::ShowResultImages(int typeContourGroup)
+void wxContourMainFrame::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
 {
        vtkImageData * mask;
        vtkImageData * value;
-       this->getMaskValue(&mask, &value, typeContourGroup);
+       this->getMaskValue(&mask, &value, typeContourGroup, selection, minZ, maxZ);
        
        std::vector<int> nTypeView;
        nTypeView.push_back(5);
@@ -2374,12 +2374,12 @@ void wxContourMainFrame::GenerateContourExtractData()
 }
 
 
-void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ)
+void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax)
 {
        GenerateContourExtractData();
        
+       wxString tempString;
        int maxContourGroup     =       0;
-
        
        _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
@@ -2402,7 +2402,7 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        _instantPanel->getInstant( tempVector );
 
        vtkImageData *imagedata = _theViewPanel->getImageData();
-       int sizeZ = _theViewPanel->GetImageDataSizeZ();
+//     int sizeZ = _theViewPanel->GetImageDataSizeZ();
        int z;
        int ii,sizeLstContourThings;
 
@@ -2412,23 +2412,14 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        double porcent; 
        wxString tmpString;
 
-       
+//?????        
 
        if (selection==0 ) // actual slice
        {
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
                int actualSlice = tempVector[1];
                minZ    = actualSlice;
                maxZ    = actualSlice;
-       }
-       else if (selection==2 ) // All slices
-       {
-               minZ    = 0;
-               maxZ    = sizeZ-1;
-       }
-       else if (selection==1 ) // slice range
-       {
+       }       else  {  // slice range
                minZ    = minimumZ;
                maxZ    = maximumZ;
        }
@@ -2437,6 +2428,8 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        totalZ  = maxZ-minZ+1;
        _contourextractdata->SetImage( imagedata);
 
+       _contourextractdata->InitVolumeStatistics();
+       
 // For each slice..
        for ( z=minZ ; z<=maxZ ; z++ )
        {
@@ -2464,7 +2457,6 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                lstManConModExp =  kernelManager->ExploseEachModel( lstManConMod );
 
 
-               wxString tempString;
                tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
                interfMainPanel::getInstance()->setRowLabelInfoPanel(z, tempString);
                //_grid->SetRowLabelValue(z, tempString );
@@ -2507,8 +2499,8 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                                                                                                                &pLstValuePosZ);
                        // Statistics of each slice.
                        _contourextractdata->Statistics( &pLstValue,
-                                                                                       minimumZ,
-                                                                                       maximumZ,
+                                                                                       grayRangeMin,
+                                                                                       grayRangeMax,
                                                                                        &resultGrayRangeCount, 
                                                                                        &resultSize, 
                                                                                        &resultMin, 
@@ -2545,6 +2537,45 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                } // for iContourGroup
        } // for z
 
+       // Print Volume Statistics
+
+
+       int             vol_rCountRange; 
+       int             vol_rsize;
+       double  vol_minValue;
+       double  vol_maxValue;
+       double  vol_average;
+       double  vol_standardeviation;
+       
+       if (selection!=0 ) // actual slice
+       {
+
+               _contourextractdata->GetVolumeStatistics(&vol_rCountRange, &vol_rsize,
+                                                                                                &vol_minValue, &vol_maxValue,
+                                                                                                &vol_average, &vol_standardeviation);
+
+               interfMainPanel::getInstance()->setRowLabelInfoPanel(maxZ+2, _T("Total:"));
+       
+               tempString.Printf(_T("%d"),vol_rsize);
+               interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 0, tempString);   
+       
+               tempString.Printf(_T("%d"),vol_rCountRange);
+               interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 1, tempString);
+       
+               tempString.Printf(_T("%f"),vol_minValue);
+               interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 2, tempString);
+       
+               tempString.Printf(_T("%f"),vol_maxValue);
+               interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 3, tempString);
+       
+               tempString.Printf(_T("%f"),vol_average);
+               interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 4, tempString);
+       
+               tempString.Printf(_T("%f"),vol_standardeviation);
+               interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 5, tempString);
+       }
+       //-----------------------------------------
+       
        int iTitleGroup;
        wxString tmpTitleString;
        int tmpIntB;
@@ -2561,14 +2592,13 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 4, _T("Average") );
                interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 5, _T("St.Dev.") );
                interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 6, _T(" ") );
-       }
-
+       }// for title
        interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
 }
 
 //AD: 29-05-09
 void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, 
-       int typeContourGroup, bool XYZValues, bool contourImage, bool statistics)
+       int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics)
 {
        if (XYZValues)
        {
@@ -2579,7 +2609,7 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil
        {
                vtkImageData * mask;
                vtkImageData * value;
-               this->getMaskValue(&mask, &value, typeContourGroup);
+               this->getMaskValue(&mask, &value, typeContourGroup,selection,minZ,maxZ);
                this->SaveImageResult( directory , namefile, mask, value);
        }
        
@@ -2591,23 +2621,38 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil
 
                FILE *pFile=fopen(name.str().c_str(),"w+");
 
-               int sizeZ = _theViewPanel->GetImageDataSizeZ();
 
                wxString tmpString;
-               int i,j,maxX,maxY=sizeZ;
+               int i,j,maxX;
+               
+//             int sizeZ = _theViewPanel->GetImageDataSizeZ();
+//             int maxY=sizeZ+2;
+               
                maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols();
 
+               // -- Title --
                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,"slice\t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle );
                }
-               fprintf(pFile,"\n" );
-
-
+               fprintf(pFile,"\n\n" );
 
-               for ( j=0; j<maxY ; j++)
+               
+// ??????
+               
+               if (selection==0 ) // actual slice
+               {
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int actualSlice = tempVector[1];
+                       minZ    = actualSlice;
+                       maxZ    = actualSlice;
+               }
+               
+               // Stadistics...
+               for ( j=minZ; j<=maxZ ; j++)
                {
                        fprintf(pFile,"%d\t" , j );
                        for (i=0 ; i<maxX ; i++){
@@ -2617,6 +2662,18 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil
                        fprintf(pFile,"\n"  );
                } // for j
 
+               
+               // Total of stadistics.....
+               if (selection!=0)
+               {
+                       fprintf(pFile,"\n Total:\t"  );
+                       for (i=0 ; i<maxX ; i++){
+                               tmpString = interfMainPanel::getInstance()->getCellValue(maxZ+2, i);//_grid->GetCellValue( maxZ+2 , i );
+                               fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
+                       } // for i
+                       fprintf(pFile,"\n"  );
+               }
+               
                fclose(pFile);
        }
 }
@@ -2749,7 +2806,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
 
 }
 
-void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup){
+void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ){
        wxBusyCursor wait;
        GenerateContourExtractData();
 
@@ -2768,25 +2825,29 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value
        _instantPanel->getInstant( tempVector );
 
        vtkImageData *imagedata = _theViewPanel->getImageData();
-       int sizeZ = _theViewPanel->GetImageDataSizeZ();
        int z;
        int ii,sizeLstContourThings;
 
 
-       int minZ,maxZ;
        double totalZ;
        double porcent; 
 
        wxString tmpString;
-
-       minZ    = 0;// _mbarrange->GetStart();
-       maxZ    = sizeZ;//_mbarrange->GetEnd();
-       totalZ  = maxZ-minZ+1;
+       
+       
+       if (selection==0 ) // actual slice
+       {
+               int actualSlice = tempVector[1];
+               minZ    = actualSlice;
+               maxZ    = actualSlice;
+       }       
+       
+       totalZ  = maxZ-minZ;
 
        _contourextractdata->SetImage( imagedata);
 
 // For each slice..
-       for ( z=0 ; z<sizeZ ; z++)
+       for ( z=minZ ; z<=maxZ ; z++)
        {
 
                porcent = 100.0* (z-minZ)/totalZ;
index f686c62036221de2266b7c01aede70874e79e0fb..1e464e91928dfc49d66776a6d938a075b2d3af6c 100644 (file)
@@ -152,8 +152,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, int selection, int minZ, int maxZ);
 
        void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
 
@@ -294,10 +293,10 @@ class wxContourMainFrame : public wxPanel {
 
        std::vector<std::string> getOutlinesName(int slide);
 
-       void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
+       void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax);
 
        void onSaveResults(std::string directory,std::string namefile, std::string filename, 
-               int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
+               int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
 
        void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
 
@@ -309,7 +308,7 @@ class wxContourMainFrame : public wxPanel {
 
        void saveFileWithContoursAutomatique();
        
-       void ShowResultImages(int typeContourGroup);
+       void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ );
 
 
 private:
index ea4ad494208f26be7bc4502a02bc00def6b92ce9..31932cdfbd41626ac3989c4b24d6f3075dc4d045 100644 (file)
@@ -1,6 +1,6 @@
 format 66
 "GeneralArchitecture" // GeneralArchitecture
-  revision 4
+  revision 6
   modified_by 2 "davila"
   // class settings
   //class diagram settings
@@ -786,7 +786,7 @@ ${inlines}
       end
     end
 
-    sequencediagram 129154 "Sequence diagram btnLabels"
+    sequencediagram 129154 "Sequence diagram btnStatistics"
       show_full_operations_definition default write_horizontally default class_drawing_mode default drawing_language default draw_all_relations default shadow default show_stereotype_properties default
       overlapping_bars size A4
     end
index 4ac2592143dd6cad0ce51ab7ec72f2e6c7ee2c95..89cddb2a4f2ae00a2f6075fd33b96fae24ef7aab 100644 (file)
@@ -1,13 +1,13 @@
-window_sizes 1005 825 189 810 698 70
+window_sizes 1070 859 329 735 732 70
 diagrams
   active  classdiagram_ref 128002 // GeneralArchitecture
-    806 678 100 4 556 0
-  sequencediagram_ref 129154 // Sequence diagram btnLabels
-    531 558 100 4 0 161
+    731 712 100 4 420 11
+  sequencediagram_ref 129154 // Sequence diagram btnStatistics
+    664 712 100 4 0 7
   sequencediagram_ref 129282 // Sequnce diagram btnSave
-    560 558 100 4 0 161
+    560 558 100 4 0 0
   sequencediagram_ref 129410 // Sequence diagram btnShowImageResult
-    560 558 100 4 0 51
+    990 709 100 4 0 0
 end
 show_stereotypes
 selected classdiagram_ref 128002 // GeneralArchitecture