[vtkusers] vtkImageViewer2 bug?

Mark Wyszomierski markww at gmail.com
Thu Dec 6 10:03:53 EST 2007

I've always noticed the same thing, I think it comes down to the way
the image is being texture mapped on the quad. I can't remember too
clearly but I looked into it about 2 years ago, I think it's just the
way opengl sticks it on there, I could be wrong on that though,


On Dec 6, 2007 3:48 AM, Shakes <Shekhar.Chandra at sci.monash.edu.au> wrote:
> 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. :(
> Cheers
> Shakes
> Relevant Code:
> int bounds[6];
> vtkPNMReader* reader = vtkPNMReader::New();
> reader->SetFileName(name.toStdString().c_str());
> reader->Update();
> imageData = reader->GetOutput();
> imageData->GetExtent(bounds);
> cerr << "Image Size: " << bounds[1]+1 << "x" << bounds[3]+2 << endl;
> viewer->SetInput(imageData); //Doesn't matter if I use
> reader->GetOutputPort()
> viewer->GetRenderer()->ResetCamera();
> QVTKWidget::SetRenderWindow(viewer->GetRenderWindow());
> viewer->SetupInteractor(QVTKWidget::GetRenderWindow()->GetInteractor());
> 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.
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

More information about the vtkusers mailing list