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

Kilgus, Thomas t.kilgus at Dkfz-Heidelberg.de
Sat Jun 11 08:09:19 EDT 2011


There is nothing rendered at all ... Is the filter supposed to work on char data and I am using it wrong?
________________________________________
Von: Bill Lorensen [bill.lorensen at gmail.com]
Gesendet: Freitag, 10. Juni 2011 19:54
An: Kilgus, Thomas
Cc: Dominik Szczerba; vtkusers
Betreff: Re: [vtkusers] How to render the contours of a binary image?

What do you mean "disturbs it"?

On Fri, Jun 10, 2011 at 5:43 AM, Thomas Kilgus
<t.kilgus at dkfz-heidelberg.de> wrote:
> Hi,
>
> I figured out that I should use the the output of the vtkMarchingSquares
> filter as input for the mapper. Furthmore, my data type of the vtkImageData
> is actually char which seems to disturb the filter. How can I apply such a
> filter on a char vtkImageData? Do I have to convert it first?
>
> regards
> thomas
>
>
> On 31.05.2011 16:29, Bill Lorensen wrote:
>>
>> Try,
>> contourFilter->GenerateValues(1, .5, .5);
>>
>> On Tue, May 31, 2011 at 8:57 AM, Thomas Kilgus
>> <t.kilgus at dkfz-heidelberg.de>  wrote:
>>>
>>> hinHi 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