FreeMat

- Main Page
- Related Pages

vtkImageData

Section: Visualization Toolkit Filtering Classes

# Usage

vtkImageData is a data object that is a concrete implementation of vtkDataSet. vtkImageData represents a geometric structure that is a topological and geometrical regular array of points. Examples include volumes (voxel data) and pixmaps.

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

      obj = vtkImageData

# Methods

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

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkImageData = obj.NewInstance ()`
- `vtkImageData = obj.SafeDownCast (vtkObject o)`
- `obj.CopyStructure (vtkDataSet ds)` - Copy the geometric and topological structure of an input image data object.
- `int = obj.GetDataObjectType ()` - Return what type of dataset this is.
- `vtkIdType = obj.GetNumberOfCells ()` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `vtkIdType = obj.GetNumberOfPoints ()` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `double = obj.GetPoint (vtkIdType ptId)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.GetPoint (vtkIdType id, double x[3])` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `vtkCell = obj.GetCell (vtkIdType cellId)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.GetCell (vtkIdType cellId, vtkGenericCell cell)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.GetCellBounds (vtkIdType cellId, double bounds[6])` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `vtkIdType = obj.FindPoint (double x, double y, double z)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `vtkIdType = obj.FindPoint (double x[3])` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `int = obj.GetCellType (vtkIdType cellId)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.GetCellPoints (vtkIdType cellId, vtkIdList ptIds)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.GetPointCells (vtkIdType ptId, vtkIdList cellIds)` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.ComputeBounds ()` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `int = obj.GetMaxCellSize ()` - Standard vtkDataSet API methods. See vtkDataSet for more information.
- `obj.Initialize ()` - Restore data object to initial state,
- `obj.SetDimensions (int i, int j, int k)` - Pass your way. This is for backward compatibility only. Use SetExtent() instead. Same as SetExtent(0, i-1, 0, j-1, 0, k-1)
- `obj.SetDimensions (int dims[3])` - Pass your way. This is for backward compatibility only. Use SetExtent() instead. Same as SetExtent(0, dims[0]-1, 0, dims[1]-1, 0, dims[2]-1)
- `int = obj.GetDimensions ()` - Get dimensions of this structured points dataset. It is the number of points on each axis. Dimensions are computed from Extents during this call.
- `obj.GetDimensions (int dims[3])` - Get dimensions of this structured points dataset. It is the number of points on each axis. Dimensions are computed from Extents during this call.
- `int = obj.ComputeStructuredCoordinates (double x[3], int ijk[3], double pcoords[3])` - Convenience function computes the structured coordinates for a point x[3]. The voxel is specified by the array ijk[3], and the parametric coordinates in the cell are specified with pcoords[3]. The function returns a 0 if the point x is outside of the volume, and a 1 if inside the volume.
- `obj.GetVoxelGradient (int i, int j, int k, vtkDataArray s, vtkDataArray g)` - Given structured coordinates (i,j,k) for a voxel cell, compute the eight gradient values for the voxel corners. The order in which the gradient vectors are arranged corresponds to the ordering of the voxel points. Gradient vector is computed by central differences (except on edges of volume where forward difference is used). The scalars s are the scalars from which the gradient is to be computed. This method will treat only 3D structured point datasets (i.e., volumes).
- `obj.GetPointGradient (int i, int j, int k, vtkDataArray s, double g[3])` - Given structured coordinates (i,j,k) for a point in a structured point dataset, compute the gradient vector from the scalar data at that point. The scalars s are the scalars from which the gradient is to be computed. This method will treat structured point datasets of any dimension.
- `int = obj.GetDataDimension ()` - Return the dimensionality of the data.
- `vtkIdType = obj.ComputePointId (int ijk[3])` - Given a location in structured coordinates (i-j-k), return the point id.
- `vtkIdType = obj.ComputeCellId (int ijk[3])` - Given a location in structured coordinates (i-j-k), return the cell id.
- `obj.SetAxisUpdateExtent (int axis, int min, int max)` - Set / Get the extent on just one axis
- `obj.UpdateInformation ()` - Override to copy information from pipeline information to data information for backward compatibility. See vtkDataObject::UpdateInformation for details.
- `obj.SetExtent (int extent[6])` - Set/Get the extent. On each axis, the extent is defined by the index of the first point and the index of the last point. The extent should be set before the "Scalars" are set or allocated. The Extent is stored in the order (X, Y, Z). The dataset extent does not have to start at (0,0,0). (0,0,0) is just the extent of the origin. The first point (the one with Id=0) is at extent (Extent[0],Extent[2],Extent[4]). As for any dataset, a data array on point data starts at Id=0.
- `obj.SetExtent (int x1, int x2, int y1, int y2, int z1, int z2)` - Set/Get the extent. On each axis, the extent is defined by the index of the first point and the index of the last point. The extent should be set before the "Scalars" are set or allocated. The Extent is stored in the order (X, Y, Z). The dataset extent does not have to start at (0,0,0). (0,0,0) is just the extent of the origin. The first point (the one with Id=0) is at extent (Extent[0],Extent[2],Extent[4]). As for any dataset, a data array on point data starts at Id=0.
- `int = obj. GetExtent ()` - Set/Get the extent. On each axis, the extent is defined by the index of the first point and the index of the last point. The extent should be set before the "Scalars" are set or allocated. The Extent is stored in the order (X, Y, Z). The dataset extent does not have to start at (0,0,0). (0,0,0) is just the extent of the origin. The first point (the one with Id=0) is at extent (Extent[0],Extent[2],Extent[4]). As for any dataset, a data array on point data starts at Id=0.
- `long = obj.GetEstimatedMemorySize ()` - Get the estimated size of this data object itself. Should be called after UpdateInformation() and PropagateUpdateExtent() have both been called. This estimate should be fairly accurate since this is structured data.
- `double = obj.GetScalarTypeMin ()` - These returns the minimum and maximum values the ScalarType can hold without overflowing.
- `double = obj.GetScalarTypeMax ()` - These returns the minimum and maximum values the ScalarType can hold without overflowing.
- `int = obj.GetScalarSize ()` - Set the size of the scalar type in bytes.
- `vtkIdType = obj.GetIncrements ()` - Different ways to get the increments for moving around the data. GetIncrements() calls ComputeIncrements() to ensure the increments are up to date.
- `obj.GetIncrements (vtkIdType inc[3])` - Different ways to get the increments for moving around the data. GetIncrements() calls ComputeIncrements() to ensure the increments are up to date.
- `float = obj.GetScalarComponentAsFloat (int x, int y, int z, int component)` - For access to data from tcl
- `obj.SetScalarComponentFromFloat (int x, int y, int z, int component, float v)` - For access to data from tcl
- `double = obj.GetScalarComponentAsDouble (int x, int y, int z, int component)` - For access to data from tcl
- `obj.SetScalarComponentFromDouble (int x, int y, int z, int component, double v)` - For access to data from tcl
- `obj.AllocateScalars ()` - Allocate the vtkScalars object associated with this object.
- `obj.CopyAndCastFrom (vtkImageData inData, int extent[6])` - This method is passed a input and output region, and executes the filter algorithm to fill the output from the input. It just executes a switch statement to call the correct function for the regions data types.
- `obj.CopyAndCastFrom (vtkImageData inData, int x0, int x1, int y0, int y1, int z0, int z1)` - Reallocates and copies to set the Extent to the UpdateExtent. This is used internally when the exact extent is requested, and the source generated more than the update extent.
- `obj.Crop ()` - Reallocates and copies to set the Extent to the UpdateExtent. This is used internally when the exact extent is requested, and the source generated more than the update extent.
- `long = obj.GetActualMemorySize ()` - Return the actual size of the data in kilobytes. This number is valid only after the pipeline has updated. The memory size returned is guaranteed to be greater than or equal to the memory required to represent the data (e.g., extra space in arrays, etc. are not included in the return value). THIS METHOD IS THREAD SAFE.
- `obj.SetSpacing (double , double , double )` - Set the spacing (width,height,length) of the cubical cells that compose the data set.
- `obj.SetSpacing (double a[3])` - Set the spacing (width,height,length) of the cubical cells that compose the data set.
- `double = obj. GetSpacing ()` - Set the spacing (width,height,length) of the cubical cells that compose the data set.
- `obj.SetOrigin (double , double , double )` - Set/Get the origin of the dataset. The origin is the position in world coordinates of the point of extent (0,0,0). This point does not have to be part of the dataset, in other words, the dataset extent does not have to start at (0,0,0) and the origin can be outside of the dataset bounding box. The origin plus spacing determine the position in space of the points.
- `obj.SetOrigin (double a[3])` - Set/Get the origin of the dataset. The origin is the position in world coordinates of the point of extent (0,0,0). This point does not have to be part of the dataset, in other words, the dataset extent does not have to start at (0,0,0) and the origin can be outside of the dataset bounding box. The origin plus spacing determine the position in space of the points.
- `double = obj. GetOrigin ()` - Set/Get the origin of the dataset. The origin is the position in world coordinates of the point of extent (0,0,0). This point does not have to be part of the dataset, in other words, the dataset extent does not have to start at (0,0,0) and the origin can be outside of the dataset bounding box. The origin plus spacing determine the position in space of the points.
- `obj.SetScalarTypeToFloat ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToDouble ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToInt ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToUnsignedInt ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToLong ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToUnsignedLong ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToShort ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToUnsignedShort ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToUnsignedChar ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToSignedChar ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarTypeToChar ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetScalarType (int )` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `int = obj.GetScalarType ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `string = obj.GetScalarTypeAsString ()` - Set/Get the data scalar type (i.e VTK_DOUBLE). Note that these methods are setting and getting the pipeline scalar type. i.e. they are setting the type that the image data will be once it has executed. Until the REQUEST_DATA pass the actual scalars may be of some other type. This is for backwards compatibility
- `obj.SetNumberOfScalarComponents (int n)` - Set/Get the number of scalar components for points. As with the SetScalarType method this is setting pipeline info.
- `int = obj.GetNumberOfScalarComponents ()` - Set/Get the number of scalar components for points. As with the SetScalarType method this is setting pipeline info.
- `obj.CopyTypeSpecificInformation (vtkDataObject image)`
- `obj.CopyInformationToPipeline (vtkInformation request, vtkInformation input, vtkInformation output, int forceCopy)` - Override these to handle origin, spacing, scalar type, and scalar number of components. See vtkDataObject for details.
- `obj.CopyInformationFromPipeline (vtkInformation request)` - Override these to handle origin, spacing, scalar type, and scalar number of components. See vtkDataObject for details.
- `obj.PrepareForNewData ()` - make the output data ready for new data to be inserted. For most objects we just call Initialize. But for image data we leave the old data in case the memory can be reused.
- `obj.ShallowCopy (vtkDataObject src)` - Shallow and Deep copy.
- `obj.DeepCopy (vtkDataObject src)` - Shallow and Deep copy.
- `obj.ComputeInternalExtent (int intExt, int tgtExt, int bnds)` - Given how many pixel are required on a side for bounrary conditions (in bnds), the target extent to traverse, compute the internal extent (the extent for this ImageData that does nto suffer from any boundary conditions) and place it in intExt
- `int = obj.GetExtentType ()` - The extent type is a 3D extent