[vtkusers] How to render the contours of a binary image?

Dominik Szczerba dominik at itis.ethz.ch
Tue May 31 07:24:06 EDT 2011


See vtkDiscreteMarchingCubes.
What I also do at times is to cast the binary image to float, smooth
it, and then extract 0.5 value.

On Tue, May 31, 2011 at 1:19 PM, Thomas Kilgus
<t.kilgus at dkfz-heidelberg.de> wrote:
> Hi,
>
> I am using a vtkPolyDataMapper to render images as a texture on a plane.
> Some images (in the form of vtkImageData) just consist of the values 1.0 and
> 0.0. By means of a vtkLookuptable I can easily render those images with a
> single color (the 1.0 values) and with a transparent background (0.0
> values). What would be the best way to render just the contours of those
> images?
>
> I already found the vtkContourFilter. But when I use it like this:
>
>      vtkSmartPointer<vtkContourFilter> contourFilter =
> vtkSmartPointer<vtkContourFilter>::New();
>      contourFilter->SetInput(image);
>      contourFilter->GenerateValues(1, 1.0, 1.0);
>      contourFilter->Update();
>      texture->SetInputConnection(contourFilter->GetOutputPort());
>
> the whole image is just rendered as a single color.
>
> Is there anything wrong with my code or is the vtkContourFilter just not the
> appropriate filter for my task?
>
> regards
> thomas kilgus
> _______________________________________________
> 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