PiecewiseGaussianWidget
Methods
addGaussian
Append a gaussian.
Returns
| Type | Description |
|---|---|
| The index of the newly added gaussian. |
applyOpacity
Push the current gaussians onto a piecewise function.
| Argument | Type | Required | Description |
|---|---|---|---|
piecewiseFunction | vtkPiecewiseFunction | Yes | The function to update |
dataRange | Vector2 | No | Defaults to the range of the histogram array |
bindMouseListeners
Attach the mouse listeners to the canvas. Called automatically by setContainer.
extend
Method used to decorate a given object (publicAPI+model) with vtkPiecewiseGaussianWidget characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IPiecewiseGaussianWidgetInitialValues | No | (default: {}) |
getBackgroundImage
An image drawn as the chart background. Has no default, so it is undefined until set.
getCanvas
Get the canvas the widget draws onto.
getColorTransferFunction
The color transfer function drawn under the chart. Has no default, so it is undefined until set.
getEnableRangeZoom
Whether the zoom control is shown and usable.
getGaussianMinimumHeight
Get the minimum height a gaussian may be dragged down to.
getGaussians
Get the gaussians currently defined.
getNumberOfBins
Get the number of bins of the histogram.
getOpacityNodes
Build the piecewise function nodes matching the current gaussians.
| Argument | Type | Required | Description |
|---|---|---|---|
dataRange | Vector2 | No | Defaults to the range of the histogram array |
getOpacityRange
Get the sub-range over which the opacity is non-zero.
| Argument | Type | Required | Description |
|---|---|---|---|
dataRange | Vector2 | No | Defaults to the range of the histogram array |
getPiecewiseSize
Get the number of samples the gaussians are discretized into when building the piecewise function.
getRangeZoom
The zoomed sub-range, normalized in [0, 1].
getSize
Get the widget size, as [width, height] in pixels.
height
Peak opacity of the gaussian, in [0, 1].
newInstance
Method used to create a new instance of vtkPiecewiseGaussianWidget
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IPiecewiseGaussianWidgetInitialValues | No | for pre-setting some of its content |
onAnimation
Register a callback invoked while a gaussian is being dragged.
onClick
Mouse handlers, in canvas coordinates. They are wired to the canvas by bindMouseListeners, but are also callable directly.
onOpacityChange
Register a callback invoked whenever the opacity changes.
onZoomChange
Register a callback invoked whenever the zoomed range changes.
position
Center of the gaussian, normalized in [0, 1] over the data range.
removeGaussian
Remove the gaussian at the given index.
render
Redraw the widget.
setContainer
Attach the widget canvas to the given DOM element. Pass null to detach.
setDataArray
Compute the histogram displayed behind the gaussians from a data array.
The histogram is computed on web workers, so it is not available when this call returns. Observe completion through onModified.
| Argument | Type | Required | Description |
|---|---|---|---|
array | Yes | The values to build the histogram from | |
options | ISetDataArrayOptions | No | How to interpret the array |
setGaussians
Replace the gaussians.
setSize
Resize the widget.
unbindMouseListeners
Detach the mouse listeners from the canvas.
updateStyle
Merge the given style into the widget style.
width
Width of the gaussian, normalized over the data range.
xBias
Horizontal bias applied to the gaussian.
yBias
Vertical bias applied to the gaussian.