Section: Visualization Toolkit Imaging Classes
The spacing, origin, extent, and number of components of the output are the same as those for the first input. If the input has an alpha component, then this component is copied unchanged into the output. In addition, if the first input has either one component or two components i.e. if it is either L (greyscale) or LA (greyscale + alpha) then all other inputs must also be L or LA.
Different blending modes are available:
\em Normal (default) : This is the standard blending mode used by OpenGL and other graphics packages. The output always has the same number of components and the same extent as the first input. The alpha value of the first input is not used in the blending computation, instead it is copied directly to the output.
\begin{verbatim} output <- input[0] foreach input i { foreach pixel px { r <- input[i](px)(alpha) * opacity[i] f <- (255 - r) output(px) <- output(px) * f + input(px) * r } } \end{verbatim}
\em Compound : Images are compounded together and each component is scaled by the sum of the alpha/opacity values. Use the CompoundThreshold method to set specify a threshold in compound mode. Pixels with opacity*alpha less or equal than this threshold are ignored. The alpha value of the first input, if present, is NOT copied to the alpha value of the output. The output always has the same number of components and the same extent as the first input.
\begin{verbatim} output <- 0 foreach pixel px { sum <- 0 foreach input i { r <- input[i](px)(alpha) * opacity(i) sum <- sum + r if r > threshold { output(px) <- output(px) + input(px) * r } } output(px) <- output(px) / sum } \end{verbatim}
To create an instance of class vtkImageBlend, simply invoke its constructor as follows
obj = vtkImageBlend
obj
is an instance of the vtkImageBlend class.
string = obj.GetClassName ()
int = obj.IsA (string name)
vtkImageBlend = obj.NewInstance ()
vtkImageBlend = obj.SafeDownCast (vtkObject o)
obj.ReplaceNthInputConnection (int idx, vtkAlgorithmOutput input)
- Replace one of the input connections with a new input. You can
only replace input connections that you previously created with
AddInputConnection() or, in the case of the first input,
with SetInputConnection().
obj.SetInput (int num, vtkDataObject input)
- Set an Input of this filter. This method is only for support of
old-style pipeline connections. When writing new code you should
use SetInputConnection(), AddInputConnection(), and
ReplaceNthInputConnection() instead.
obj.SetInput (vtkDataObject input)
- Set an Input of this filter. This method is only for support of
old-style pipeline connections. When writing new code you should
use SetInputConnection(), AddInputConnection(), and
ReplaceNthInputConnection() instead.
vtkDataObject = obj.GetInput (int num)
- Get one input to this filter. This method is only for support of
old-style pipeline connections. When writing new code you should
use vtkAlgorithm::GetInputConnection(0, num).
vtkDataObject = obj.GetInput ()
- Get one input to this filter. This method is only for support of
old-style pipeline connections. When writing new code you should
use vtkAlgorithm::GetInputConnection(0, num).
int = obj.GetNumberOfInputs ()
- Get the number of inputs to this filter. This method is only for
support of old-style pipeline connections. When writing new code
you should use vtkAlgorithm::GetNumberOfInputConnections(0).
obj.SetOpacity (int idx, double opacity)
- Set the opacity of an input image: the alpha values of the image are
multiplied by the opacity. The opacity of image idx=0 is ignored.
double = obj.GetOpacity (int idx)
- Set the opacity of an input image: the alpha values of the image are
multiplied by the opacity. The opacity of image idx=0 is ignored.
obj.SetStencil (vtkImageStencilData stencil)
- Set a stencil to apply when blending the data.
vtkImageStencilData = obj.GetStencil ()
- Set a stencil to apply when blending the data.
obj.SetBlendMode (int )
- Set the blend mode
int = obj.GetBlendModeMinValue ()
- Set the blend mode
int = obj.GetBlendModeMaxValue ()
- Set the blend mode
int = obj.GetBlendMode ()
- Set the blend mode
obj.SetBlendModeToNormal ()
- Set the blend mode
obj.SetBlendModeToCompound ()
- Set the blend mode
string = obj.GetBlendModeAsString (void )
- Set the blend mode
obj.SetCompoundThreshold (double )
- Specify a threshold in compound mode. Pixels with opacity*alpha less
or equal the threshold are ignored.
double = obj.GetCompoundThreshold ()
- Specify a threshold in compound mode. Pixels with opacity*alpha less
or equal the threshold are ignored.