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

Bill Lorensen bill.lorensen at gmail.com
Tue May 31 10:29:14 EDT 2011


Try,
contourFilter->GenerateValues(1, .5, .5);

On Tue, May 31, 2011 at 8:57 AM, Thomas Kilgus
<t.kilgus at dkfz-heidelberg.de> wrote:
> Hi Dominik,
>
> the documentation of vtkDiscreteMarchingCubes tells me that I should use
> vtkMarchingSquares for 2D image slices (which i have in my case).
> vtkDiscreteMarchingCubes is not applicable for data with dimension != 3. If
> I use vtkMarchingSquares instead the following message occurs:
> "vtkPainterPolyDataMapper: Mapper has no input" and my image is still
> completely rendered in one color.
>
> regards
> thomas
>
> On 31.05.2011 13:24, Dominik Szczerba wrote:
>>
>> 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
>>>
>>>
> _______________________________________________
> 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