[Insight-users] Bug in tiff reader with ReleaseDataFlagOn() ? (ITK 3.14.0)

Ola Kristoffer Øye ola.kristoffer.oye at cmr.no
Mon Jun 8 09:09:42 EDT 2009


Hi,
I get a crash (access violation) when setting ReleaseDataFlagOn() on a 
tiff reader in ITK, executing the pipeline, and then calling update on 
the reader. 
It could be that I am using the pipeline in some unintended way, 
otherwise I believe it is a bug.

Platform: Win XP 32, VS 2005, ITK 3.14.0.

Below is a basic example that reproduce the problem: a pipeline that 
reads and writes a tiff image, where the reader has ReleaseDataFlagOn():

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"

void main(int argc, char* argv)
{
  typedef unsigned short PixelType;
  typedef itk::Image<PixelType, 2> ImageType;
  typedef itk::ImageFileReader<ImageType> Reader;
  typedef itk::ImageFileWriter<ImageType> Writer;

  Reader::Pointer reader = Reader::New();
  Writer::Pointer writer = Writer::New();

  reader->ReleaseDataFlagOn();  //this seems to be the problem
  writer->SetInput(reader->GetOutput());

  reader->SetFileName("C:\\test\\input.tif");
  writer->SetFileName("C:\\test\\output.tif");

  writer->Write();

  reader->Update();  //this triggers a crash }


The crash occurs somewhere inside the tiff reader (stack trace below). 
The file is however successfully written.
Replacing with writer->Update() produces the same crash.

Without ReleaseDataFlagOn(), it works. 
It also works when using a jpg image instead of a tif, even with 
ReleaseDataFlagOn().

I found a similar report from 2004:
http://www.itk.org/pipermail/insight-users/2004-January/006468.html

Stack trace:
>	GelCorrelation.exe!itk_TIFFRGBAImageOK(tiff * tif=0x00000000, char 
* emsg=0x0013f144)  Line 83 + 0x3 bytes	C
 	GelCorrelation.exe!itk_TIFFReadRGBAImageOriented(tiff * 
tif=0x00000000, unsigned long rwidth=0, unsigned long rheight=0, 
unsigned long * raster=0x028dc7d0, int orientation=4, int stop=1)  Line 
468 + 0x10 bytes	C
 	GelCorrelation.exe!itk_TIFFReadRGBAImage(tiff * tif=0x00000000, 
unsigned long rwidth=0, unsigned long rheight=0, unsigned long * 
raster=0x028dc7d0, int stop=1)  Line 490 + 0x1b bytes	C
 	GelCorrelation.exe!itk::TIFFImageIO::Read(void * 
buffer=0x02af0040)  Line 1305 + 0x28 bytes	C++
 	GelCorrelation.exe!itk::ImageFileReader<itk::Image<unsigned 
short,2>,itk::DefaultConvertPixelTraits<unsigned short> 
>::GenerateData()  Line 401 + 0x33 bytes	C++
 	
GelCorrelation.exe!itk::ProcessObject::UpdateOutputData(itk::DataObject 
* __formal=0x028d7f88)  Line 987 + 0x12 bytes	C++
 	GelCorrelation.exe!itk::DataObject::UpdateOutputData()  Line 420 + 
0x21 bytes	C++
 	GelCorrelation.exe!itk::DataObject::Update()  Line 344 + 0xf bytes	
C++
 	GelCorrelation.exe!itk::ProcessObject::Update()  Line 615 + 0x1c 
bytes	C++
 	GelCorrelation.exe!main(int argc=1, char * argv=0x027e3cb0)  Line 
25 + 0x23 bytes	C++
 	GelCorrelation.exe!__tmainCRTStartup()  Line 597 + 0x19 bytes	
C
 	GelCorrelation.exe!mainCRTStartup()  Line 414	C
 	kernel32.dll!7c817077() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded 
for kernel32.dll]	



----------------------------------------
Ola Kristoffer Øye
CMR Computing
Fantoftvegen 38, N-5072 Bergen, Norway
Phone: +47 55 57 40 04 / +47 41 44 63 53
Fax:   +47 55 57 40 41




More information about the Insight-users mailing list