[vtkusers] Polydata input to filter is not set

Nico Schertler nico.schertler at studentpartners.de
Thu Nov 22 04:39:14 EST 2012


I attached the source code for the project. The main method is in aufgabe3.cpp

Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im Auftrag von Alex Malyushytskyy
Gesendet: Donnerstag, 22. November 2012 03:01
An: vtkusers at vtk.org
Betreff: Re: [vtkusers] Polydata input to filter is not set

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<mailto: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> [mailto: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<mailto: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<mailto: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:
[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<http://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<http://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/20121122/f53508fd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 16888 bytes
Desc: image001.png
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121122/f53508fd/attachment.png>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: aufgabe3.cpp
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121122/f53508fd/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MeshToRGBFilter.cpp
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121122/f53508fd/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MeshToRGBFilter.h
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121122/f53508fd/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SamplePointSource.cpp
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121122/f53508fd/attachment-0001.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SamplePointSource.h
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121122/f53508fd/attachment-0002.txt>


More information about the vtkusers mailing list