[Insight-users] Interesting TIFF Loading Troubles

George Linderman gcl22 at case.edu
Mon Mar 28 18:18:19 EDT 2011


Dear All,

I have a stacked TIFF image that I am trying to load, and whenever I load
it, I get the most ungodly runtime error.  It is not an ordinary TIFF, it's
proprietary, and has all kinds of custom tags.   The most interesting part
is that if I open said TIFF in ImageJ, and then save as a .tif, I can load
it in ITK beautifully.  I can also manipulate it with LibTIFF tools in
linux, so the format is clearly tif, and is clearly readable.

The relevant code:

       typedef itk::Image< unsigned char,  3 >    InputImageType;

       typedef itk::ImageFileReader< InputImageType > ReaderType;

       ReaderType::Pointer reader = ReaderType::New();

       reader->SetFileName( filename_rep.toLocal8Bit().data() );

      * reader->Update(); //Runtime Error*

       this->itkStackedImage = reader->GetOutput();


I also get this application output:

TIFFReadDirectory: Warning, file.tif: unknown field with tag 65092 (0xfe44)
> encountered.

terminate called after throwing an instance of 'std::bad_alloc'

  what():  std::bad_alloc


Could it be the tags?  Surely ITK would just ignore them, they are merely
warnings.

To summarize, I get a runtime error when loading the original image.  When I
simply open the image in ImageJ, and then save as a .tif, the above code
works beautifully.

The platform is Windows XP, and I am using using ITK3.20.  I am also using
Qt, so the compiler is mingw32.

Thank you,
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110328/7744ae0a/attachment.htm>


More information about the Insight-users mailing list