[Insight-users] bug in tiff reader with ReleaseDataFlagOn() ? (ITK 3.14.0)
Bill Lorensen
bill.lorensen at gmail.com
Mon Jun 8 13:39:11 EDT 2009
Ola,
Please file a bug report following the procedure at:
http://www.itk.org/Wiki/ITK_Procedure_for_Contributing_Bug_Fixes
Thanks,
Bill
On Mon, Jun 8, 2009 at 1:24 PM, Ola Kristoffer
Øye<ola.kristoffer.oye at cmr.no> wrote:
> Hi,
> Thanks for your answer Bill.
>>
>> In your case, the downstream filter (writer) will release the bulk
>> data after the Update(). So a reader->GetOutput() should be invalid,
>> but I think the reader->Update() should regenerate the the reader's
>> output (and not crash). Looks like a bug to me.
>>
>> Does it also fail if you do a reader->UpdateLargestPossibleRegion() ?
>>
>
> Yes, it also fails then. What you describe is also my understanding of
> how it is supposed to work, and it seems to work that way with other
> kinds of imgs (jpg/png).
>
> It seems the problem occurs in TIFFImageIO::Read(...):
> m_InternalImage->m_Image is NULL, probably because of the
> ReleaseDataFlagOn(). Then, TIFFReadRGBAImage(...) is called with
> m_InternalImage->m_Image as argument, and this leads to a crash when
> m_Image is accessed in TIFFRGBAImageOK(...), on the line:
> if (!tif->tif_decodestatus) {
>
> Also, my TIFF is as you can see from my example code unsigned short, not
> RGBA, so why these methods should be called I dont know...
>
> Thanks in advance,
> Regards,
> Ola
>
>
>> Others more knowledgeable about the pipeline may comment or correct my
>> interpretation.
>>
>> Bill
>>
>> On Mon, Jun 8, 2009 at 8:50 AM, Ola Kristoffer
>> Øye<ola.kristoffer.oye at cmr.no> wrote:
>> > 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 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
>> >
>> >
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.itk.org/mailman/listinfo/insight-users
>> >
>
>
>
More information about the Insight-users
mailing list