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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | import type vtkRenderer from '@kitware/vtk.js/Rendering/Core/Renderer';
import type { ICamera, Point2, Point3 } from '../../../types';
import {
canvasToWorldContextPool,
worldToCanvasContextPool,
} from '../../helpers/vtkCanvasCoordinateTransforms';
import ResolvedViewportView from '../ResolvedViewportView';
import type { Volume3DCamera } from './viewport3DTypes';
type Volume3DResolvedViewState = {
camera: Volume3DCamera & ICamera;
canvas: HTMLCanvasElement;
frameOfReferenceUID?: string;
renderer: vtkRenderer;
};
class Volume3DResolvedView extends ResolvedViewportView<Volume3DResolvedViewState> {
canvasToWorld(canvasPos: Point2): Point3 {
return canvasToWorldContextPool({
canvas: this.state.canvas,
canvasPos,
renderer: this.state.renderer,
});
}
worldToCanvas(worldPos: Point3): Point2 {
return worldToCanvasContextPool({
canvas: this.state.canvas,
renderer: this.state.renderer,
worldPos,
});
}
getFrameOfReferenceUID(): string | undefined {
return this.state.frameOfReferenceUID;
}
protected buildICamera(): ICamera {
return {
...this.state.camera,
clippingRange: this.state.camera.clippingRange
? [...this.state.camera.clippingRange]
: this.state.camera.clippingRange,
focalPoint: this.state.camera.focalPoint
? [...this.state.camera.focalPoint]
: this.state.camera.focalPoint,
position: this.state.camera.position
? [...this.state.camera.position]
: this.state.camera.position,
viewPlaneNormal: this.state.camera.viewPlaneNormal
? [...this.state.camera.viewPlaneNormal]
: this.state.camera.viewPlaneNormal,
viewUp: this.state.camera.viewUp
? [...this.state.camera.viewUp]
: this.state.camera.viewUp,
};
}
}
export type { Volume3DResolvedViewState };
export default Volume3DResolvedView;
|