]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
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;
 }