Create area of interest for VoxelLayer

This sample shows how to add and change a VoxelSlice on a VoxelLayer.

Slices clip the volume along an infinite plane to yield a convex shell that is rendered. This can be used to define an area of interest or explore an opaque volume interactively. You can slice a volume vertically or horizontally or apply a tilt to the slice and reduce the voxel layer to a specific size.

The VoxelSlice allows you to define the properties of an individual slice. A VoxelSlice can be added by defining the point, orientation and tilt. The point is a position on the slice plane specified as [x, y, z] in voxel space for both XYZ and XYZT volumes, and as [x, y, t] for XYT volumes. Properties of the voxel space is defined in VoxelVolume. sizeInVoxels contains the volume size in voxels and volumeType returns the type of the current variable's volume.

Use dark colors for code blocksCopy
1
2
3
const vxlVolume = vxlLayer.getVolume(null);
const volSize = vxlVolume.sizeInVoxels;
const volType = vxlVolume.volumeType;

A horizontal slice through the middle of the volume can be defined with a tilt and orientation of zero:

Use dark colors for code blocksCopy
1
2
3
4
5
const zValue = Math.floor(volSize[2] / 2);
let zSlice = new VoxelSlice({
    "orientation": 0,
    "tilt": 0,
    "point": [0, 0, zValue]});

Slicing from north to south has a tilt of 90 and orientation of zero:

Use dark colors for code blocksCopy
1
2
3
4
5
6
const yValue = Math.floor(volSize[1] / 2);
let ySlice = new VoxelSlice({
  "orientation":0,
  "tilt": 90,
  "point": [volSize[0], yValue, volSize[1]]
});

Point, orientation and tilt can be modified with real-time rendering updates.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.