[vtkusers] Problem with vtkSmoothPolyDataFilter
Darshan Pai
darshanpai at gmail.com
Fri Mar 2 01:54:59 EST 2012
Hello All,
I have been moving some of my old projects which are on VTK4.4 onto the new
VTK nightly build .
Following is the code I am using
vtkSmartPointer<vtkImageThreshold> renderThreshold =
vtkSmartPointer<vtkImageThreshold>::New();
renderThreshold->ThresholdBetween(0, 0);
renderThreshold->SetInValue(0);
renderThreshold->SetOutValue(1);
renderThreshold->SetInput(ribbonsurface);
vtkSmartPointer<vtkImageIslandRemoval2D> renderIslandRemoval2D1 =
vtkSmartPointer<vtkImageIslandRemoval2D>::New();
renderIslandRemoval2D1->SetInputConnection(renderThreshold->GetOutputPort());
renderIslandRemoval2D1->SetAreaThreshold(100);
renderIslandRemoval2D1->SetIslandValue(1);
renderIslandRemoval2D1->SetReplaceValue(0);
vtkSmartPointer<vtkImageIslandRemoval2D> renderIslandRemoval2D2 =
vtkSmartPointer<vtkImageIslandRemoval2D>::New();
renderIslandRemoval2D2->SetInputConnection(renderIslandRemoval2D1->GetOutputPort());
renderIslandRemoval2D2->SetAreaThreshold(100);
renderIslandRemoval2D2->SetIslandValue(0);
renderIslandRemoval2D2->SetReplaceValue(1);
vtkSmartPointer<vtkImageContinuousErode3D> renderContinuousErode3D
= vtkSmartPointer<vtkImageContinuousErode3D>::New();
renderContinuousErode3D->SetInputConnection(renderIslandRemoval2D2->GetOutputPort());
renderContinuousErode3D->SetKernelSize(3, 3, 3);
vtkSmartPointer<vtkImageContinuousDilate3D>
renderContinuousDilate3D =
vtkSmartPointer<vtkImageContinuousDilate3D>::New();
renderContinuousDilate3D->SetInputConnection(renderContinuousErode3D->GetOutputPort());
renderContinuousDilate3D->SetKernelSize(4, 4, 4);
vtkSmartPointer<vtkContourFilter> renderContourFilter =
vtkSmartPointer<vtkContourFilter>::New();
renderContourFilter->SetInputConnection(renderContinuousDilate3D->GetOutputPort());
renderContourFilter->SetValue(0,1);
vtkSmartPointer<vtkSmoothPolyDataFilter> renderSmoothPolyDataFilter
= vtkSmartPointer<vtkSmoothPolyDataFilter>::New();
renderSmoothPolyDataFilter->SetInputConnection(renderContourFilter->GetOutputPort());
renderSmoothPolyDataFilter->SetNumberOfIterations(20);
renderSmoothPolyDataFilter->SetRelaxationFactor(0.15);
renderSmoothPolyDataFilter->SetFeatureAngle(40);
renderSmoothPolyDataFilter->FeatureEdgeSmoothingOff();
renderSmoothPolyDataFilter->BoundarySmoothingOff();
renderSmoothPolyDataFilter->SetConvergence(0);
renderSmoothPolyDataFilter->Update();
vtkSmartPointer<vtkPolyDataMapper> ribbonpolydata =
vtkSmartPointer<vtkPolyDataMapper>::New();
ribbonpolydata->SetInputConnection(renderSmoothPolyDataFilter->GetOutputPort());
ribbonactor = vtkSmartPointer<vtkActor>::New();
ribbonactor->SetMapper(ribbonpolydata);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120302/c2255a38/attachment.htm>
More information about the vtkusers
mailing list