All files / packages/core/src/utilities getVolumeActorCorners.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                    265x 265x   265x                      
import { Point3 } from '../types';
 
/**
 * Converts `vtkVolumeActor` bounds to corners in world space.
 *
 * @param volumeActor - The `vtkVolumeActor`.
 *
 * @returns An array of the corners of the `volumeActor` in world space.
 */
export default function getVolumeActorCorners(volumeActor): Array<Point3> {
  const imageData = volumeActor.getMapper().getInputData();
  const bounds = imageData.extentToBounds(imageData.getExtent());
 
  return [
    [bounds[0], bounds[2], bounds[4]],
    [bounds[0], bounds[2], bounds[5]],
    [bounds[0], bounds[3], bounds[4]],
    [bounds[0], bounds[3], bounds[5]],
    [bounds[1], bounds[2], bounds[4]],
    [bounds[1], bounds[2], bounds[5]],
    [bounds[1], bounds[3], bounds[4]],
    [bounds[1], bounds[3], bounds[5]],
  ];
}