Commit 586141f8 authored by Ken Martin's avatar Ken Martin
Browse files

better swap byte handling

parent 6cf78f70
......@@ -54,6 +54,25 @@ vtkVolume16Reader::vtkVolume16Reader()
this->Transform = NULL;
}
void vtkVolume16Reader::SetFileTypeBigEndian()
{
#ifndef WORDS_BIGENDIAN
this->SwapBytesOn();
#else
this->SwapBytesOff();
#endif
}
void vtkVolume16Reader::SetFileTypeLittleEndian()
{
#ifdef WORDS_BIGENDIAN
this->SwapBytesOn();
#else
this->SwapBytesOff();
#endif
}
void vtkVolume16Reader::Execute()
{
vtkScalars *newScalars;
......
......@@ -96,6 +96,21 @@ public:
vtkSetMacro(HeaderSize,int);
vtkGetMacro(HeaderSize,int);
// Description:
// These methods should be used instead of the SwapBytes methods.
// They indicate the byte ordering of the file you are trying
// to read in. These methods will then either swap or not swap
// the bytes depending on the byte ordering of the machine it is
// being run on. For example, reading in a BigEndian file on a
// BigEndian machine will result in no swapping. Trying to read
// the same file on a LittleEndian machine will result in swapping.
// As a quick note most UNIX machines are BigEndian while PC's
// and VAX tend to be LittleEndian. So if the file you are reading
// in was generated on a VAX or PC, SetFileTypeLittleEndian otherwise
// SetFileTypeBigEndian.
void SetFileTypeBigEndian();
void SetFileTypeLittleEndian();
// Description:
// Turn on/off byte swapping.
vtkSetMacro(SwapBytes,int);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment