[Insight-developers] Analyze writer header size incorrecton64-bit system

Thielemans, Kris kris.thielemans at csc.mrc.ac.uk
Tue Jul 24 11:59:53 EDT 2007


Hi Kent
 
ok. well, at some point, 3/4 of Unix and Windows programs will break then :)
we've just had the luxury to be on pretty much the same architectures. That's changing now.
 
Kris

________________________________

From: insight-developers-bounces+kris.thielemans=csc.mrc.ac.uk at itk.org on behalf of kent williams
Sent: Tue 24/07/2007 11:47
To: ITK
Subject: Re: [Insight-developers] Analyze writer header size incorrecton64-bit system


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/c933fb78/attachment.htm


More information about the Insight-developers mailing list