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
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.
| Argument | Type | Required | Description |
|---|---|---|---|
centerX | Number | Yes | |
centerY | Number | Yes | |
centerZ | Number | Yes | |
fnConst | Number | Yes | |
fnDfDx | Number | Yes | |
fnDfDy | Number | Yes | |
fnDfDz | Number | Yes |
Returns
| Type | Description |
|---|---|
| the id of the newly created cluster |
extend
Method used to decorate a given object (publicAPI+model) with vtkSLICSource 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 | ISLICSourceInitialValues | No | (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.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | ISLICSourceInitialValues | No | for 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.
| Argument | Type | Required | Description |
|---|---|---|---|
id | Number | Yes |
requestData
Expose methods
| Argument | Type | Required | Description |
|---|---|---|---|
inData | Yes | ||
outData | Yes |
setClusterArrayName
Set the name of the output array holding the cluster index of each voxel.
| Argument | Type | Required | Description |
|---|---|---|---|
clusterArrayName | String | Yes |
setDimensions
Set the dimensions of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
dimensions | Vector3 | Yes |
setDimensions
Set the dimensions of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The x dimension. |
y | Number | Yes | The y dimension. |
z | Number | Yes | The z dimension. |
setDimensionsFrom
Set the dimensions of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
dimensions | Vector3 | Yes |
setOrigin
Set the origin of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
origin | Vector3 | Yes |
setOrigin
Set the origin of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The x coordinate. |
y | Number | Yes | The y coordinate. |
z | Number | Yes | The z coordinate. |
setOriginFrom
Set the origin of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
origin | Vector3 | Yes |
setScalarArrayName
Set the name of the output array holding the field value of each voxel.
| Argument | Type | Required | Description |
|---|---|---|---|
scalarArrayName | String | Yes |
setSpacing
Set the spacing of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
spacing | Vector3 | Yes |
setSpacing
Set the spacing of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The x spacing. |
y | Number | Yes | The y spacing. |
z | Number | Yes | The z spacing. |
setSpacingFrom
Set the spacing of the output image.
| Argument | Type | Required | Description |
|---|---|---|---|
spacing | Vector3 | Yes |
updateCluster
Replace the definition of the cluster with the given id, creating it when it does not exist yet.
| Argument | Type | Required | Description |
|---|---|---|---|
id | Number | Yes | |
centerX | Number | Yes | |
centerY | Number | Yes | |
centerZ | Number | Yes | |
fnConst | Number | Yes | |
fnDfDx | Number | Yes | |
fnDfDy | Number | Yes | |
fnDfDz | Number | Yes |