[Insight-developers] itkHDF5ImageIOTest fails on 32 bit systems

Williams, Norman K norman-k-williams at uiowa.edu
Tue May 31 13:56:01 EDT 2011


I figured this out.  The problem was that HDF5 is language-independent;
while C and C++ distinguish between int and long even if sizeof(int) ==
sizeof(long it), HDF5 does not.


So I had to add attributes to long/unsigned long datasets so they can be
distinguished at read time from int/unsigned int (and bool! ;-?)

This will have an effect on pixel data, but I don't think in practice it
will caise the same sort of problems.  If an image is written on a 32 bit
machine, it will read off disk as NATIVE_INT or NATIVE_UINT, and get
converted to whatever voxel type requested by ImageFileReader.

This only would show up if you were reading/writing itk::Image<long,Dim>
or itk::Image<unsigned long,Dim>.

The problem isn't confined to HDF5 files -- other image formats allow for
images of long int types, and you can get into situations where you're
reading a file written on a 32-bit machine on a 64-bit machine. The reader
and the writer have different ideas about how large a long int is.



On 5/30/11 1:55 PM, "Bill Lorensen" <bill.lorensen at gmail.com> wrote:

>Kent,
>
>The subject test is failing on 32 bit systems. After some CSI work, I
>found that HDF5 is not writing long's as long's on the systems. It
>writes them as int's. The test failure logic has two modes of
>failures. It is this test
>!itk::ExposeMetaData<long>(metaDict2,"TestLong",metaDataLong2) that
>fails. I put some print statements in the meta data code and metaDict2
>is returning an int type for long and an unsigned int type for
>unsigned long.
>
>Seems like an HDF5 config problem or bug, but I'm not up to digging into
>HDF5.
>
>Bill



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list