FreeMat

- Main Page
- Related Pages

vtkParticleReader

Section: Visualization Toolkit IO Classes

# Usage

vtkParticleReader reads either a binary or a text file of particles. Each particle can have associated with it an optional scalar value. So the format is: x, y, z, scalar (all floats or doubles). The text file can consist of a comma delimited set of values. In most cases vtkParticleReader can automatically determine whether the file is text or binary. The data can be either float or double. Progress updates are provided. With respect to binary files, random access into the file to read pieces is supported.

To create an instance of class vtkParticleReader, simply invoke its constructor as follows

      obj = vtkParticleReader

# Methods

The class vtkParticleReader has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkParticleReader class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkParticleReader = obj.NewInstance ()`
- `vtkParticleReader = obj.SafeDownCast (vtkObject o)`
- `obj.SetFileName (string )` - Specify file name.
- `string = obj.GetFileName ()` - Specify file name.
- `obj.SetDataByteOrderToBigEndian ()` - 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, SetDataByteOrderToLittleEndian otherwise SetDataByteOrderToBigEndian. Not used when reading text files.
- `obj.SetDataByteOrderToLittleEndian ()` - 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, SetDataByteOrderToLittleEndian otherwise SetDataByteOrderToBigEndian. Not used when reading text files.
- `int = obj.GetDataByteOrder ()` - 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, SetDataByteOrderToLittleEndian otherwise SetDataByteOrderToBigEndian. Not used when reading text files.
- `obj.SetDataByteOrder (int )` - 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, SetDataByteOrderToLittleEndian otherwise SetDataByteOrderToBigEndian. Not used when reading text files.
- `string = obj.GetDataByteOrderAsString ()` - 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, SetDataByteOrderToLittleEndian otherwise SetDataByteOrderToBigEndian. Not used when reading text files.
- `obj.SetSwapBytes (int )` - Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.
- `int = obj.GetSwapBytes ()` - Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.
- `obj.SwapBytesOn ()` - Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.
- `obj.SwapBytesOff ()` - Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.
- `obj.SetHasScalar (int )` - Default: 1. If 1 then each particle has a value associated with it.
- `int = obj.GetHasScalar ()` - Default: 1. If 1 then each particle has a value associated with it.
- `obj.HasScalarOn ()` - Default: 1. If 1 then each particle has a value associated with it.
- `obj.HasScalarOff ()` - Default: 1. If 1 then each particle has a value associated with it.
- `obj.SetFileType (int )` - Get/Set the file type. The options are:
  - FILE_TYPE_IS_UNKNOWN (default) the class will attempt to determine the file type. If this fails then you should set the file type yourself.
  - FILE_TYPE_IS_TEXT the file type is text.
  - FILE_TYPE_IS_BINARY the file type is binary.
- `int = obj.GetFileTypeMinValue ()` - Get/Set the file type. The options are:
  - FILE_TYPE_IS_UNKNOWN (default) the class will attempt to determine the file type. If this fails then you should set the file type yourself.
  - FILE_TYPE_IS_TEXT the file type is text.
  - FILE_TYPE_IS_BINARY the file type is binary.
- `int = obj.GetFileTypeMaxValue ()` - Get/Set the file type. The options are:
  - FILE_TYPE_IS_UNKNOWN (default) the class will attempt to determine the file type. If this fails then you should set the file type yourself.
  - FILE_TYPE_IS_TEXT the file type is text.
  - FILE_TYPE_IS_BINARY the file type is binary.
- `int = obj.GetFileType ()` - Get/Set the file type. The options are:
  - FILE_TYPE_IS_UNKNOWN (default) the class will attempt to determine the file type. If this fails then you should set the file type yourself.
  - FILE_TYPE_IS_TEXT the file type is text.
  - FILE_TYPE_IS_BINARY the file type is binary.
- `obj.SetFileTypeToUnknown ()` - Get/Set the file type. The options are:
  - FILE_TYPE_IS_UNKNOWN (default) the class will attempt to determine the file type. If this fails then you should set the file type yourself.
  - FILE_TYPE_IS_TEXT the file type is text.
  - FILE_TYPE_IS_BINARY the file type is binary.
- `obj.SetFileTypeToText ()` - Get/Set the file type. The options are:
  - FILE_TYPE_IS_UNKNOWN (default) the class will attempt to determine the file type. If this fails then you should set the file type yourself.
  - FILE_TYPE_IS_TEXT the file type is text.
  - FILE_TYPE_IS_BINARY the file type is binary.
- `obj.SetFileTypeToBinary ()` - Get/Set the data type. The options are:
  - VTK_FLOAT (default) single precision floating point.
  - VTK_DOUBLE double precision floating point.
- `obj.SetDataType (int )` - Get/Set the data type. The options are:
  - VTK_FLOAT (default) single precision floating point.
  - VTK_DOUBLE double precision floating point.
- `int = obj.GetDataTypeMinValue ()` - Get/Set the data type. The options are:
  - VTK_FLOAT (default) single precision floating point.
  - VTK_DOUBLE double precision floating point.
- `int = obj.GetDataTypeMaxValue ()` - Get/Set the data type. The options are:
  - VTK_FLOAT (default) single precision floating point.
  - VTK_DOUBLE double precision floating point.
- `int = obj.GetDataType ()` - Get/Set the data type. The options are:
  - VTK_FLOAT (default) single precision floating point.
  - VTK_DOUBLE double precision floating point.
- `obj.SetDataTypeToFloat ()` - Get/Set the data type. The options are:
  - VTK_FLOAT (default) single precision floating point.
  - VTK_DOUBLE double precision floating point.
- `obj.SetDataTypeToDouble ()`