FreeMat
vtkBitArray

Section: Visualization Toolkit Common Classes

Usage

vtkBitArray is an array of bits (0/1 data value). The array is packed so that each byte stores eight bits. vtkBitArray provides methods for insertion and retrieval of bits, and will automatically resize itself to hold new data.

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

  obj = vtkBitArray

Methods

The class vtkBitArray 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 vtkBitArray class.

  • string = obj.GetClassName ()
  • int = obj.IsA (string name)
  • vtkBitArray = obj.NewInstance ()
  • vtkBitArray = obj.SafeDownCast (vtkObject o)
  • int = obj.Allocate (vtkIdType sz, vtkIdType ext) - Allocate memory for this array. Delete old storage only if necessary. Note that ext is no longer used.
  • obj.Initialize () - Release storage and reset array to initial state.
  • int = obj.GetDataType ()
  • int = obj.GetDataTypeSize () - Set the number of n-tuples in the array.
  • obj.SetNumberOfTuples (vtkIdType number) - Set the number of n-tuples in the array.
  • obj.SetTuple (vtkIdType i, vtkIdType j, vtkAbstractArray source) - Set the tuple at the ith location using the jth tuple in the source array. This method assumes that the two arrays have the same type and structure. Note that range checking and memory allocation is not performed; use in conjunction with SetNumberOfTuples() to allocate space.
  • obj.InsertTuple (vtkIdType i, vtkIdType j, vtkAbstractArray source) - Insert the jth tuple in the source array, at ith location in this array. Note that memory allocation is performed as necessary to hold the data.
  • vtkIdType = obj.InsertNextTuple (vtkIdType j, vtkAbstractArray source) - Insert the jth tuple in the source array, at the end in this array. Note that memory allocation is performed as necessary to hold the data. Returns the location at which the data was inserted.
  • obj.GetTuple (vtkIdType i, double tuple) - Copy the tuple value into a user-provided array.
  • obj.SetTuple (vtkIdType i, float tuple) - Set the tuple value at the ith location in the array.
  • obj.SetTuple (vtkIdType i, double tuple) - Set the tuple value at the ith location in the array.
  • obj.InsertTuple (vtkIdType i, float tuple) - Insert (memory allocation performed) the tuple into the ith location in the array.
  • obj.InsertTuple (vtkIdType i, double tuple) - Insert (memory allocation performed) the tuple into the ith location in the array.
  • vtkIdType = obj.InsertNextTuple (float tuple) - Insert (memory allocation performed) the tuple onto the end of the array.
  • vtkIdType = obj.InsertNextTuple (double tuple) - Insert (memory allocation performed) the tuple onto the end of the array.
  • obj.RemoveTuple (vtkIdType id) - These methods remove tuples from the data array. They shift data and resize array, so the data array is still valid after this operation. Note, this operation is fairly slow.
  • obj.RemoveFirstTuple () - These methods remove tuples from the data array. They shift data and resize array, so the data array is still valid after this operation. Note, this operation is fairly slow.
  • obj.RemoveLastTuple () - These methods remove tuples from the data array. They shift data and resize array, so the data array is still valid after this operation. Note, this operation is fairly slow.
  • obj.SetComponent (vtkIdType i, int j, double c) - Set the data component at the ith tuple and jth component location. Note that i is less then NumberOfTuples and j is less then NumberOfComponents. Make sure enough memory has been allocated (use SetNumberOfTuples() and SetNumberOfComponents()).
  • obj.Squeeze () - Free any unneeded memory.
  • int = obj.Resize (vtkIdType numTuples) - Resize the array while conserving the data.
  • int = obj.GetValue (vtkIdType id) - Get the data at a particular index.
  • obj.SetNumberOfValues (vtkIdType number) - Fast method based setting of values without memory checks. First use SetNumberOfValues then use SetValue to actually set them. Specify the number of values for this object to hold. Does an allocation as well as setting the MaxId ivar. Used in conjunction with SetValue() method for fast insertion.
  • obj.SetValue (vtkIdType id, int value) - Set the data at a particular index. Does not do range checking. Make sure you use the method SetNumberOfValues() before inserting data.
  • obj.InsertValue (vtkIdType id, int i) - Insets values and checks to make sure there is enough memory
  • vtkIdType = obj.InsertNextValue (int i)
  • obj.InsertComponent (vtkIdType i, int j, double c) - Insert the data component at ith tuple and jth component location. Note that memory allocation is performed as necessary to hold the data.
  • obj.DeepCopy (vtkDataArray da) - Deep copy of another bit array.
  • obj.DeepCopy (vtkAbstractArray aa) - This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array. If save 0, the array must have been allocated with new[] not malloc.
  • obj.SetArray (string array, vtkIdType size, int save) - This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array. If save 0, the array must have been allocated with new[] not malloc.
  • vtkArrayIterator = obj.NewIterator () - Returns a new vtkBitArrayIterator instance.
  • vtkIdType = obj.LookupValue (int value)
  • obj.LookupValue (int value, vtkIdList ids)
  • obj.DataChanged () - Tell the array explicitly that the data has changed. This is only necessary to call when you modify the array contents without using the array's API (i.e. you retrieve a pointer to the data and modify the array contents). You need to call this so that the fast lookup will know to rebuild itself. Otherwise, the lookup functions will give incorrect results.
  • obj.ClearLookup () - Delete the associated fast lookup data structure on this array, if it exists. The lookup will be rebuilt on the next call to a lookup function.