Greetings,
I have been trying to create a simple PolyDataToImageData, but I’m unable to update the extent of the image properly!
In fact, there’s only one thing that makes me unable to do it right. What blocks me is… I need to define the pixel size of the resulting image to be equal to, for example, {1, 1, 1}. This means that a PolyData of bounds {10, 20, 10} will be converted to an image of resolution {10, 20, 10}. So, I proceed to update the RequestInformation method to include the usual methods for setting the extent using my calculated values:
outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
0, scaledResolution[0],
0, scaledResolution[1],
0, scaledResolution[2]);
outInfo->Set(vtkDataObject::ORIGIN(), scaledOrigin, 3);
outInfo->Set(vtkDataObject::SPACING(), scaledSpacing, 3);
…and that works when I instantiate my filter… BUT, if I load a state file containing this filter, the RequestInformation execution gives different results because the input is not yet well defined, and this means that input->GetBounds() = {0, 0, 0, 0, 0, 0}. Therefore, the newly evaluated extent resolution will be {0, 0, 0}.
I did try to transfer that logic to RequestUpdateExtent but nothing happened. Perhaps, it is already too late.
I could also try to store hidden values in the state file such as the resolution ({10, 20, 10}), the spacing and the origin, but it won’t work in the context of batch processing, where my sources are continually updated with different polydata.
Are there any other solutions/approaches/workarounds I can try?
Thank you,
Patrick Laurin