[vtkusers] vtkImageSlice question
David Gobbi
david.gobbi at gmail.com
Thu May 3 11:52:19 EDT 2012
Another little mistake that I should clarify. Instead of
"None of these transformations are specific to VTK"
I should have written
"None of these transformations are unique to VTK"
but that's just nitpicking.
On Thu, May 3, 2012 at 9:10 AM, David Gobbi <david.gobbi at gmail.com> wrote:
> Typo: I meant to write "spacing of the voxels", not "spacing and voxels".
>
>
> On Thu, May 3, 2012 at 9:08 AM, David Gobbi <david.gobbi at gmail.com> wrote:
>> Hi Siddharth,
>>
>> If you just want to map your image pixels directly to screen pixels,
>> then there's hardly any reason to use a computer graphics toolkit like
>> VTK at all. The goal of vtkImageActor and vtkImageSlice is to place
>> an image into a 3D scene, so that the vtkCamera can then be set up to
>> view that scene from a particular viewpoint.
>>
>> There are several coordinate transformations that occur along the way.
>>
>> First, the sampling information for the image is applied, i.e. the
>> spacing and voxels and the position of the lower-left corner voxel of
>> the image volume (or upper-left in the case of DICOM). This
>> transformation maps the voxels to a physical block of space (usually
>> using millimetres as units).
>>
>> Next, the prop3D transformation is applied. This establishes the
>> position of the aforementioned block of space within the world
>> coordinate system. For medical applications, I always equate the world
>> coordinate system with the DICOM patient coordinate system of my
>> primary image series, in order to keep things simple.
>>
>> Next, there are two camera transformation that are applied (a view
>> transformation and a projection transformation) that map the world
>> coordinates to the view coordinates, followed by a viewport
>> transformation that maps the viewport coordinates to screen pixels.
>>
>> None of these transformations are specific to VTK. The same basic
>> approach is used in virtually all modern computer graphics libraries.
>>
>> There are recipes that you can apply to achieve basic effects (e.g
>> like viewing a 2D slice of an image at a specific zoom factor), but in
>> order to get the most out of VTK, it is important understand the
>> computer graphics fundamentals that underlie the toolkit.
>>
>> - David
>>
>>
>> On Thu, May 3, 2012 at 7:32 AM, sidd_vtk <siddharthvikal at gmail.com> wrote:
>>> Hi David & all vtk users,
>>>
>>> I'm using the newly added vtkImageSlice class (I've used vtkImageActor also
>>> with the same issue that I'm describing below). I set up the pipeline, and
>>> the image shows up. The issue is that the image that comes up does not
>>> preserve its original size in pixels unlike how vtkActor2D does. To be more
>>> specific and clear, e.g. if the image size in pixels is 512x512, the use of
>>> vtkActor2D results in displaying the image of size 512x512 pixels, but use
>>> of vtkImageSlice or vtkImageActor displays in size other than true size of
>>> the image. And I can't seem to figure out the scale factor that has been
>>> applied.
>>>
>>> I need to use vtkImageSlice or vtkImageActor, because they work well with
>>> vtkDistanceWidget. But I also require 1:1 display of the image. If the scale
>>> factor is known, I can re-transform my image to get what I want.
>>>
>>> Can you please point me the code where this re-scaling of the image happens
>>> before it gets rendered? or How to fetch the scaling that has been applied
>>> to the image when vtkImageSlice or vtkImageActor has been used?
>>>
>>> Any help is greatly appreciated.
>>>
>>> regards,
>>> Siddharth
More information about the vtkusers
mailing list