Commit f814879b authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Add test to demonstrate TIFF reader issue.

Adding a new test to demonstrate the vtkTIFFReader inability to handle
reading of sub-extents in compressed TIFF file. This is a failing test
to demonstrate the reader lack in support.
parent 348265e0
......@@ -38,6 +38,10 @@ vtk_add_test_cxx(${vtk-module}CxxTests tests
TestTIFFReaderTiledRGB,TestTIFFReader.cxx,NO_OUTPUT
"DATA{${VTK_TEST_INPUT_DIR}/libtiff/gourds_tiled_200x300.tif}")
vtk_add_test_cxx(${vtk-module}CxxTests tests
TestCompressedTIFFReader,TestCompressedTIFFReader.cxx,NO_OUTPUT
"DATA{${VTK_TEST_INPUT_DIR}/al_foam_smallest.0.tif}")
set(all_tests
${data_tests}
${tests}
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestCompressedTIFFReader.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include <vtkSmartPointer.h>
#include <vtkTIFFReader.h>
#include <vtkImageViewer2.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkImageData.h>
int TestCompressedTIFFReader(int argc, char* argv[])
{
//Verify input arguments
if ( argc < 3 )
{
std::cout << "Usage: " << argv[0]
<< " Filename(.tif)" << std::endl;
return EXIT_FAILURE;
}
//Read the image
vtkSmartPointer<vtkTIFFReader> reader =
vtkSmartPointer<vtkTIFFReader>::New();
reader->SetFileName(argv[1]);
reader->UpdateInformation();
// Read the image in 4 chunks. This exercises the logic to read random scan
// lines from files that do not support it.
const int maxNumPieces = 4;
for (int cc=0; cc < maxNumPieces; cc++)
{
reader->SetUpdateExtent(cc, maxNumPieces, 0);
reader->Update();
}
reader->SetUpdateExtentToWholeExtent();
// Visualize
vtkSmartPointer<vtkImageViewer2> imageViewer =
vtkSmartPointer<vtkImageViewer2>::New();
imageViewer->SetInputConnection(reader->GetOutputPort());
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
imageViewer->SetupInteractor(renderWindowInteractor);
imageViewer->Render();
imageViewer->GetRenderer()->ResetCamera();
renderWindowInteractor->Initialize();
imageViewer->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
e1227be0aa2058bb2070bb9e3a62d320
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment