[vtkusers] SetInputData and extents

Kit Chambers kit.chambers.kc at gmail.com
Wed Jan 18 08:07:15 EST 2017


Thanks David,

That clarifies things for me. Just to make sure I have got it, I will flesh out what I am trying to do and the way I understand it should be handled based on your response. Here goes:

My data type, let’s call it myGrid, is inherited from a vtkImageData. And similarly there is a myGridAlgorithm which acts as a base for constructing filters and sources to work on myGrid data.  So an example pipeline might be something like this.

src1 > data1 [M by N myGrid object]
src2 > data2 [P by Q myGrid object] 
filter1 < data1, data2 > data3 [M by N myGrid object]

So in src1 and src2 I should implement a RequestInformation(), which sets the WHOLE_EXTENT on the output ports to M by N and P by Q respectively and the RequestInformation() in filter1 should set the WHOLE_EXTENT of its output port to be the same as input 0.  Is this correct? Note that in the above example we may have P>M or Q>N, would this mess things up?

Thanks for you help on this

Kit


> On 16 Jan 2017, at 19:11, David Gobbi <david.gobbi at gmail.com> wrote:
> 
> I'm going to try again, with fewer typos:
> 
> The VTK image pipeline updates occur in three passes (RequestInformation(), RequestUpdateExtent(), RequestData()), which are discussed in the VTK Users's Guide and also on the following web page: http://www.vtk.org/Wiki/VTK/Tutorials/New_Pipeline <http://www.vtk.org/Wiki/VTK/Tutorials/New_Pipeline> 
> 
> A filter should never directly set the WHOLE_EXTENT of its input.  It is only allowed to set the WHOLE_EXTENT of its output.
> 
> With respect to the extent, the three passes of the pipeline work like this:
> 
> In RequestInformation(), a filter sets the WHOLE_EXTENT of its output.  This is how a filter tells the pipeline "this is how much data I can produce".  A filter can be asked to produce less than this (as described in RequestUpdateExtent, below).  The default behavior of RequestInformation() is to check the WHOLE_EXTENT of the input, and then use that same WHOLE_EXTENT for the output. 
> 
> In RequestUpdateExtent(), a filter can request for the pipeline produce less than the WHOLE_EXTENT of that input.  It does this by setting the UPDATE_EXTENT of the input, while tells the pipeline "I need at least this much data from this input".  Usually, it will set the UPDATE_EXTENT of the input to the WHOLE_EXTENT of the input.  If a filter also sets EXACT_EXTENT for the input, that tells the pipeline "I need exactly this much data from this input".  If you do not set EXACT_EXTENT, then the pipeline will produce at least as much data as requested by UPDATE_EXTENT, but possibly more.
> 
> Finally, in RequestData() a filter should call GetExtent() on each input data object to see how data is actually there.
> 
>  - David
> 
> On Mon, Jan 16, 2017 at 12:04 PM, David Gobbi <david.gobbi at gmail.com <mailto:david.gobbi at gmail.com>> wrote:
> Hi Kit,
> 
> The VTK image pipeline updates occur in three passes (RequestInformation(), RequestUpdateExtent(), RequestData()), which are discussed in the VTK Users's Guide and also on the following web page: http://www.vtk.org/Wiki/VTK/Tutorials/New_Pipeline <http://www.vtk.org/Wiki/VTK/Tutorials/New_Pipeline> 
> 
> A filter should never directly set the WHOLE_EXTENT of its input.  It is only allowed to set the WHOLE_EXTENT of its output.
> 
> With respect to the extent, the three passes of the pipeline work like this:
> 
> In RequestInformation(), a filter sets the WHOLE_EXTENT of its output.  This is how a filter tells the pipeline "this is how data I can produce".  A filter can be asked to produce less that this (as described in RequestUpdateExtent, below).  In most cases, what a filter does in RequestInformation() is check the WHOLE_EXTENT of its input, and then use that same WHOLE_EXTENT for its output. 
> 
> In RequestUpdateExtent(), a filter can request that an produce less than the WHOLE_EXTENT of that input.  It does this by setting the UPDATE_EXTENT of the input, while tells the pipeline "I need at least this much data from this input".  Usually, it will set the UPDATE_EXTENT of the input to the WHOLE_EXTENT of the input.  If a filter also sets EXACT_EXTENT for the input, that tells the pipeline "I need exactly this much data from this input".  If you do not set EXACT_EXTENT, then the pipeline will produce at least as much data as requested by UPDATE_EXTENT, but possibly more.
> 
> Finally, in RequestData() a filter should call GetExtent() on each input data object to see how data is actually there.
> 
>  - David
> 
> 
> 
> 
> On Mon, Jan 16, 2017 at 10:17 AM, Kit Chambers <kit.chambers.kc at gmail.com <mailto:kit.chambers.kc at gmail.com>> wrote:
> Hi All,
> 
> I did some more digging on the and found a solution that works (at least so far). My custom VTK filter class (derived from vtkImageAlgorithm) contained a method RequestUpdateExtent, which contained the following code:
> 
>   for (int i=0; i<numInputPorts; i++)
>     {
>     int numInputConnections = this->GetNumberOfInputConnections(i);
>     for (int j=0; j<numInputConnections; j++)
>       {
>       vtkInformation* inputInfo = inputVector[i]->GetInformationObject(j);
>       inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);
>       }
>     }
> 
> I changed:
>         inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);
> 
> to:
>         inputInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),WholeExtent,6);
> 
> where the array WholeExtent is the maximum extent computed over all input and output ports.
> 
> This seems to work, but I am not sure why. If anyone could point me in the direction of some explanation of the purpose behind extents in the VTK pipeline and how they are best used I would be very grateful.
> 
> Thanks
> 
> Kit
> 
> 
> > On 4 Jan 2017, at 12:56, Kit Chambers <kit.chambers.kc at googlemail.com <mailto:kit.chambers.kc at googlemail.com>> wrote:
> >
> > Hi All,
> >
> > I have a custom datatype (myType) derived from vtkImageData and a custom filter derived from vtkImageAlgorithm. The filter takes input on two ports which are both myType objects with different sizes.
> >
> > So in principle I should be able to set these inputs using either SetInputData() or SetInputConnection() right? However, when I run the filter  I get errors like:
> >
> > ERROR: In …. /vtk/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx, line 857
> > vtkStreamingDemandDrivenPipeline (0x7fc6fa444a00): The update extent specified in the information for output port 0 on algorithm vtkTrivialProducer(0x7fc6fa4444a0) is 0 31 0 0 0 0, which is outside the whole extent 0 5 0 0 0 0.
> >
> > ERROR: In …. /vtk/src/vtk/Common/ExecutionModel/vtkTrivialProducer.cxx, line 264
> > vtkTrivialProducer (0x7fc6fa4444a0): This data object does not contain the requested extent.
> >
> > Any suggestions? Is there something I am missing here?
> >
> > Kit
> >
> >
> 
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com/>
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <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 <http://www.vtk.org/Wiki/VTK_FAQ>
> 
> Search the list archives at: http://markmail.org/search/?q=vtkusers <http://markmail.org/search/?q=vtkusers>
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers <http://public.kitware.com/mailman/listinfo/vtkusers>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170118/732318f5/attachment.html>


More information about the vtkusers mailing list