[vtkusers] vtkImageReslice zoomed performance - no clipping?

Henning Meyer tutmann at gmail.com
Fri Jun 25 15:04:04 EDT 2010


David,

thank you very much!
That helped a lot. So I have to catch all resize-Events for my
QVTKWidget and adjust OutputExtent and OutputOrigin properly, right?
Odd thing is - still my reslice seems to be scaled up in QVTKWidget,
even after setting   m_reslice->SetOutputSpacing(1,1,1);

What could be the reason?

Henning

2010/6/25 David Gobbi <david.gobbi at gmail.com>:
> Hi Henning,
>
> The behaviour of vtkImageReslice can be counterintuitive, but be
> assured that its behaviour is correct.
>
> Probably the best way to think about it, is that vtkImageReslice
> presents a "viewport" into the image that you are reslicing.  This
> "viewport" is a rectangle with its lower-left corner set by
> reslice->SetOutputOrigin(), and its size set by
> reslice->SetOutputExtent().  The "pixel size" of the viewport is set
> by reslice->SetOutputSpacing().
>
> After this basic "viewport" has been set up with
> SetOutputOrigin()/Extent()/Spacing(), the ResliceAxes() are used to
> set its position and orientation with respect to the volume, i.e.
> ResliceAxes() applies a transform to the "viewport".  The transformed
> viewport is the slice that you will end up slicing from the volume.
>
> It is most useful to define the "viewport" so that (0,0,0) is at the
> center of the viewport, e.g. if you want to produce a 256x256 slice
> with pixel spacing of (1mm, 1mm) you would do this:
>
> reslice->SetOutputExtent(0,255,0,255,0,0);
> reslice->SetOutputSpacing(1,1,1);
> reslice->SetOutputOrigin(-127.5,-127.5,0.0);
>
> Then you would set the ResliceAxes to transform this "viewport" to
> somewhere inside the volume.
>
> Basically, you should always set the OutputExtent(), OutputSpacing(),
> and OutputOrigin() whenever you want to do anything sophisticated with
> vtkImageReslice.
>
> The default Extent/Origin/Spacing values are set that way as a flag
> for vtkImageReslice to create its own viewport according to some
> simplistic rules that usually don't give people what they want.  That
> is why you should always set these values.
>
>   David
>
>
> On Fri, Jun 25, 2010 at 7:33 AM, Henning Meyer <tutmann at gmail.com> wrote:
>> Hi David,
>>
>> thank you for your explanation.
>> I still can't help but get the impression something is odd there.
>> When I call
>> m_reslice->SetOutputExtent(0,100,0,100,0,0);
>> I get a nice square clipped area, which seems to be scaled up in my QVTKWidget.
>>
>> And when I start to use
>> m_reslice->SetResliceAxes(myTransform);
>> this clipped area will move inside (even outside) my QVTKWidget.
>>
>> So - what is going on here? Can I help to solve this issue?
>>
>> Henning
>>
>> Btw: When I never call SetOutputExtent, I get an OutputExtent of:
>> -2147483648 ,2147483647 ,-2147483648 ,2147483647 ,-2147483648 ,2147483647
>>
>>
>> 2010/6/24 David Gobbi <david.gobbi at gmail.com>:
>>> Hi Henning,
>>>
>>> The vtkImageReslice filter will clip the image if you call
>>> SetOutputExtent(), or if you don't set the OutputExtent, then clipping
>>> is done according the UpdateExtent set by the pipeline.  So those are
>>> the only ways to change the clipping: either set it manually with
>>> SetOutputExtent, or fiddle with the downstream filters to change the
>>> UpdateExtent.
>>>
>>> I've wanted to write an easier-to-use alternative to vtkImageReslice
>>> for a very long time (there really isn't any way to make
>>> vtkImageReslice "smarter" without breaking backwards compatibility in
>>> one way or another).
>>>
>>>   David
>>>
>>>
>>> On Thu, Jun 24, 2010 at 9:13 AM, Henning Meyer <tutmann at gmail.com> wrote:
>>>> Hi!
>>>>
>>>> When using vtkImageReslice, I get very low performance, once I zoom
>>>> into an image. It seems, that vtkImageReslice is rendering a huge
>>>> virtual image, and is clipping after that, is that true? Could it be
>>>> changed to be clipped before? Also I found, the clipping is not always
>>>> correct, as sometimes with certain transforms the output image gets
>>>> clipped inside the render window.
>>>> Is there anything I could do here?
>>>>
>>>> Thank you,
>>>>
>>>> Henning
>>>> _______________________________________________
>>>> 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
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>
>>
>



More information about the vtkusers mailing list