I’m having a problem with propagating an information key downstream. For propagation in downstream direction I set the key-value pair in the
Here is the code I tried (and have been with different modifications for the last hours) but doesn’t propagate correctly (when I try to read the value downstream, it always returns 0, a
PrintKeys() shows that the key is missing). It is implemented the same in all plugins I use:
int Plugin::RequestInformation(vtkInformation *request, vtkInformationVector **input_vector, vtkInformationVector *output_vector)
// Forward key
// Get maximum value from filters upstream
this->max_value = this->value;
for (std::size_t i = 0; i < this->GetNumberOfInputPorts(); ++i)
this->max_value = std::max(this->max_value, input_vector[i]->GetInformationObject(0)->Get(Plugin::MY_KEY())));
// Set value downstream
I hope someone will be able to give me a hint to a solution;)
Thank you in advance!
Edit: I removed the part that was trivially solved so that only the problematic part remains.
Edit: I added the remark, that
PrintKeys() shows that the key is missing in the filters downstream.
I have also the same problem as you, I posted this today : Adding metadata to a vtkInformation or a grid object flowing through the pipeline
I also tried to update the object data’s information but it didn’t work because the data object is shallow copied before it is fed to next filter and in void vtkDataObject::InternalDataObjectCopy(vtkDataObject *src) used by vtkDataObject::ShallowCopy() to copy information, only the key “DATA_TIME_STEP()” is copied.
I don’t want to modify this last method, I want to add a fix in the executive or algorithms part, but so far, I couldn’t find the code where the vtkInformation is copied in the next filter’s inputs.
I thought about using a shared memory, but this solution is ugly and don’t fit my needs.
There’s something to change in the code of the vtkExecutive or some of its derived class to allow that… I’m working on that…
Update : take a look at this : http://vtk.1045678.n5.nabble.com/Re-KEYS-TO-COPY-usage-td1239318.html
Update 2 : you can use the technique shown in the link (in ModifyRequest, you have to use request->Append or another method to update KEYS_TO_COPY to avoid growing endlessly KEYS_TO_COPY - in the link, they use a removed key vtkDemandDrivenPipeline::REQUEST_REGENERATE_INFORMATION() from the source code) or it is better, sustainable and recommended to carry metadata in VTK data objects using their field member via GetFieldData() and add arrays reprensting your meta data.