[vtkusers] VTK File format: Little/big endian problem [or] looking for a VTK guru...

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Mon Mar 17 04:24:50 EST 2003


Hi all,

	I would like to know when working on an intel plateform in what kind of 
endianess Binary VTK Structured Points files are stored ?

	I am working on a Linux OS with AMD processors, and I have found that 
my binary files are stored in Big Endian...
	According to : http://public.kitware.com/VTK/pdf/file-formats.pdf I 
should have Little endian files, right ?

---

I check what cmake had found:

$ grep ENDIAN VTKBin/CMakeCache.txt
CMAKE_WORDS_BIGENDIAN:INTERNAL=0
HAVE_CMAKE_WORDS_BIGENDIAN:INTERNAL=TRUE

---

I also put on my web page the files that I used for checking this
little/big endian problem. For _courageous_ people you'll find them here:

    http://www.creatis.insa-lyon.fr/~malaterre/vtk/endian/

Where you'll find:

- phantom_FLw.raw, comes from Insight ftp web directory : 
ftp://public.kitware.com/pub/itk/Data/MultiChannelMSPhantomData/Phantom/phantom_FLw.zip

- ReadMe.txt, describe the file format.

- read.py, is a python script that allow user to read this raw file

- phantom_FLw.mha, this is a MetaIO header files that allow ITK user to
easily read phantom_FLw.raw

- phantom_FLw_LE.raw, is the Little Endian version of phantom_FLw.raw

- phantom_FLw_LE.mha, is again the MetaIO header associated.

- phantom_FLw.vtk, comes from phantom_FLw.raw <- Big Endian

- phantom_FLw_LE.vtk, comes from phantom_FLw_LE.raw <- Little Endian

---

	If you diff phantom_FLw.vtk phantom_FLw_LE.vtk you'll see there is 
absolutely no difference. And when you use hexedit (or hexdiff) you'll 
see that both vtk files are in Big Endian (while comparing to
phantom_FLw.raw)...
	Be aware that I didn't used read.py to output the VTK files as it 
writes COLOR_SCALARS instead of SCALARS thus it didn't allow direct
comparison between VTK and RAW files...I used instead an ITK tool
therefore you only need to delete the first 10 lines of each VTK file to
compare to the raw one.

---

	For normal people, could they try to load these VTK files (gzip files 
are provided to ease downloading) and tell me if the VTK files works (on 
what kind of OS = Little/Big endian), please. You should see a phantom 
that mimic the MS lesions in brain MR scans (see MSLesion.png for rough 
idea).
	In case there is a little genious around (or someone with lots of time 
to waste...) could he told me why I got Big Endian files on my Little 
Endian system ???


Thank you all,
mathieu...banging his head against the wall...


-- 
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/






More information about the vtkusers mailing list