Function: sampleVoxelsInShape()
sampleVoxelsInShape(
options):VoxelSample[]
Reads the value of every voxel an area annotation contains, per Rule M of https://github.com/cornerstonejs/cornerstone3D/issues/2889
This is the whole of the accumulation half of a measurement, and it is
identical for every area annotation: only the shape handed in as
getShapeRuns differs between a polyline, an ellipse and a rectangle. Nothing
here reads a viewport, so the same annotation over the same volume samples
the same voxels at any zoom, pan, canvas size or slab thickness, and in any
orientation.
The caller resolves the thickness, as the example below does. A planar shape
reports a required thickness of 0, so the || keeps the annotation's own
thickness. A shape that carries depth of its own, such as an ellipsoid,
reports that depth and the || takes it instead. The bounds the caller
passes must allow for the same value.
const shape = createPolylineShape({ volume, viewPlaneNormal, polyline });
const samples = sampleVoxelsInShape({
volume,
planePoint,
viewPlaneNormal,
referencePlaneThickness:
shape.getRequiredThickness() || referencePlaneThickness,
getShapeRuns: shape.getRuns,
voxelManager,
onSample: statsCallback,
storePointData,
});
Parameters
• options: VoxelsInShapeSamplingOptions
Returns
the samples when storePointData is set, otherwise an empty array.
onSample is called either way.
Defined in
packages/core/src/utilities/voxelSlab/sampleVoxelsInShape.ts:73