Thanks David for detailed response.<br><br>Thanks,
yes I do understand now more clearly the series of transformations that
the image goes through when vtkImageSlice or vtkImageActor is in use.
And I completely agree and am for, equating the world coordinate system
with the DICOM patient coordinate system. It is the camera
transformations and view transformation I'm interested in (world -->
view --> screen).<br>
<br>Perhaps, it would make more sense to you if I explain the particular
scenario a bit better. Consider the situation where the image that one
has acquired are just off the hardware, where the spacing of voxels is
not yet known. A manual calibration step is then needed to actually
determine the pixel spacing. In this case, user prefers to the see the
image as and how it comes out of the hardware i.e. the native pixel size
equated to computer monitor's pixels. Based on that calibrated pixel
size, the measurements have to added to image. My thought was that
since vtkDistanceWidget works well with vtkImageActor/vtkImageSlice, it
would help to know the exact scaling so that I can accurately calculate
calibrated pixel size and enable vtkDistanceWidget display correct
measurements.<br>
<br>regards,<br>Siddharth<br><br><br><div class="gmail_quote">On Thu, May 3, 2012 at 8:38 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Siddharth,<br>
<br>
If you just want to map your image pixels directly to screen pixels,<br>
then there's hardly any reason to use a computer graphics toolkit like<br>
VTK at all. The goal of vtkImageActor and vtkImageSlice is to place<br>
an image into a 3D scene, so that the vtkCamera can then be set up to<br>
view that scene from a particular viewpoint.<br>
<br>
There are several coordinate transformations that occur along the way.<br>
<br>
First, the sampling information for the image is applied, i.e. the<br>
spacing and voxels and the position of the lower-left corner voxel of<br>
the image volume (or upper-left in the case of DICOM). This<br>
transformation maps the voxels to a physical block of space (usually<br>
using millimetres as units).<br>
<br>
Next, the prop3D transformation is applied. This establishes the<br>
position of the aforementioned block of space within the world<br>
coordinate system. For medical applications, I always equate the world<br>
coordinate system with the DICOM patient coordinate system of my<br>
primary image series, in order to keep things simple.<br>
<br>
Next, there are two camera transformation that are applied (a view<br>
transformation and a projection transformation) that map the world<br>
coordinates to the view coordinates, followed by a viewport<br>
transformation that maps the viewport coordinates to screen pixels.<br>
<br>
None of these transformations are specific to VTK. The same basic<br>
approach is used in virtually all modern computer graphics libraries.<br>
<br>
There are recipes that you can apply to achieve basic effects (e.g<br>
like viewing a 2D slice of an image at a specific zoom factor), but in<br>
order to get the most out of VTK, it is important understand the<br>
computer graphics fundamentals that underlie the toolkit.<br>
<span class="HOEnZb"><font color="#888888"><br>
- David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Thu, May 3, 2012 at 7:32 AM, sidd_vtk <<a href="mailto:siddharthvikal@gmail.com">siddharthvikal@gmail.com</a>> wrote:<br>
> Hi David & all vtk users,<br>
><br>
> I'm using the newly added vtkImageSlice class (I've used vtkImageActor also<br>
> with the same issue that I'm describing below). I set up the pipeline, and<br>
> the image shows up. The issue is that the image that comes up does not<br>
> preserve its original size in pixels unlike how vtkActor2D does. To be more<br>
> specific and clear, e.g. if the image size in pixels is 512x512, the use of<br>
> vtkActor2D results in displaying the image of size 512x512 pixels, but use<br>
> of vtkImageSlice or vtkImageActor displays in size other than true size of<br>
> the image. And I can't seem to figure out the scale factor that has been<br>
> applied.<br>
><br>
> I need to use vtkImageSlice or vtkImageActor, because they work well with<br>
> vtkDistanceWidget. But I also require 1:1 display of the image. If the scale<br>
> factor is known, I can re-transform my image to get what I want.<br>
><br>
> Can you please point me the code where this re-scaling of the image happens<br>
> before it gets rendered? or How to fetch the scaling that has been applied<br>
> to the image when vtkImageSlice or vtkImageActor has been used?<br>
><br>
> Any help is greatly appreciated.<br>
><br>
> regards,<br>
> Siddharth<br>
</div></div></blockquote></div><br>