[Insight-developers] Re: Limitation in MetaIO causing problems initkNeuralNetworkFileReader/Writer

Stephen R. Aylward Stephen.Aylward at Kitware.com
Tue Aug 21 12:50:19 EDT 2007


MetaUtils has a nice, runtime, cross-platform test for MSB.

bool MET_SystemByteOrderMSB(void);
- Returns true if the system is MSB.

Stephen

Sean McBride wrote:
> On 8/21/07 9:29 AM, kent williams said:
> 
>> Looking at the MetIO classes more closely this morning, it appears that it
>> already supports binary data output, which doesn't have the limitations that
>> The ASCII record type has with respect to data size.
>>
>> Like the vnl_matlab classes, it needs to take into account machine
>> endianness, which right now it ignores.
> 
> If you or someone else fixes that, please do not use a TRY_RUN to decide
> the endianness, doing so causes major headaches for cross-compiling in
> general, and, in particular, building 'universal binaries' on Mac OS X.
> 
> The compiler knows the endianness (it is generating assembly, so it
> knows all about the CPU); there is no need to make the determination at
> configure time.  Alas, I know of no way to query a compiler that works
> with every compiler.  #if __BIG_ENDIAN or #if __BIG_ENDIAN__ works on
> many, but not all.
> 
> Better, when possible, is to use functions like ntohl().
> 

-- 
=============================================================
Stephen R. Aylward, Ph.D.
Chief Medical Scientist
Kitware, Inc. - Chapel Hill Office
http://www.kitware.com
Phone: (518)371-3971 x300


More information about the Insight-developers mailing list