[vtkusers] vtkLegendScaleActor as a ruler

Guan, Xuefei xf.guan at gmail.com
Mon Sep 14 12:29:46 EDT 2015

Dear All,
This is an old question I asked before but I got no reply, and I wonder if
anyone gets a solution to it.

I am using vtkImageData to display a 2D image and I added
vtkLegendScaleActor to show the scale on screen after I set up the
SetSpacing of the vtkImageData to its physical resolution, e.g., mm/pixel
 in x-direction and mm/pixel in y-direction.
For example, I have an image with a dimension of 620x176x1 and the physical
dimension of it is (0.13, 1,1), so I setup the spacing to (0.13, 1, 1). And
thevtkLegendScaleActor will display the physical dimension correctly. The
image will show as a long strip because of the spacing are not even in x-
and y-direction. Now I would like to fill the image to a 3:2 ratio window,
which means I need to set the spacing to (3/0.13, 2/1, 1) but the
vtkLegendScaleActor will no longer show the correct physical dimension of
the image.

I wonder if there is a way to override the actor's tick label text so it
can still show the correct physical dimension. One way to do it is to
extract the tick label text and converted to numeric value and then
multiple a scaling factor to make it to the actual physical value. Or I
wonder if there is an existing function to do it. I searched google on this
topic but find nothing useful yet.

I tried SetAspect for the vtkRender but it seems no magic. Can someone help?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150914/09aac99f/attachment.html>

More information about the vtkusers mailing list