[vtkusers] vtkMarchingCubes->vtkSmoothPolyDataFilter->vtkCurvatures
Bill Lorensen
bill.lorensen at gmail.com
Mon Jun 21 14:44:14 EDT 2010
Try without PolyDataNormals and Smoothing. I think the artifacts are
not Marching Cubes related.
On Mon, Jun 21, 2010 at 12:01 PM, Liam Kurmos
<quantum.leaf at googlemail.com> wrote:
> I'm trying to implement this sequence of filters on some 3d gaussian blobs.
> vtkMarchingCubes->vtkSmoothPolyDataFilter->vtkCurvatures
>
> First I tried without smoothing but then the vtkCurvatures seemed to
> be picking out artifact from the marchingCubes that were not in the
> implicit gaussians. I had partial success with smoothing (screen shots
> attached) though still some a-symmetric artifacts persist.
>
> The greatest problem is that apparently flat areas of the surface are
> being coloured the same dark blue as highly curved features implying
> this is not working. Although some feature do get the right general
> indication of colour (such as when i drop the isovalue enough that a
> flat region becomes flat enough it starts to turn green. However as
> can be seen in the screen shots, even fairly flat areas are coloured
> blue. (there are 2 disks, 2 small and 1 large blobs in the dataset)
>
> I'm pasting my code below, any advice on what im doing wrong here
> would be very much appreciated.
>
> Liam
>
> ..........
>
> iso = vtkMarchingCubes::New();
> iso->SetInput(vol);
> iso->SetNumberOfContours(1);
> iso->SetValue(0, 0);
> iso->Update();
>
> vtkPolyDataNormals *surfNormals = vtkPolyDataNormals::New();
> surfNormals->SetInputConnection(iso->GetOutputPort());
> surfNormals->SetFeatureAngle(60.0);
>
> vtkSmartPointer<vtkSmoothPolyDataFilter> smoothFilter =
> vtkSmartPointer<vtkSmoothPolyDataFilter>::New();
> smoothFilter->SetInputConnection(surfNormals->GetOutputPort());
> smoothFilter->SetNumberOfIterations(5);
> smoothFilter->SetRelaxationFactor(0.85);
> smoothFilter->SetFeatureAngle(70);
> smoothFilter->FeatureEdgeSmoothingOn();
> smoothFilter->BoundarySmoothingOn();
> smoothFilter->Update();
>
> vtkCurvatures *curv = vtkCurvatures::New();
> curv->SetInputConnection(smoothFilter->GetOutputPort());
> curv->SetCurvatureTypeToMean();
>
> //added this lookup table seems to have no affect.
> vtkLookupTable* lut = vtkLookupTable::New();
> lut->SetHueRange(0.0, 0.6); //Red to Blue
> lut->SetAlphaRange(1.0, 1.0);
> lut->SetValueRange(1.0, 1.0);
> lut->SetSaturationRange(1.0, 1.0);
> lut->SetNumberOfTableValues(256);
> lut->SetRange(-100, 100);
> lut->Build();
>
>
> vtkPolyDataMapper *polyMap2 = vtkPolyDataMapper::New();
> polyMap2->SetLookupTable(lut);
> polyMap2->SetInputConnection(curv->GetOutputPort());
>
> contourActor = vtkActor::New();
> contourActor->SetMapper(polyMap2);
> polyMap2->GetInput()->Update();
>
> iso->Delete();
>
> _______________________________________________
> 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
>
>
More information about the vtkusers
mailing list