]> Creatis software - creaContours.git/commitdiff
Merge remote-tracking branch 'origin/changeWx28to30' into vtk7itk4wx3
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 4 Oct 2017 12:38:53 +0000 (14:38 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 4 Oct 2017 12:38:53 +0000 (14:38 +0200)
1  2 
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx

index 39e3ac1468b3d241f5850fec1bba29cdcdcdab96,8aaa0bb954ab78dd74df584db0fdc5c959714b3c..96049d3b7e13c9ab38fd81a58e69d32632d02525
@@@ -961,7 -961,12 +961,12 @@@ void wxContourMainFrame::onLoad(
        if(GetFileLocation().empty())
        {
  //------------------------------------------------------------------------------------------------------------
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
                wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
+ #else
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_OPEN );
+ #endif
                if (dialog.ShowModal() == wxID_OK)
                {
                        fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
@@@ -1010,16 -1015,11 +1015,11 @@@ printf("EED wxContourMainFrame::SetZFor
        }// for i  list of static things
  }
  
  void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool interactiveInterface)
  {
        char tmp[255];
        char tmpD[255];
        FILE *pFile =fopen(fileNameContourROI.c_str(),"r+");
  //CMRU 03-09-09- ----------------------------------------------------------------------------------------------
        if(pFile != NULL)
        {
@@@ -1086,18 -1086,22 +1086,22 @@@ printf("EED wxContourMainFrame::onLoadC
                if(pFileData != NULL)
                {
                        fclose(pFileData);
-               }
+               } // if
        }
        _theViewPanel->getSceneManager()->removeSceneContours();
        changeInstant();
  }
  
  
void wxContourMainFrame::onImport(){
+ void wxContourMainFrame::onImport()
+ {
        std::string filename, filenamecontours;
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
        wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxOPEN );
+ #else
+       wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxFD_OPEN );
+ #endif
        if (dialog.ShowModal() == wxID_OK)
        {
                filename = dialog.GetPath().mb_str();
  
                if(filenamecontours.compare("") != 0){
                        onLoadContours(filenamecontours,true);
-               }
-       }
+               } // if
+       } // if
  }
- void wxContourMainFrame::onTest(){
+ void wxContourMainFrame::onTest()
+ {
        std::string filename, filenamecontours;
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
        wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxOPEN );
+ #else
+       wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN );
+ #endif
  
        if (dialog.ShowModal() == wxID_OK)
        {
                filename = dialog.GetPath().mb_str();
                std::cout << "This is the filename: " << filename << std::endl;
-       }
+       } // if
  }
  
  
@@@ -1127,7 -1137,12 +1137,12 @@@ void wxContourMainFrame::onSave()
        if(GetFileLocation().empty())
        {
  //------------------------------------------------------------------------------------------------------------
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
                wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
+ #else
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_SAVE );
+ #endif
                if (dialog.ShowModal() == wxID_OK)
                {
                        std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
@@@ -1682,63 -1697,33 +1697,63 @@@ printf("EED wxContourMainFrame::Segment
  
        vtkMarchingContourFilter* cntVTK = vtkMarchingContourFilter::New( );
  
 -      cntVTK->SetInput( idata );
 -
        cntVTK->SetNumberOfContours( 1 );
        cntVTK->SetValue( 0, 255 );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
 +      cntVTK->SetInput( idata );
        cntVTK->Update( );
        cntVTK->UpdateInformation();
 +#else
 +      cntVTK->SetInputData( idata );
 +#endif
  
        vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
 +
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        cpd->SetInput( cntVTK->GetOutput( ) );
        cpd->Update( );
        cpd->UpdateInformation();
 +#else
 +      cpd->SetInputData( cntVTK->GetOutput( ) );
 +#endif
 +
  
        vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
        conn->SetExtractionModeToLargestRegion( );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        conn->SetInput( cpd->GetOutput( ) );
        conn->Update( );
        conn->UpdateInformation();
 +#else
 +      conn->SetInputData( cpd->GetOutput( ) );
 +#endif
 +
  
        vtkStripper* vtkstripper = vtkStripper::New( );
 +
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        vtkstripper->SetInput( conn->GetOutput() );
        vtkstripper->Update();
        vtkstripper->UpdateInformation();
 +#else
 +      vtkstripper->SetInputData( conn->GetOutput() );
 +      cntVTK->Update();
 +#endif
  
        vtkPolyData* polyDataResult =  cntVTK->GetOutput();
        //std::cout<<"Points "<<polyDataResult->GetNumberOfPoints()<<std::endl;
 +
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        polyDataResult->Update( );
        polyDataResult->UpdateInformation();
 +#else
 +      // ..
 +#endif
  
        //EED
                /*
@@@ -1999,41 -1984,19 +2014,41 @@@ void wxContourMainFrame::SegmentationOn
  //            y = y*spc[1];
  //            z = z*spc[3];
  
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        imageReslice->SetInput( imagedata );
 +#else
 +      imageReslice->SetInputData( imagedata );
 +#endif
        imageReslice->SetInformationInput(imagedata);
        imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
        imageReslice->SetResliceAxesOrigin(0,0,z);
        imageReslice->SetOutputDimensionality(2);
        imageReslice->SetInterpolationModeToLinear();
  
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
 +      // ..
 +#else
 +      imageReslice->Update();
 +#endif
 +
        imagedata = imageReslice->GetOutput();
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        imagedata->Update();
        imagedata->UpdateInformation();
 +#else
 +      // ..
 +#endif
  
        vtkContourFilter* cntVTK = vtkContourFilter::New( );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        cntVTK->SetInput( imagedata );
 +#else
 +      cntVTK->SetInputData( imagedata );
 +#endif
  
        cntVTK->SetNumberOfContours( 1 );
        //cntVTK->SetValue( 0, vmin );
        cntVTK->UpdateInformation();
  
        vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        cpd->SetInput( cntVTK->GetOutput( ) );
 +#else
 +      cpd->SetInputData( cntVTK->GetOutput( ) );
 +#endif
        cpd->ConvertLinesToPointsOff( );
        cpd->Update( );
        cpd->UpdateInformation();
        conn->SetExtractionModeToClosestPointRegion( );
        //conn->SetMaxRecursionDepth( 3000 );
  
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        conn->SetInput( cpd->GetOutput( ) );
 +#else
 +      conn->SetInputData( cpd->GetOutput( ) );
 +#endif
  
        conn->SetClosestPoint( x, y, 0 );
        conn->Update( );
        conn->UpdateInformation();
  
        vtkCleanPolyData* cpd2 = vtkCleanPolyData::New( );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        cpd2->SetInput( conn->GetOutput( ) );
 +#else
 +      cpd2->SetInputData( conn->GetOutput( ) );
 +#endif
        cpd2->Update();
        cpd2->UpdateInformation();
  
        vtkStripper* vtkstripper = vtkStripper::New( );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        vtkstripper->SetInput( cpd2->GetOutput() );
 +#else
 +      vtkstripper->SetInputData( cpd2->GetOutput() );
 +#endif
        vtkstripper->Update();
        vtkstripper->UpdateInformation();
  
  
        vtkPolyData* polyDataResult =  vtkstripper->GetOutput();
  
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        polyDataResult->Update( );
        polyDataResult->UpdateInformation();
 +#else
 +      //...
 +#endif
  
  /* EED
  ofstream myfile;
@@@ -3142,21 -3080,10 +3157,21 @@@ void wxContourMainFrame::SaveImageResul
  // Image Value
        
        vtkImageChangeInformation *valueChInfo = vtkImageChangeInformation::New();
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        valueChInfo->SetInput(value);
 +#else
 +      valueChInfo->SetInputData(value);
 +#endif
        valueChInfo->SetSpacingScale(spc);      
        vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
 +
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        writerValueImage->SetInput( valueChInfo->GetOutput() );
 +#else
 +      writerValueImage->SetInputData( valueChInfo->GetOutput() );
 +#endif
        writerValueImage->SetFileName( (const char *)filename.mb_str() );
        writerValueImage->SetFileDimensionality( 3 );
        writerValueImage->SetCompression(false);
  
  
        vtkImageChangeInformation *maskChInfo = vtkImageChangeInformation::New();
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        maskChInfo->SetInput(mask);
 +#else
 +      maskChInfo->SetInputData(mask);
 +#endif
        maskChInfo->SetSpacingScale(spc);       
        vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
 +
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
        writerMaskImage->SetInput( maskChInfo->GetOutput() );
 +#else
 +      writerMaskImage->SetInputData( maskChInfo->GetOutput() );
 +#endif
 +
        writerMaskImage->SetFileName( (const char *)filename.mb_str() );
        writerMaskImage->SetFileDimensionality( 3 );
        writerMaskImage->SetCompression(false);