[vtkusers] Fwd: Problem with vtksmoothPolyDataFilter

Darshan Pai darshanpai at gmail.com
Fri Mar 2 19:49:20 EST 2012


Lol .. I don't know why i was struggling with the message .. But that is
the original question I had . Third times a charm ..

---------- Forwarded message ----------
From: Darshan Pai <darshanpai at gmail.com>
Date: Fri, Mar 2, 2012 at 2:03 AM
Subject: Problem with vtksmoothPolyDataFilter
To: vtkusers at vtk.org


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);

I have attached the output . It looks as if everything up until the
rendercontourFilter generates the exact same output in VTK 4.4 and the
current VTK

But when I introduce the vtkSmoothPolyDataFilter , the output does not
change . There is no smoothing on the polydata .

I cannot seem to pinpoint the problem . Hope someone can help

Regards
Darshan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120302/c1a33da3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VTKnightly.jpg
Type: image/jpeg
Size: 45222 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120302/c1a33da3/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VTK4.4.jpg
Type: image/jpeg
Size: 21626 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120302/c1a33da3/attachment-0001.jpg>


More information about the vtkusers mailing list