Skip to main content

Function: sampleVolumeGrid()

sampleVolumeGrid(options): SampledValueRange

Samples a volume on a regular grid of points and writes one value per grid point into pixelData. The grid is given in continuous voxel indices: a first point, a step along a row and a step from one row to the next. A grid in a plane gives one slice image of the volume, in any orientation.

A grid point counts as inside the volume while it lies on a voxel, which reaches half a voxel beyond the center of the outermost voxels. The index of such a point is first moved onto the range of the voxel centers, so a linear sample near the border repeats the outermost voxel.

Voxels are read straight from the typed array of a slice where there is one, and through the voxel manager of the volume for any other slice. Both ways give the same values.

Each row is split into runs of columns. The columns that lie well inside the volume are sampled in a loop without checks. The columns that are well outside get the outside value. Only the few columns near the border of the volume go through sampleCheckedPoint.

Parameters​

• options: SampleVolumeGridOptions

Returns​

SampledValueRange

The lowest and the highest value written.

Defined in​

packages/core/src/utilities/sampleVolumeGrid.ts:310