]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
index 34182bdfeca0d59f525d589d6bfb145e2f30dcd4..bb5f01f8eab6ec0cf64e949ffde4294ad90b3064 100644 (file)
@@ -2093,7 +2093,10 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
 
 void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){
     SaveValuesXYZ( directory , namefile, typeContourGroup );
-       SaveImageResult( directory , namefile, typeContourGroup);
+
+       vtkImageData* mask, *value;
+       this->getMaskValue(mask, value, typeContourGroup);
+       this->SaveImageResult( directory , namefile, mask, value);
 
        
        FILE *pFile=fopen(filename.c_str(),"w+");
@@ -2253,8 +2256,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
        delete contourextractdata;
 }
 
-void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, int typeContourGroup)
-{
+void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup){
        wxBusyCursor wait;
        ContourExtractData      *contourextractdata = new ContourExtractData( true );
        //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
@@ -2333,20 +2335,19 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
                        }
 
                        contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-
-//                             for (ii=0 ; ii<sizeLstContourThings ; ii++)
-//                             {
-//                                     ContourThing **contourthing = lstContourThings[ii];
-//                                     lstManConMod.push_back( (*contourthing)->getModel() );
-//                             }
-//                             contourextractdata->SetLstManualContourModel( lstManConMod );
-
                        contourextractdata->CalculateImageResult(); // with actual Z
 
                } // for  iContourGroup
        } // for z
 
+       value = contourextractdata->GetVtkImageValueResult();
+       mask = contourextractdata->GetVtkImageMaskResult();
+       delete contourextractdata;
+}
+
+void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value)
+{
+       
        std::string temp = directory + "/" + namefile + "-Value.mhd";
 
        wxString filename = crea::std2wx(temp);
@@ -2360,7 +2361,7 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
 
 // Image Value
        vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
-       writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
+       writerValueImage->SetInput( value );
        writerValueImage->SetFileName( (const char *)filename.mb_str() );
        writerValueImage->SetFileDimensionality( 3 );
        writerValueImage->Write( );
@@ -2379,15 +2380,17 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef
        filename.append(_T("-Mask.mhd"));*/
 
        vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
-       writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
+       writerMaskImage->SetInput( mask );
        writerMaskImage->SetFileName( (const char *)filename.mb_str() );
        writerMaskImage->SetFileDimensionality( 3 );
        writerMaskImage->Write( );
 
        interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
-       delete contourextractdata;
+       
 }
 
+
+
 void wxContourMainFrame::onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow){
        if( name.compare( _theViewPanel->getVerticalConceptName() ) == 0){
                _theViewPanel->setActualVertical( value);