View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000469VTK(No Category)public2003-12-28 21:562016-08-12 09:54
ReporterJarek Sacha 
Assigned ToAndinet 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000469: vtkTIFFReader misinterprets PackBits compressed RGB images
DescriptionvtkTIFFReader misinterprets compressed RGB TIFF image as having 4 scalar components. Below is a sample Java code that illustrated the problem. It first read an uncompressed TIFF image (no problem here), saves it using vtkTIFFWriter (it by default is using PackBits compression) and reads it back. The original image reports having 3 scalar components, the saved and read image shows having 4 scalar components. The vtkImageDifference fails confused by mismatch in number of scalar components.

    // Setup baseline reader
    vtkTIFFReader baselineReader = new vtkTIFFReader();
    baselineReader.SetFileName("data/baseline/Arrays.tif");
    baselineReader.Update();
    System.out.println("baselineReader.NumberOfScalarComponents: "+baselineReader.GetOutput().GetNumberOfScalarComponents());

    // Dump baseline image to a file
    vtkTIFFWriter writer = new vtkTIFFWriter();
    writer.SetFileName("dump/Arrays.tif");
    writer.SetInput(baselineReader.GetOutput());
    writer.Write();

    // Load back the dumped image
    vtkTIFFReader dumpReader = new vtkTIFFReader();
    dumpReader.SetFileName("dump/Arrays.tif");
    dumpReader.Update();
    System.out.println("dumpReader.NumberOfScalarComponents: "+dumpReader.GetOutput().GetNumberOfScalarComponents());

    // Get ready to compute difference between images
    vtkImageDifference imageDifference = new vtkImageDifference();
    // Show imageDifference before initialization
    System.out.println("Uninitialized error : "+imageDifference.GetError());
    System.out.println("Uninitialized threshold : "+imageDifference.GetThreshold());
    System.out.println("Uninitialized thresholdedError: "+imageDifference.GetThresholdedError());

    // Imitialize imageDifference
    imageDifference.SetInput(baselineReader.GetOutput());
    imageDifference.SetImage(dumpReader.GetOutput());
    imageDifference.Update();
    System.out.println("imageDifference.NumberOfScalarComponents: "+imageDifference.GetOutput().GetNumberOfScalarComponents());

    System.out.println("Initialized Error : "+imageDifference.GetError());
    System.out.println("Initialized Threshold : "+imageDifference.GetThreshold());
    System.out.println("Initialized ThresholdedError: "+imageDifference.GetThresholdedError());

Sample output of the test program:
----------
  baselineReader.NumberOfScalarComponents: 3
  dumpReader.NumberOfScalarComponents: 4
  Uninitialized error : 0.0
  Uninitialized threshold : 16
  Uninitialized thresholdedError: 0.0
  ERROR: In /home/local/src/VTK/Imaging/vtkImageDifference.cxx, line 162
  vtkImageDifference (0x8256718): Execute: Expecting 3 components (RGB)

  imageDifference.NumberOfScalarComponents: 3
  Initialized Error : 1000.0
  Initialized Threshold : 16
  Initialized ThresholdedError: 1000.0
-----------

The problem is critical as it break testing framework for Java VTK Examples (http://ij-plugins.sf.net/vtk-exaples [^]). The testing framework dump content of render window to TIFF via vtkPanel.HardCopy() method (implemented with vtkTIFFWriter). There is no much way around it for a user of VTK as vtkPanel.Lock() and vtkPanel.UnLock() needed to making a hard copy are protected. So using, for instance, PNG as a dump format in not practical without overwriting vtkPanel.
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0005740)
Mathieu Malaterre (developer)
2006-11-19 17:48

Is the issue still in VTK 5, thanks ?
(0011259)
Andinet (developer)
2008-04-10 12:00

I couldn't reproduce the problem in VTK-CVS nor 5.0.
(0036705)
Kitware Robot (administrator)
2016-08-12 09:54

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2008-02-06 10:35 Jeff Baumes Assigned To Mathieu Malaterre => Andinet
2008-04-10 12:00 Andinet Note Added: 0011259
2008-04-10 12:00 Andinet Status tabled => @20@
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2016-08-12 09:54 Kitware Robot Note Added: 0036705
2016-08-12 09:54 Kitware Robot Status expired => closed
2016-08-12 09:54 Kitware Robot Resolution open => moved


Copyright © 2000 - 2018 MantisBT Team