[Insight-developers] Problem with large image file : Bug# 5710
Luis Ibanez
luis.ibanez at kitware.com
Sat Sep 15 18:47:07 EDT 2007
Hi Thomas,
This issue has now been reported in the bug tracker as Bug#5710
http://public.kitware.com/Bug/view.php?id=5710
and a fix has been committed to the CVS repository:
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/IO/itkImageIOBase.h?root=Insight&sortby=date&r2=1.47&r1=1.46
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/IO/itkImageIOBase.cxx?root=Insight&sortby=date&r2=1.70&r1=1.69
Could you please give it a try and let us know if that
helped in any way ?
Thanks
Luis
-------------------
Luis Ibanez wrote:
>
>
> Hi Thomas,
>
> Thanks for pointing this out.
>
> Your solution seems reasonable.
>
> We are trying to work out the following details
>
> 1) The change will have to be applied across the board
> to any other classes that manage files. Eg. the derived
> ImageIO classes. This is just a matter of being consistent
> and making sure that the large integer is not truncated
> to a smaller one in any intermediate call.
>
> 2) In order to choose between std::streamoff and std::streampos
> we are looking at the following page from Boost:
> http://boost.org/libs/iostreams/doc/functions/positioning.html
>
> 3) We should consider the implications in 64bits architectures.
>
>
> We are looking at the way VTK manage the size of files, and
> it seems that it maps to a vtkIdType, which is configurable
> to 64 bits depending of a selection of a CMake option.
>
> In any case, we will start by introducing a typedef, so it
> will be easier to propagate the type in a consistent manner.
>
> A first suggestion will be to have in itk::ImageIOBase.h
>
> typedef std::streamoff SizeType;
>
> and replace:
>
> virtual unsigned int GetPixelStride () const;
> unsigned int GetImageSizeInPixels() const;
> unsigned int GetImageSizeInBytes() const;
> unsigned int GetImageSizeInComponents() const;
>
> with:
>
> virtual SizeType GetPixelStride () const;
> SizeType GetImageSizeInPixels() const;
> SizeType GetImageSizeInBytes() const;
> SizeType GetImageSizeInComponents() const;
>
>
> Just out of curiosity:
>
> a) How big was the file ?
> b) What file format are you using ?
>
>
>
> Thanks
>
>
> Luis
>
>
>
>
> ----------------------
> Thomas Feuvrier wrote:
>
>> Dear ITK users
>>
>> I am an OTB developer and I am trying to read very large image file
>> with itk::ImageFileReader.
>> When I try to read such images, an error is generated at line 384 of
>> the itk::ImageFileReader, in the instruction
>> m_ImageIO->GetImageSizeInBytes().
>>
>> Indeed, the itk::ImageIOBase::GetImageSizeInBytes() method (which
>> calls this->GetImageSizeInComponents() * this->GetComponentSize(), ...
>> ) returns an "unsigned int" value. For large image file, "unsigned
>> int" is not well suited (4 bytes).
>> The solution would be to replace "unsigned int" by std::streamoff (8
>> bytes) or possibly std::streampos (16 bytes).
>> Is there a way to bypass this problem ?
>>
>> Best regards,
>> Thomas
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>
More information about the Insight-developers
mailing list