[Insight-developers] [Insight-users] Visual Studio and std::streampos

Luis Ibanez luis.ibanez at kitware.com
Thu Jan 21 14:29:54 EST 2010


Hi Julien,

Thanks for letting me know about your tests.

Just for the history of this code, the use of std::streampos
is something that we adopted in 2007 in response to a
suggestion from the group at CNES:
http://www.itk.org/mailman/private/insight-developers/2007-September/009576.html

since the previous type was restricting the size of images
we could manage with ITK.

I see the point that it would be desirable to be
able to get the real size of the image, even when
working on a 32-bits system.

I'm not sure what could be a good way of implementing
this in a portable and safe way.


      Any suggestions ?


              Thanks


                    Luis


---------------------------------------------------------
On Thu, Jan 21, 2010 at 8:39 AM, Julien Michel <julien.michel at c-s.fr> wrote:
> Luis Ibanez a écrit :
>
>> This would be considered a bug, if the size of
>> the image gets to be reported in a way that
>> prevents the streaming mechanism to work.
>
> Luis,
>
> I apologize for the delay. Actually, I could not try ITK tests because the
> image file format is not compatible with any of the ITK ImageIO (we use one
> of our own).
>
> However, I took a closer look and it appears that things are not that bad :
> itk::ImageIOBase::GetImageSizeInBytes() will return a negative number if the
> image is a 2 bytes per pixel one whose size exceed 1073744823 pixels because
> on 32 bits windows it is supposed to return a std::streampos which is
> defined as long in this case.
>
> But the code calling GetImageSizeInBytes() to determine the size of the
> buffer to allocate was on our side, and I managed to workaround it to avoid
> calling this method (actually, the new version is better).
>
> So yes, I think there is a problem with using std::streampos to represent
> image size in bytes on 32 bits windows in itk::ImageIOBase, but no, it does
> not impact the image reading capability on ITK side.
>
> Thanks a lot,
>
> Regards,
>
> Julien
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Julien MICHEL - Ingénieur d'études - Traitement d'images
> CS Systèmes d'Information - Division ESPACE
> Département Information Géographique & Image
> Téléphone : +33 561 17 64 27
> Email : julien.michel at c-s.fr
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>


More information about the Insight-developers mailing list