[vtkusers] vtkMarchingCubes->vtkSmoothPolyDataFilter->vtkCurvatures
Liam Kurmos
quantum.leaf at googlemail.com
Mon Jun 21 12:01:52 EDT 2010
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: noSmoothing.png
Type: image/png
Size: 95587 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100621/ff30b143/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smoothingHighIsoValue.png
Type: image/png
Size: 11057 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100621/ff30b143/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smoothingLowIsoValue.png
Type: image/png
Size: 17236 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100621/ff30b143/attachment-0002.png>
More information about the vtkusers
mailing list