Skip to content

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.

ArgumentTypeRequiredDescription
pointVector3Yesworld coordinates

applyBinaryMask ​

Write the current label into the label map wherever maskBuffer is set, pushing the overwritten values onto the undo history.

ArgumentTypeRequiredDescription
maskBufferYesbinary 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.

ArgumentTypeRequiredDescription
labelMapvtkImageDataYes

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.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIPaintFilterInitialValuesNo(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

ArgumentTypeRequiredDescription
initialValuesIPaintFilterInitialValuesNofor pre-setting some of its content

paintEllipse ​

Paint the axis-aligned ellipse of the current stroke.

ArgumentTypeRequiredDescription
centerVector3Yesworld coordinates of the center
scale3Vector3Yesworld coordinates of the semi-axes

paintPolygon ​

Paint the triangulated polygon defined by a flat list of world coordinates.

ArgumentTypeRequiredDescription
pointListArray[Number]Yesflattened xyz triplets

paintRectangle ​

Paint the axis-aligned box spanned by two world points.

ArgumentTypeRequiredDescription
point1Vector3Yes
point2Vector3Yes

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.

ArgumentTypeRequiredDescription
inDataYes
outDataYes

setBackgroundImage ​

Set the image the voxel function is evaluated against.

ArgumentTypeRequiredDescription
backgroundImagevtkImageDataYes

setLabel ​

Set the value written into the label map by the following strokes.

ArgumentTypeRequiredDescription
labelNumberYes

setLabelMap ​

Set the label map being painted into. Setting it resets the undo history.

ArgumentTypeRequiredDescription
labelMapvtkImageDataYes

setMaskWorldToIndex ​

Set the transform used to convert the painted world coordinates into label map indices.

ArgumentTypeRequiredDescription
maskWorldToIndexmat4Yes

setRadius ​

Set the brush radius, in world units.

ArgumentTypeRequiredDescription
radiusNumberYes

setSlicingMode ​

Restrict the paint operations to a single slice along the given axis, or pass null to paint in 3D.

ArgumentTypeRequiredDescription
slicingModeNumberYes

setVoxelFunc ​

Set a predicate deciding, per voxel, whether the label is written.

ArgumentTypeRequiredDescription
voxelFuncVoxelFuncYes

startStroke ​

Start a new stroke. Paint operations are accumulated by a worker until endStroke is called.

undo ​

Revert the last applied stroke.