[vtkusers] ImageViewer2 extent problem
David Borland
borland at cs.unc.edu
Mon Sep 12 18:00:56 EDT 2005
Sebastien, thanks for your help. I've been using release 4.4, but I
tried switching to the latest nightly build so I could incorporate your
change. However, this led to some issues with a couple of other
libraries I'm using that are based on 4.4, so I'm stuck with that for now.
Unfortunately, this also means that I cannot take advantage of the
SetSliceOrientation functionality. I want to view 3 orthogonal slices
of my data. What is the best way to go about doing this? I tried using
vtkImagePermute, but am getting errors in vtkopenglimageactor when I try
this
Perhaps I should just replicate the code that does the image slicing
from the newest version of vtkImageViewer2? Any help would be
appreciated. Thanks,
David
Sebastien BARRE wrote:
> At 9/9/2005 05:06 PM, David Borland wrote:
>
>> Thanks. That did the trick. Need to make sure UpdateInformaton is
>> called on the input image also.
>>
>> David
>>
>> Mark Wyszomierski wrote:
>>
>>> I had this problem too, vtkImageViewer2 is just a wrapper around a
>>> few classes that put it all together, the one you need to alter is
>>> the underlying image actor object. So get it, call
>>> SetDisplayExtent() with the new image dimensions on the image actor,
>>> and reset your camera. This worked for me. Goodluck,
>>>
>>> Mark
>>
>
> David, Mark
>
> Thanks for the feedback. As Mark stated, vtkImageViewer2 is a wrapper
> around a few classes. Calling SetDisplayExtent can do the trick, but
> you have to be careful about it, since you have to set the display
> extent correctly depending on the Slice and SliceOrientation
> parameters of the viewer (I added SliceOrientation recently). This is
> done automatically for you (as well as resetting the camera) each time
> you change the Input of the viewer, but of course, most of the time
> the input of this class is likely to remain the same, i.e. connected
> to the output of a filter, or an image reader. When the input of this
> filter is changed, an error message is displayed since the current
> display extent is probably outside the new whole extent. That's what
> you saw David.
>
> To make your life easier, I moved the UpdateDisplayExtent method from
> the protected to the public section of the class. Everytime you change
> the input of a filter upstream in the pipeline, you can simply call
> this method, which will set the display extent properly and try to set
> a reasonable camera clipping range (you may still have to call
> ResetCamera on the Renderer to center the image afterwards, since
> there was probably no reason to force it in UpdateDisplayExtent).
>
More information about the vtkusers
mailing list