[vtkusers] SetInputData and extents
David Gobbi
david.gobbi at gmail.com
Mon Jan 16 14:11:38 EST 2017
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
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> 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
>
> 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>
> 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]->GetInformation
>> Object(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>
>> 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/vtk
>> StreamingDemandDrivenPipeline.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
>>
>> Visit other Kitware open-source projects at
>> 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
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170116/33f14ff3/attachment.html>
More information about the vtkusers
mailing list