PaintFilter
Introduction
vtkPaintFilter - painting into a label map
vtkPaintFilter is a source producing a label map, of the same geometry as the background image, that is painted into with a brush. A stroke is opened with startStroke, fed with addPoint, paintRectangle, paintEllipse or paintPolygon, and committed with endStroke. Committed strokes can be reverted with undo and reapplied with redo.
Methods
addPoint
Add a point to the current stroke.
| Argument | Type | Required | Description |
|---|---|---|---|
point | Vector3 | Yes | world coordinates |
applyBinaryMask
Write the current label into the label map wherever maskBuffer is set, pushing the overwritten values onto the undo history.
| Argument | Type | Required | Description |
|---|---|---|---|
maskBuffer | Yes | binary mask, one byte per point of the label map |
applyLabelMap
Replace the label map, recording the difference with the current one as a single undoable step.
| Argument | Type | Required | Description |
|---|---|---|---|
labelMap | vtkImageData | Yes |
canRedo
Whether there is a step available to redo.
canUndo
Whether there is a step available to undo.
endStroke
Terminate the current stroke and apply it to the label map. Returns undefined when no stroke is in progress.
extend
Method used to decorate a given object (publicAPI+model) with vtkPaintFilter 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 | IPaintFilterInitialValues | No | (default: {}) |
getBackgroundImage
Get the image the voxel function is evaluated against.
getLabel
Get the value written into the label map by the current stroke.
getLabelMap
Get the label map being painted into.
getMaskWorldToIndex
Get the transform used to convert the painted world coordinates into label map indices.
getRadius
Get the brush radius, in world units.
getSlicingMode
Get the slicing mode restricting the paint operations to a single slice.
getVoxelFunc
Get the predicate deciding, per voxel, whether the label is written.
newInstance
Method used to create a new instance of vtkPaintFilter
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IPaintFilterInitialValues | No | for pre-setting some of its content |
paintEllipse
Paint the axis-aligned ellipse of the current stroke.
| Argument | Type | Required | Description |
|---|---|---|---|
center | Vector3 | Yes | world coordinates of the center |
scale3 | Vector3 | Yes | world coordinates of the semi-axes |
paintPolygon
Paint the triangulated polygon defined by a flat list of world coordinates.
| Argument | Type | Required | Description |
|---|---|---|---|
pointList | Array[Number] | Yes | flattened xyz triplets |
paintRectangle
Paint the axis-aligned box spanned by two world points.
| Argument | Type | Required | Description |
|---|---|---|---|
point1 | Vector3 | Yes | |
point2 | Vector3 | Yes |
redo
Re-apply the last undone step.
requestData
Allocate the label map from the background image if needed and publish it on the output port.
| Argument | Type | Required | Description |
|---|---|---|---|
inData | Yes | ||
outData | Yes |
setBackgroundImage
Set the image the voxel function is evaluated against.
| Argument | Type | Required | Description |
|---|---|---|---|
backgroundImage | vtkImageData | Yes |
setLabel
Set the value written into the label map by the following strokes.
| Argument | Type | Required | Description |
|---|---|---|---|
label | Number | Yes |
setLabelMap
Set the label map being painted into. Setting it resets the undo history.
| Argument | Type | Required | Description |
|---|---|---|---|
labelMap | vtkImageData | Yes |
setMaskWorldToIndex
Set the transform used to convert the painted world coordinates into label map indices.
| Argument | Type | Required | Description |
|---|---|---|---|
maskWorldToIndex | mat4 | Yes |
setRadius
Set the brush radius, in world units.
| Argument | Type | Required | Description |
|---|---|---|---|
radius | Number | Yes |
setSlicingMode
Restrict the paint operations to a single slice along the given axis, or pass null to paint in 3D.
| Argument | Type | Required | Description |
|---|---|---|---|
slicingMode | Number | Yes |
setVoxelFunc
Set a predicate deciding, per voxel, whether the label is written.
| Argument | Type | Required | Description |
|---|---|---|---|
voxelFunc | VoxelFunc | Yes |
startStroke
Start a new stroke. Paint operations are accumulated by a worker until endStroke is called.
undo
Revert the last applied stroke.