[vtkusers] Writing (imaging) algorithm for which output extent has no relation with input extent.
David Gobbi
david.gobbi at gmail.com
Tue Jan 14 11:39:13 EST 2014
The order in which requests are processed is:
RequestDataObject()
RequestInformation()
RequestUpdateExtent()
RequestData()
So I am a bit confused about how you are creating the data before you
Render the window that you get it from.
On Tue, Jan 14, 2014 at 9:20 AM, Maarten Beek <beekmaarten at yahoo.com> wrote:
> Yes, it has an internal pipeline. Apologies for not mentioning this, thought
> I did, must have been in an earlier email to the mailinglist...
>
> I started with the vtkWindowToImageFilter class, but now taking data
> directly from an internal renderwindow because I want floats instead of
> unsigned chars.
> I don't make a ShallowCopy of the output, instead I create the data in
> RequestDataObject(). I do call Render() on the internal renderwindow in
> RequestData().
>
> Basically I am trying to make a nice drr generator algorithm using the gpu
> mapper in vtk.
>
> Maarten
>
>
> On Tuesday, January 14, 2014 11:07:21 AM, David Gobbi
> <david.gobbi at gmail.com> wrote:
> Your filter has an internal pipeline? That would have been worth
> mentioning in your first email.
>
> Are you doing a shallow copy to copy the output of the internal
> pipeline to the output of your filter? Does your RequestData() method
> call the Update() method of the internal pipeline?
>
> On Tue, Jan 14, 2014 at 8:42 AM, Maarten Beek <beekmaarten at yahoo.com> wrote:
>> Thanks David,
>>
>> Just before reading your email, I already added
>> inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), inExt);
>> inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), inExt, 6);
>> to the code in RequestUpdateExtent() and that caused the errors to
>> disappear. But it is good to see it seems to work in another filter too
>> ;-)
>>
>> Something is still wrong in the algorithm code though, because I need to
>> call Update() to get a sensible output. Without it, the output disappears
>> from the renderwindow after a new render (although the algorithm's
>> RequestData is called...?)
>>
>> Maybe vtkImageHistogram will give me a clue, although I don't see an
>> internal pipeline in it...
>>
>> Maarten
>>
>>
>> On Tuesday, January 14, 2014 9:58:09 AM, David Gobbi
>> <david.gobbi at gmail.com>
>> wrote:
>> Hi Maarten,
>>
>> In order to set the output extent independent of the input extent,
>> all you should have to do is override RequestInformation() and
>> RequestUpdateExtent(). It is definitely not necessary to set
>> UNRESTRICTED_UPDATE_EXTENT or EXACT_EXTENT.
>> Take a look at vtkImageHistogram.cxx as an example of a filter
>> that has a 3D input and an independently-sized 2D output.
>>
>> David
>>
>> On Mon, Jan 13, 2014 at 1:45 PM, Maarten Beek <beekmaarten at yahoo.com>
>> wrote:
>>> Hi all,
>>>
>>> I am trying to write an (image) algorithm that generates a 2d image from
>>> a
>>> 3d image.
>>> I would like to be able to set the resolution of the 2d image.
>>> The extents of the input and output are therefore unrelated.
>>>
>>> I have the algorithm working when I set the algorithm's input in an
>>> unofficial way (SetNumberOfInputPorts(0), using a custom function
>>> SetInput
>>> instead of SetInputConnection or SetInputData). This way there is no
>>> pipeline created, which I would like to happen.
>>>
>>> I set the whole extent of the algorithm's output to the desired (2d)
>>> extent
>>> in RequestInformation. However, the function
>>> vtkStreamingDemandDrivenPipeline::VerifyOutputInformation() fails because
>>> this whole extent miraculously gets re-set to whole (3d) extent of the
>>> input.
>>> I have tried to prevent this check using
>>>
>>>
>>> outInfo->Set(vtkStreamingDemandDrivenPipeline::UNRESTRICTED_UPDATE_EXTENT(),
>>> 1) and
>>> outInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 0) to no
>>> avail.
>>>
>>> How do I prevent the adjustment of the whole extent after I have set it
>>> to
>>> the desired value?
>>>
>>> Thanks - Maarten
>>
>>
>
>
More information about the vtkusers
mailing list