X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_ManagerContour_NDimensions%2FwxContourMainFrame.cxx;h=39e3ac1468b3d241f5850fec1bba29cdcdcdab96;hb=2995826ee50f882a609e7350780ffc7bea0e7db2;hp=a63bd56add5a897caead3eaf47b23e03bab94904;hpb=242e4c37e5e22bcba90456327564ea9b3d1d6274;p=creaContours.git diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index a63bd56..39e3ac1 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -1194,11 +1194,22 @@ void wxContourMainFrame::saveFileWithContours( std::string filename ) fprintf(pFileData,"NumberOfContours %d\n", sizeLstNameThings ); //------------------------------------------------------------------------------------------------------------ + +// EED 2017-05-30 + double spc[3]; + spc[0]=1; + spc[1]=1; + spc[2]=1; + for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); - double sizeInPixel = manualModel ->GetPathSize(); + +// EED 2017-05-30 +// double sizeInPixel = manualModel ->GetPathSize( ); + double sizeInPixel = manualModel ->GetPathSize( spc ); + double realContourSize = sizeInPixel*_onePixelSize; manualModel ->SetRealSize(realContourSize); //------------------------------------------------------------------------------------------------------------ @@ -1671,33 +1682,63 @@ printf("EED wxContourMainFrame::SegmentationOneSliceITK Skypping this code. No 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 "<GetNumberOfPoints()<Update( ); polyDataResult->UpdateInformation(); +#else + // .. +#endif //EED /* @@ -1958,19 +1999,41 @@ void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue // 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 ); @@ -1981,7 +2044,12 @@ void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue 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(); @@ -1990,27 +2058,47 @@ void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue 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; @@ -3054,10 +3142,21 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef // 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); @@ -3072,10 +3171,22 @@ void wxContourMainFrame::SaveImageResult(std::string directory,std::string namef 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); @@ -3176,7 +3287,7 @@ wxPanel *wxContourMainFrame::getColorLayerImageViewPanel(wxWindow *parent) _theViewPanel->getImageData()->GetScalarRange(range); int min = (int)floor (range[0]); int max = (int)ceil (range[1]); - _viewColorLayerImagePanel = new ColorLayerImageViewPanel( parent, min, max , 1); + _viewColorLayerImagePanel = new ColorLayerImageViewPanel( parent, min, max, 100, 1); _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , _theViewPanel->getWxVtkBaseView() ); } return _viewColorLayerImagePanel; @@ -3227,10 +3338,18 @@ double wxContourMainFrame::getContourSizeInPixels() std::string cloneName = currentSelection [0]; manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel(); - contourSize = manualModel-> GetPathSize(); + +// EED 2017-05-30 +// contourSize = manualModel->GetPathSize(); + double spc[3]; + spc[0]=1; + spc[1]=1; + spc[2]=1; + contourSize = manualModel->GetPathSize( spc ); } return contourSize; } + manualBaseModel * wxContourMainFrame::getContour () { std::vector currentSelection = _theViewPanel->getSelectedObjects(); @@ -3260,9 +3379,16 @@ void wxContourMainFrame::onPrintLabel (wxString label, manualBaseModel* manualMo } void wxContourMainFrame::onInsertCalculation(manualBaseModel* manualModel) { - double sizeInPixel = manualModel ->GetPathSize(); +// EED 2017-05-30 +// double sizeInPixel = manualModel ->GetPathSize( ); + double spc[3]; + spc[0]=1; // ???? + spc[1]=1; // ???? + spc[2]=1; // ???? + double sizeInPixel = manualModel ->GetPathSize( spc ); + double onePixelRealSize = interfMainPanel::getInstance()->GetPixelValue();; - double realContourSize = sizeInPixel*onePixelRealSize; + double realContourSize = sizeInPixel*onePixelRealSize; manualModel ->SetRealSize(realContourSize); }