[vtkusers] vtkImageViewer2 bug?

Shakes Shekhar.Chandra at sci.monash.edu.au
Thu Dec 6 03:48:21 EST 2007

Hi Guys,

I have been using vtkImageViewer2 to display very small greyscale images 
(7x7) and found that it seems to clip half of a pixel of each pixel on 
the edge of the image despite the data being read in correctly. I have 
attached a screenshot with a comparison of volume plot, vtkImageViewer2, 
data table and with ImageJ (on the right) and also attached the original 
test image.

No other image viewer has problems with the file and the vtkPNMReader 
appears to work correctly as I can check the data directly by eye and is 
correct (the table verifies this). It is also writen by vtkPNMWriter. I 
have also written a VTI file containing a stack of these and the volume 
display appears suffer the same effect (very left).

Here the camera is reset and I have checked the extents and bounds of 
vtkImageActor (also checked display bounds and extents), vtkRenderWindow 
and QVTKWidget and all is fine.

I was just wondering if this might be a bug as this would not be visible 
for large images? Or is there an invisible border? Or something else I 
can do to rectify it. I have already spent several hours on this and 
hoping someone can help me. :(


Relevant Code:

int bounds[6];
vtkPNMReader* reader = vtkPNMReader::New();

imageData = reader->GetOutput();

cerr << "Image Size: " << bounds[1]+1 << "x" << bounds[3]+2 << endl;

viewer->SetInput(imageData); //Doesn't matter if I use 

Other Info:
Tested on Kubuntu Gutsy (g++ 4.1.2) x86, openSuse 10.3 x64 and Vista x64 
(MSVC 2005 x64). Qt 4.3.2 and VTK 5.0.3.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: survey.pgm
Type: image/x-portable-graymap
Size: 108 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071206/e62d2bb2/attachment.pgm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkbug2.png
Type: image/png
Size: 31675 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071206/e62d2bb2/attachment.png>

More information about the vtkusers mailing list