Multiple output types

I am developing a filter which I would like to output whatever the downstream filter can take as input.

When calling RequestDataObject, I can set the output type to something based on the upstream filter, but the downstream filter (say a mapper) does not have anything in its inputVector that I can use.

When calling RequestInformation, I tried getting the output and calling Delete() on it and inserted a new vtkDataSet object (different type). This crashes the pipeline. Is there any workaround for doing this.

Alternatively, is it possible during the RequestData to verify if an output port is connected and then at least avoid producing all outputs?

Thanks in advance

I found a solution - if a better option exists please advice.

Unfortunately, I could not use UpdateExtent and ended up with 2 output ports and a pair of booleans for enabling each of the two outputs. Not so elegant

Hello,

None that I’m aware of. Those objects are internal ones managed by VTK. Replacing them certainly spells disaster.

If I underestood it right, that kind of functionality would be much easier with a language that supports reflection (e.g. programmatically asking an object which methods it has and which types are returned by them.). C++ doesn’t have such feature, so it is up to the API to implement it or something like it. A number of VTK classes have some limited metadata API, which is not exactly full-fledged reflection.

Anyway, it would be good if you shared some of the code.

best,

PC

I will share a snippet of code Thursday. My solution now is to add a port for each data type and add some properties where I can switch on/off the different outputs. Thanks for reaching out and confirm that you also are unware of such a possibility.

1 Like