I want to combine an existing source and filter into one object to encapsulate a pipeline structure. In the class below the pipeline held by the MyCompound is just a reader feeding into a resample filter. The resample filter would then represent the output of the algorithm. I’m not sure how to implement the ProcessRequest() method below.
Are there any existing examples that combine existing sources and filters into new compound objects like this?
I came across the compound proxy recently. Is that the preferred way of doing something like this in the context of paraview/vtk?
Thank you for your time,
Kevin
class MyCompound : public vtkAlgorithm
{
public:
static MyCompound * New();
vtkTypeMacro(MyCompound , vtkAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
void SetFileName(const char* val); // pass onto the reader
const char* GetFileName() const; // pass onto the reader
void SetTimeStep(int index); // pass onto the reader
int GetTimeStep(); // pass onto the reader
int CanReadFile(const char* name) { return true; } // pass onto the reader
MyCompound ()
{
resample_->SetSamplingDimensions(100, 100, 100);
resample_->SetInputConnection(reader_->GetOutputPort());
}
~MyCompound ();
protected:
vtkTypeBool ProcessRequest(vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override
{
// Not sure what goes here. I'd like to directly pass this onto the resample filter, but the method is protected
}
int FillOutputPortInformation(int port, vtkInformation* info) override;
private:
vtkNew<vtkPVDReader> reader_;
vtkNew<vtkResampleToImage> resample_;
};