-
-
-/* vtkExtractSurface
- double bounds[6];
- inputpolydata->GetBounds(bounds);
- double range[3];
- for (int i = 0; i < 3; ++i)
- {
- range[i] = bounds[2*i + 1] - bounds[2*i];
- }
-
- int sampleSize = inputpolydata->GetNumberOfPoints() * .00005;
- if (sampleSize < 10)
- {
- sampleSize = 10;
- }
- std::cout << "Sample size is: " << sampleSize << std::endl;
- // Do we need to estimate normals?
- vtkSmartPointer<vtkSignedDistance> distance =
- vtkSmartPointer<vtkSignedDistance>::New();
- if (inputpolydata->GetPointData()->GetNormals())
- {
- std::cout << "Using normals from input file" << std::endl;
- distance->SetInputData (inputpolydata);
- } else{
- std::cout << "Estimating normals using PCANormalEstimation" << std::endl;
- vtkSmartPointer<vtkPCANormalEstimation> normals =
- vtkSmartPointer<vtkPCANormalEstimation>::New();
- normals->SetInputData (inputpolydata);
- normals->SetSampleSize(sampleSize);
- normals->SetNormalOrientationToGraphTraversal();
- normals->FlipNormalsOn();
- distance->SetInputConnection (normals->GetOutputPort());
- }
- std::cout << "Range: "
- << range[0] << ", "
- << range[1] << ", "
- << range[2] << std::endl;
- int dimension = 256;
- double radius;
-
- radius = std::max(std::max(range[0], range[1]), range[2])
- / static_cast<double>(dimension) * 4; // ~4 voxels
-
-//EED
- radius = bbGetInputTolerance();
-
-
- std::cout << "Radius: " << radius << std::endl;
-
- distance->SetRadius(radius);
- distance->SetDimensions(dimension, dimension, dimension);
- distance->SetBounds(
- bounds[0] - range[0] * .1,
- bounds[1] + range[0] * .1,
- bounds[2] - range[1] * .1,
- bounds[3] + range[1] * .1,
- bounds[4] - range[2] * .1,
- bounds[5] + range[2] * .1);
-
-
- vtkExtractSurface *surface = vtkExtractSurface::New();
- surface->SetInputConnection (distance->GetOutputPort());
- surface->SetRadius(radius * .99 ); //
- surface->Update();
- bbSetOutputOut( surface->GetOutput() );
-*/
-
-/*vtkPoissonReconstruction
- vtkPolyData *polyData=inputpolydata;
-
- vtkSmartPointer<vtkPoissonReconstruction> surface =
- vtkSmartPointer<vtkPoissonReconstruction>::New();
- surface->SetDepth(12);
-
- int sampleSize = polyData->GetNumberOfPoints() * .00005;
- if (sampleSize < 10)
- {
- sampleSize = 10;
- }
- if (polyData->GetPointData()->GetNormals())
- {
- std::cout << "Using normals from input file" << std::endl;
- surface->SetInputData (polyData);
- }
- else
- {
- std::cout << "Estimating normals using PCANormalEstimation" << std::endl;
- vtkSmartPointer<vtkPCANormalEstimation> normals =
- vtkSmartPointer<vtkPCANormalEstimation>::New();
- normals->SetInputData (polyData);
- normals->SetSampleSize(sampleSize);
- normals->SetNormalOrientationToGraphTraversal();
- normals->FlipNormalsOff();
- surface->SetInputConnection(normals->GetOutputPort());
- }
-
- surface->Update();
- bbSetOutputOut( surface->GetOutput() );
-
-*/
-
-
-
-/*SurfaceReconstructionFilter
-
- vtkPolyData *polydata=inputpolydata;
-
- // Construct the surface and create isosurface.
- vtkSmartPointer<vtkSurfaceReconstructionFilter> surf =
- vtkSmartPointer<vtkSurfaceReconstructionFilter>::New();
- surf->SetInputData(polydata);
-
- vtkSmartPointer<vtkContourFilter> cf =
- vtkSmartPointer<vtkContourFilter>::New();
- cf->SetInputConnection(surf->GetOutputPort());
- cf->SetValue(0, 0.0);
-
- // Sometimes the contouring algorithm can create a volume whose gradient
- // vector and ordering of polygon (using the right hand rule) are
- // inconsistent. vtkReverseSense cures this problem.
- vtkSmartPointer<vtkReverseSense> reverse =
- vtkSmartPointer<vtkReverseSense>::New();
- reverse->SetInputConnection(cf->GetOutputPort());
- reverse->ReverseCellsOn();
- reverse->ReverseNormalsOn();
-
- bbSetOutputOut( reverse->GetOutput() );
-
-*/
-