[vtkusers] Polydata input to filter is not set

Alex Malyushytskyy alexmalvtk at gmail.com
Wed Nov 21 21:00:44 EST 2012


Output is generated when filter is executed either through the pipeline or
calling Update().
This why it is important to see the code.

For debugging purposes remove all irrelevant code. For example create
polydata manually.
This would also allow to post questions with self-sufficient test code.

As far as I can see there is no any problem with RequestData implementation.
To proof it - check any available vtk polydata filter ( for example
vtkTriangleFilter )which looks like exactly as yours.
It might be different for vtk version 5 though.  If it is the case check
source code of version you have installed.

Alex



On Wed, Nov 21, 2012 at 2:54 PM, Nico Schertler <
nico.schertler at studentpartners.de> wrote:

>  Hi Alex,****
>
> ** **
>
> to answer your questions. Of course, I provided input to the Delaunay
> filter. But because this is not directly connected to the problem and it
> would require introduction to some other classes and so on, I decided to
> omit this in the question. But I stated that the filter has an output which
> I could render. Furthermore, I am able to work on the output (as I would do
> in the filter) and produce a vtkImageData directly (without the filter). So
> there must be something wrong with passing the output to the filter.****
>
> I will implement the static New() if everything else works. For now, it is
> just a test class.****
>
> ** **
>
> Nico****
>
> ** **
>
> *Von:* vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] *Im
> Auftrag von * Alex Malyushytskyy
> *Gesendet:* Mittwoch, 21. November 2012 23:34
> *An:* vtkusers at vtk.org
> *Betreff:* Re: [vtkusers] Polydata input to filter is not set****
>
> ** **
>
> There is no enough information in your post to reproduce or understand
> the problem.
> For example I believe there are cases when vtkDelaunay2D
> will produce empty output.
> More of that it is not even clear that you provide any input to vtkDelaunay2D
> and update it.
> And I am not great in guessing.
>
> What I would highly recommend, if you derive class from vtk class,
> follow the vtk guidelines.
> If you did this you would never be able to write:
> MeshToRGBFilter* rgbFilter = new MeshToRGBFilter();
>
> Alex
> **
> ******
>
> On Wed, Nov 21, 2012 at 2:02 AM, Nico Schertler <
> nico.schertler at studentpartners.de> wrote:****
>
>  Hi,****
>
>  ****
>
> I am creating a filter that takes the result of a vtkDelaunay2D and
> creates a vtkImageData from that. Therefore, I chose the vtkImageAlgorithm
> as the base class for my filter and changed the input accordingly:****
>
>  ****
>
> int MeshToRGBFilter::FillInputPortInformation(int port, vtkInformation*
> info)****
>
> {****
>
>        info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
> ****
>
>        return 1;****
>
> }****
>
>  ****
>
> I connect the filter to a vtkDelaunay2D like this:****
>
>  ****
>
> vtkSmartPointer<vtkDelaunay2D> delaunay = vtkSmartPointer
> <vtkDelaunay2D>::New();****
>
> //...****
>
> MeshToRGBFilter* rgbFilter = new MeshToRGBFilter();****
>
> rgbFilter->SetInputConnection(delaunay->GetOutputPort());****
>
>  ****
>
> The Delaunay filter definitely has an output. I confirmed that by
> rendering it.****
>
> In the filter, in RequestData, I want to access the polydata from the
> Delaunay pass like this:****
>
>  ****
>
> int MeshToRGBFilter::RequestData(****
>
>        vtkInformation *vtkNotUsed(request),****
>
>        vtkInformationVector **inputVector,****
>
>        vtkInformationVector *outputVector)****
>
> {****
>
>        vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);**
> **
>
>        vtkPolyData* input = vtkPolyData::SafeDownCast(****
>
>              inInfo->Get(vtkDataObject::DATA_OBJECT()));****
>
>  ****
>
> The input variable is then set to an instance of a vtkPolyData, but it
> contains just nothing:****
>
> [image: cid:image001.png at 01CDC842.A1A38F60]****
>
>  ****
>
> Is there something I might have missed? How can I access the poly data?***
> *
>
>  ****
>
> Nico****
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121121/8a41afd5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 16888 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121121/8a41afd5/attachment.png>


More information about the vtkusers mailing list