[Insight-developers] Analyze writer header size incorrect on64-bit system

kent williams norman-k-williams at uiowa.edu
Tue Jul 24 11:47:26 EDT 2007


Actually there¹s a time-honored tradition in C and C++ programs for doing
exactly that.  The Analyze/NIfTI headers are structured carefully such that
all variables start on 32-bit word boundaries.  Compilers have always been
written with this sort of Œshort cut¹ in mind. If you did build a compiler
that did something unexpected with structure packing and alignment, 3/4 of
Unix and Linux and Windows programs would break.

All of the binary file formats supported in ImageIO make some sort of
assumption about structure alignments in memory and on disk.


On 7/24/07 10:10 AM, "Thielemans, Kris" <kris.thielemans at csc.mrc.ac.uk>
wrote:

> Hi Hans
>  
> you can generally not hope for a correspondence between sizeof(your_structure)
> and anything file-based. The compiler might do aligning, packing, different
> sizes of types,... You really have to make sure that when reading/writing, the
> bits in the file get translated correctly to/from your structure.
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20070724/904e7ad4/attachment.html


More information about the Insight-developers mailing list