[vtkusers] vtkImageViewer2 bug?

shekharc Shekhar.Chandra at sci.monash.edu.au
Thu Dec 6 23:24:57 EST 2007

Hi Guys,

Thanks for the reply Mark, it appears you might be right. I loaded data 
into Paraview and found if one lets OpenGL handle the mapping it does 
what I described before and clips the image but if "Interpolate Colours" 
is checked everything is fine. This is linked to 
SetInterpolateScalarsBeforeMapping() member in vtkMapper I think.

I have attached what I mean from screenshots. vtkImageViewer doesn't 
have the vtkImageViewer2 issue if I use vtkImageMagnify to turn of 
interpolation but doesn't have the same Interactor setup. I have used 
Image Actor's member InterpolateOff() which controls interpolation 
display but is no doubt the cause.

All I want to do is to display an uninterpolated image but not clip the 
  image if thats even possible with vtkImageViewer2. Is there another 
lower function involving mapping/interpolation that I can use?

Any help would be appreciated.

Mark Wyszomierski wrote:
> 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,
> Mark
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: interp0.png
Type: image/png
Size: 23857 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071207/90cb70b1/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interp1.png
Type: image/png
Size: 27913 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071207/90cb70b1/attachment-0001.png>

More information about the vtkusers mailing list