Skip to content

SLICSource ​

Introduction ​

vtkSLICSource generates a synthetic image made of Voronoi cells (clusters). Each voxel is assigned to its closest cluster center, and its scalar value is given by the affine function attached to that cluster. The output image holds two point arrays: the cluster index and the field value.

Usage ​

js
import vtkSLICSource from '@kitware/vtk.js/Filters/Sources/SLICSource';

const source = vtkSLICSource.newInstance({ dimensions: [20, 20, 20] });
source.addCluster(5, 5, 5, 1, 0, 0, 0);
source.addCluster(15, 15, 15, 2, 0, 0, 0);
const imageData = source.getOutputData();

Methods ​

addCluster ​

Add a cluster centered on the given world position, whose field is the affine function fnConst + fnDfDx * dx + fnDfDy * dy + fnDfDz * dz where d* is the offset from the cluster center.

ArgumentTypeRequiredDescription
centerXNumberYes
centerYNumberYes
centerZNumberYes
fnConstNumberYes
fnDfDxNumberYes
fnDfDyNumberYes
fnDfDzNumberYes

Returns ​

TypeDescription
the id of the newly created cluster

extend ​

Method used to decorate a given object (publicAPI+model) with vtkSLICSource characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesISLICSourceInitialValuesNo(default: {})

getClusterArrayName ​

Get the name of the output array holding the cluster index of each voxel.

getDimensions ​

Get the dimensions of the output image.

getDimensionsByReference ​

Get the dimensions of the output image.

getNumberOfClusters ​

Get the number of clusters.

getOrigin ​

Get the origin of the output image.

getOriginByReference ​

Get the origin of the output image.

getScalarArrayName ​

Get the name of the output array holding the field value of each voxel.

getSpacing ​

Get the spacing of the output image.

getSpacingByReference ​

Get the spacing of the output image.

newInstance ​

Method used to create a new instance of vtkSLICSource.

ArgumentTypeRequiredDescription
initialValuesISLICSourceInitialValuesNofor pre-setting some of its content

removeAllClusters ​

Remove every cluster.

removeCluster ​

Remove the cluster with the given id. Removing a cluster shifts the ids of the following ones.

ArgumentTypeRequiredDescription
idNumberYes

requestData ​

Expose methods

ArgumentTypeRequiredDescription
inDataYes
outDataYes

setClusterArrayName ​

Set the name of the output array holding the cluster index of each voxel.

ArgumentTypeRequiredDescription
clusterArrayNameStringYes

setDimensions ​

Set the dimensions of the output image.

ArgumentTypeRequiredDescription
dimensionsVector3Yes

setDimensions ​

Set the dimensions of the output image.

ArgumentTypeRequiredDescription
xNumberYesThe x dimension.
yNumberYesThe y dimension.
zNumberYesThe z dimension.

setDimensionsFrom ​

Set the dimensions of the output image.

ArgumentTypeRequiredDescription
dimensionsVector3Yes

setOrigin ​

Set the origin of the output image.

ArgumentTypeRequiredDescription
originVector3Yes

setOrigin ​

Set the origin of the output image.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

setOriginFrom ​

Set the origin of the output image.

ArgumentTypeRequiredDescription
originVector3Yes

setScalarArrayName ​

Set the name of the output array holding the field value of each voxel.

ArgumentTypeRequiredDescription
scalarArrayNameStringYes

setSpacing ​

Set the spacing of the output image.

ArgumentTypeRequiredDescription
spacingVector3Yes

setSpacing ​

Set the spacing of the output image.

ArgumentTypeRequiredDescription
xNumberYesThe x spacing.
yNumberYesThe y spacing.
zNumberYesThe z spacing.

setSpacingFrom ​

Set the spacing of the output image.

ArgumentTypeRequiredDescription
spacingVector3Yes

updateCluster ​

Replace the definition of the cluster with the given id, creating it when it does not exist yet.

ArgumentTypeRequiredDescription
idNumberYes
centerXNumberYes
centerYNumberYes
centerZNumberYes
fnConstNumberYes
fnDfDxNumberYes
fnDfDyNumberYes
fnDfDzNumberYes