[vtkusers] Fill contour

Jothybasu Selvaraj jothybasu at gmail.com
Tue Mar 15 22:35:17 EDT 2016


Yup, it works!

Thanks David!


Cheers

Jothy

On Wed, Mar 16, 2016 at 1:10 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> You can try vtkLinearExtrusionFilter, to extrude the filled contour
> towards the camera (use CappingOn()).
>
>
> On Tue, Mar 15, 2016 at 7:53 PM, Jothybasu Selvaraj <jothybasu at gmail.com>
> wrote:
>
>> Looks like it has something to do with the resolveCoincidentTopology. The
>> filled contour is at the same depth as the image slice -that's why it is
>> not shown.
>>
>>
>> Jothy
>>
>> On Wed, Mar 16, 2016 at 12:41 PM, Jothybasu Selvaraj <jothybasu at gmail.com
>> > wrote:
>>
>>> I commented this line in the original code.
>>>
>>> polyActor->GetProperty()->SetRepresentationToWireframe();
>>>
>>>
>>> On Wed, Mar 16, 2016 at 12:40 PM, Jothybasu Selvaraj <
>>> jothybasu at gmail.com> wrote:
>>>
>>>> Hi David
>>>>
>>>> If I set the representation to surface only the outline is shown. I
>>>> even tried it with a vtkPolyDataMapper and the results are same.
>>>>
>>>> Here is the rough pipeline
>>>>
>>>> vtkSmartPointer<vtkPolyData>contour=
>>>>
>>>>             vtkSmartPointer<vtkPolyData>::New();
>>>>
>>>>     contour=this->ContourWidget->GetContourRepresentation()->GetContourRepresentationAsPolyData();
>>>>
>>>>
>>>>
>>>>     vtkSmartPointer<vtkContourTriangulator>tc=
>>>>
>>>>             vtkSmartPointer<vtkContourTriangulator>::New();
>>>>
>>>>     tc->SetInputData(contour);
>>>>
>>>>     tc->Update();
>>>>
>>>>
>>>>
>>>>
>>>>     vtkSmartPointer<vtkDataSetMapper> polyMapper =
>>>>
>>>>             vtkSmartPointer<vtkDataSetMapper>::New();
>>>>
>>>>     polyMapper->SetInputData(tc->GetOutput());
>>>>
>>>>     polyMapper->ScalarVisibilityOn();
>>>>
>>>>     polyMapper->Update();
>>>>
>>>>
>>>>
>>>>      this->polyActor =
>>>>
>>>>             vtkSmartPointer<vtkActor>::New();
>>>>
>>>>     polyActor->SetMapper(polyMapper);
>>>>
>>>>     polyActor->GetProperty()->SetColor(0,1,0);
>>>>
>>>>     polyActor->GetProperty()->SetRepresentationToWireframe();
>>>>
>>>>
>>>>     this->ViewRenderer->AddActor(this->polyActor);
>>>>
>>>>     this->ViewRenderer->GetRenderWindow()->Render();
>>>>
>>>>     this->ViewRenderer->ResetCamera();
>>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>> Jothy
>>>>
>>>>
>>>> On Wed, Mar 16, 2016 at 12:24 PM, David Gobbi <david.gobbi at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Jothy,
>>>>>
>>>>> The vtkContourTriangulator always produces a filled contour, so there
>>>>> must be something wrong with the way it is being rendered.  Are you sure
>>>>> that you aren't calling SetRepresentationToWireframe() on the actor's
>>>>> property?
>>>>>
>>>>>  - David
>>>>>
>>>>>
>>>>> On Tue, Mar 15, 2016 at 5:45 PM, Jothybasu Selvaraj <
>>>>> jothybasu at gmail.com> wrote:
>>>>>
>>>>>> Hi All
>>>>>>
>>>>>> I am trying to fill a 2D contour generated by vtkContourWidget. I
>>>>>> pass the polydata from the contour widget to vtkContourTriangulator and the
>>>>>> output is as shown in the attached image. But, I want a filled contour. How
>>>>>> do I do that?
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Jothy
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160316/23bbff7c/attachment.html>


More information about the vtkusers mailing list