[vtkusers] Using vtkTransformPolyDataFilter Locks Up Application

Bill Lorensen bill.lorensen at gmail.com
Sun Jan 5 18:54:44 EST 2014


What are you trying to accomplish? Create filled contours?

Bill

On Sun, Jan 5, 2014 at 1:39 PM, zmanvortex
<donny.zimmerman at willowpointsoftware.com> wrote:
> Here is my pipeline, I am feeding it 2D vtkImageData that I created manually:
>
> //Create the contours from 2D image data
> vtkSmartPointer<vtkMarchingSquares> contours =
> vtkSmartPointer<vtkMarchingSquares>::New();
> contours->SetInputConnection(imgdat->GetOutputPort());
> contours->GenerateValues(50, 83.0, 133.0);
>
> //Clean the polydata, don't know if this is needed but used by habit
> vtkSmartPointer<vtkCleanPolyData> cpd =
> vtkSmartPointer<vtkCleanPolyData>::New();
> cpd->SetInputConnection(contours->GetOutputPort());
>
> //Create longer polylines so Delaunay is faster?
> vtkSmartPointer<vtkStripper> stripper = vtkSmartPointer<vtkStripper>::New();
> stripper->SetInputConnection(cpd->GetOutputPort());
> stripper->SetMaximumLength(10000);
>
> //Fill in between the contours
> vtkSmartPointer<vtkDelaunay2D> dnly = vtkSmartPointer<vtkDelaunay2D>::New();
> dnly->SetInputConnection(stripper->GetOutputPort());
> dnly->SetAlpha(1.0);
>
> //I only want polys. Get rid of junk lines and verts
> vtkSmartPointer<vtkTriangleFilter> trifil =
> vtkSmartPointer<vtkTriangleFilter>::New();
> trifil->SetInputConnection(dnly->GetOutputPort());
> trifil->PassLinesOff();
> trifil->PassVertsOff();
>
> //Warp the data slightly to show contour transitions
> vtkSmartPointer<vtkWarpScalar> warp = vtkSmartPointer<vtkWarpScalar>::New();
> warp->SetInputConnection(trifil->GetOutputPort());
> warp->SetScaleFactor(0.05);
>
> //Create a smoother mesh
> vtkSmartPointer<vtkSmoothPolyDataFilter> smooth =
> vtkSmartPointer<vtkSmoothPolyDataFilter>::New();
> smooth->SetInputConnection(warp->GetOutputPort());
> smooth->SetFeatureAngle(120.0);
>
> //Create normals for shading
> vtkSmartPointer<vtkPolyDataNormals> normals =
> vtkSmartPointer<vtkPolyDataNormals>::New();
> normals->SetInputConnection(smooth->GetOutputPort());
> normals->SetFeatureAngle(45.0);
>
> //Move points to new location
> vtkSmartPointer<vtkTransformPolyDataFilter> tf =
> vtkSmartPointer<vtkTransformPolyDataFilter>::New();
> tf->SetInputConnection(normals->GetOutputPort());
> vtkSmartPointer<vtkTransform> xfm = vtkSmartPointer<vtkTransform>::New();
> xfm->Translate(4744686.4296517679, -529434.90776521398, 4197132.3454494504);
> tf->SetTransform(xfm);
>
>
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(tf->GetOutputPort());
> mapper->SetLookupTable(lookuptable);
> mapper->SetScalarRange(0, 255);
> mapper->SetColorModeToMapScalars();
> mapper->InterpolateScalarsBeforeMappingOn();
>
> vtkActor* actor = vtkActor::New();
> actor->SetMapper(mapper);
> actor->GetProperty()->SetSpecular(.1);
> actor->GetProperty()->SetSpecularPower(10);
> actor->GetProperty()->SetAmbient(.5);
> actor->GetProperty()->ShadingOn();
>
> If I change "mapper->SetInputConnection(tf->GetOutputPort());" to
> "mapper->SetInputConnection(normals->GetOutputPort());" then the application
> doesn't lock up
> and the data is displayed, but the points aren't transformed to where I need
> them. I am using VTK 6.1.
>
> Thanks.
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Using-vtkTransformPolyDataFilter-Locks-Up-Application-tp5725220.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list