[vtkusers] image with variable spacing
Miro Drahos
mdrahos at robodoc.com
Tue Nov 19 16:48:19 EST 2013
After some playing with the rendered results and hand-drawing cubes
sliced with planes, I see that indeed it is as it should be. Mea culpa.
Thank you for the answer, which saved me from taking apart the class(es)
just to find out nothing :)
Best,
Miro
On 11/19/2013 01:33 PM, David Gobbi wrote:
> Hi Miro,
>
> It is a bit hard for me to guess, but aren't those "clipped" regions
> at the boundary of your data? The vtkImageResliceMapper is generally
> not supposed to draw anything beyond the bounds of the vtkImageData.
> The Data bounds are the Mapper bounds. And the Actor bounds are just
> the Mapper bounds transformed from the data coordinate system to the
> world coordinate system. So I do not think that the bounds are
> incorrect... but I am just guessing because I do not know your data.
>
> A oblique slice through a rectangular volume will produce a
> parallelogram, a triangle, a pentagon, or a hexagon. What you are
> seeing in your screenshot is a hexagon. I think it is the correct
> result.
>
> You can try using vtkImageResliceMapper::SetBackground(1), which will
> turn off clipping at the boundary, but it might not give the desired
> result.
>
> David
>
>
> On Tue, Nov 19, 2013 at 2:11 PM, Miro Drahos <mdrahos at robodoc.com> wrote:
>> Hi David,
>> I have put together the vector of vtkImageResliceMapper's coupled with
>> vtkImageSlice's and they work great! Thank you so much for contributing
>> these classes! Slicing at the camera focal plane is super convenient and
>> really fast.
>> I do see clipping that happens at certain angles; I attached a couple
>> screenshots to illustrate the problem. The *Clipped.png shot shows the
>> clipping in the lower left and upper right corner; I have a feeling it may
>> have to do with how the actor's bounds are calculated, but I am not sure how
>> to fix this.
>> Do you have an idea on how to remediate this?
>> Thank you tons once again!
>> Miro
>>
>>
>>
>> On 11/19/2013 11:28 AM, Miro Drahos wrote:
>>> Hi David,
>>> thank you very much for the valuable input.
>>> I think I will follow your advice and go with a vector of
>>> vtkImageResliceMappers, and roll my own reslice widget. It sounds like a
>>> much cleaner solution than what I have done so far (vectors of reslice
>>> cursors, reps and widgets, with much of the interaction code rewritten
>>> to suite my needs).
>>>
>>> Thank you also for the pointer on how to fill the gaps; I was wondering
>>> what would be the best way to do this so that objects behind the plane
>>> don't "shine through" the gaps.
>>> Best,
>>> Miro
>>>
>>>
>>> On 11/19/2013 08:31 AM, David Gobbi wrote:
>>>> Hi Miro,
>>>>
>>>> There is no easy way to work with images that have variable sampling.
>>>> You will almost certainly have to create your own widgets in order to
>>>> get the kind of user interaction that you are looking for. However, I
>>>> have some suggestions on how to at least get the data to render
>>>> properly:
>>>>
>>>> 1) You will definitely need to use one vtkImageData object per
>>>> segment, given the restrictions on vtkImageData.
>>>>
>>>> 2) Likewise, each segment will need to have its own mapper (I suggest
>>>> using the vtkImageResliceMapper, but of course I'm biased towards it
>>>> because I wrote it).
>>>>
>>>> 3) The mappers for each segment will have to be synchronized to each
>>>> other. For vtkImageResliceMapper, this can be done by using the same
>>>> SlicePlane for all the mappers, or alternatively by using
>>>> SliceAtFocalPoint/SliceFacesCamera and controlling the slicing via the
>>>> camera position and focal point.
>>>>
>>>> 4) You will have to fill in the gaps between the segments. One
>>>> quick-and-dirty way of doing this with vtkImageResliceMapper is to
>>>> call SetBorder(1) to slightly extend the rendered bounds of the image.
>>>>
>>>> As I mentioned in my first paragraph, none of this will work with
>>>> vtkResliceCursorWidget, you'd have to write your own user interaction
>>>> code.
>>>>
>>>> David
>>>>
>>>>
>>>> On Tue, Nov 19, 2013 at 12:46 AM, Miroslav Drahos <MDrahos at robodoc.com>
>>>> wrote:
>>>>> Hi,
>>>>> I am working with medical image (a 3D volume) that consists of several
>>>>> segments with different spacing in z-direction. I was hoping to get an
>>>>> opinion on how to work with this data; I need to be able to visualize it all
>>>>> at once, and reslice it at arbitrary direction.
>>>>> One quite natural idea was to resample the image and then work with it
>>>>> as one vtkImageData object, use vtkResliceCursorWidget on it, etc. However,
>>>>> the origin of the individual image segments changes too, and the gap between
>>>>> them is not an integer multiple of z-resolution, so I can't fit an integer
>>>>> number of (empty) slices between the segments, and the origin will be
>>>>> shifted.
>>>>> The other idea that I am about to implement is to store a vector of
>>>>> images, and dynamically re-plug the reslice cursor to the segment that it is
>>>>> currently on, and have multiple representations that would copy their
>>>>> parametric plane representation from the active on and display several
>>>>> planes with their own textures.
>>>>> But it just seems so clumsy, and makes me feel there must be a more
>>>>> elegant and efficient solution.
>>>>> I have seen vtkRectilinearGrid, but that cannot be plugged into a
>>>>> reslice cursor.
>>>>>
>>>>> Anybody has an idea of how to work with such data?
>>>>> Thank you very much,
>>>>> Miro
More information about the vtkusers
mailing list