@kitware/vtk.js 23.4.3 → 23.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Core/Math/Constants.js +12 -0
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
- package/Common/DataModel/AbstractPointLocator.js +40 -0
- package/Common/DataModel/BoundingBox.d.ts +659 -0
- package/Common/DataModel/Collection.d.ts +118 -0
- package/Common/DataModel/Collection.js +113 -0
- package/Common/DataModel/DataSet/Constants.d.ts +27 -0
- package/Common/DataModel/EdgeLocator.d.ts +79 -0
- package/Common/DataModel/EdgeLocator.js +85 -0
- package/Common/DataModel/ITKHelper.d.ts +54 -0
- package/Common/DataModel/IncrementalOctreeNode.d.ts +297 -0
- package/Common/DataModel/IncrementalOctreeNode.js +640 -0
- package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
- package/Common/DataModel/IncrementalOctreePointLocator.js +398 -0
- package/Common/DataModel/Locator.d.ts +43 -0
- package/Common/DataModel/Locator.js +37 -0
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +77 -0
- package/Common/DataModel/Polygon/Constants.js +12 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Quad/Constants.js +9 -0
- package/Common/DataModel/Quad.d.ts +91 -0
- package/Common/DataModel/Quad.js +235 -0
- package/Common/DataModel/SelectionNode/Constants.d.ts +27 -0
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/Transform/Transform.js +51 -0
- package/Filters/Core/PolyDataNormals.js +124 -0
- package/Filters/General/ClipClosedSurface/Constants.js +10 -0
- package/Filters/General/ClipClosedSurface.d.ts +95 -0
- package/Filters/General/ClipClosedSurface.js +972 -0
- package/Filters/General/ContourTriangulator/Constants.js +6 -0
- package/Filters/General/ContourTriangulator/helper.js +1951 -0
- package/Filters/General/ContourTriangulator.d.ts +136 -0
- package/Filters/General/ContourTriangulator.js +202 -0
- package/Filters/General/ImageMarchingCubes.js +1 -1
- package/Filters/General/MoleculeToRepresentation.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1243 -0
- package/Filters/General/TubeFilter.js +1 -1
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
- package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
- package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
- package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
- package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
- package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
- package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
- package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
- package/Interaction/Style/InteractorStyleManipulator.d.ts +348 -0
- package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +1 -1
- package/Interaction/Widgets/LabelRepresentation.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -1
- package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
- package/Proxy/Core/LookupTableProxy.d.ts +45 -0
- package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
- package/Proxy/Core/ProxyManager.d.ts +115 -0
- package/Proxy/Core/SourceProxy.d.ts +22 -0
- package/Proxy/Core/View2DProxy.d.ts +7 -0
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Proxy/Core/ViewProxy.d.ts +86 -0
- package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
- package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
- package/README.md +2 -2
- package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
- package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
- package/Rendering/Core/AbstractImageMapper.js +44 -0
- package/Rendering/Core/Camera.js +1 -1
- package/Rendering/Core/CellPicker.js +1 -1
- package/Rendering/Core/ColorTransferFunction/ColorMaps.d.ts +24 -0
- package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/HardwareSelector.d.ts +84 -0
- package/Rendering/Core/ImageArrayMapper.d.ts +253 -0
- package/Rendering/Core/ImageArrayMapper.js +242 -0
- package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
- package/Rendering/Core/ImageResliceMapper/Constants.d.ts +11 -0
- package/Rendering/Core/ImageResliceMapper/Constants.js +11 -0
- package/Rendering/Core/ImageResliceMapper.d.ts +245 -0
- package/Rendering/Core/ImageResliceMapper.js +70 -0
- package/Rendering/Core/InteractorObserver.d.ts +132 -0
- package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
- package/Rendering/Core/InteractorStyle.d.ts +229 -0
- package/Rendering/Core/Light.js +1 -1
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Picker.js +1 -1
- package/Rendering/Core/Prop/Constants.d.ts +9 -0
- package/Rendering/Core/Prop/Constants.js +9 -0
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property2D/Constants.d.ts +9 -0
- package/Rendering/Core/RenderWindow.js +1 -1
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/VolumeMapper/Constants.d.ts +20 -0
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +129 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +131 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +763 -0
- package/Rendering/OpenGL/HardwareSelector/Constants.d.ts +8 -0
- package/Rendering/OpenGL/HardwareSelector.d.ts +339 -0
- package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
- package/Rendering/OpenGL/PolyDataMapper.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/RenderWindow/Constants.d.ts +10 -0
- package/Rendering/OpenGL/RenderWindow/Constants.js +13 -0
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +70 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
- package/Rendering/WebGPU/Actor2D.js +151 -0
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +853 -0
- package/Rendering/WebGPU/IndexBuffer.js +397 -0
- package/Rendering/WebGPU/PolyDataMapper2D.js +99 -0
- package/Rendering/WebGPU/SimpleMapper.js +290 -0
- package/Widgets/Core/AbstractWidget.d.ts +187 -0
- package/Widgets/Core/AbstractWidgetFactory.d.ts +131 -0
- package/Widgets/Core/StateBuilder/color3Mixin.js +24 -0
- package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
- package/Widgets/Core/StateBuilder.d.ts +29 -0
- package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
- package/Widgets/Core/WidgetManager.d.ts +231 -0
- package/Widgets/Core/WidgetState.d.ts +81 -0
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Manipulators/TrackballManipulator.js +1 -1
- package/Widgets/Representations/GlyphRepresentation.js +325 -0
- package/Widgets/Representations/LineHandleRepresentation.js +116 -0
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
- package/Widgets/Widgets3D/LabelWidget/behavior.js +157 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +78 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/index.d.ts +133 -74
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
|
+
import vtkCameraSynchronizer from './BehaviorManager/CameraSynchronizer.js';
|
|
4
|
+
|
|
5
|
+
var BEHAVIORS = {};
|
|
6
|
+
|
|
7
|
+
var CameraSync = /*#__PURE__*/function () {
|
|
8
|
+
function CameraSync(ctx, config) {
|
|
9
|
+
_classCallCheck(this, CameraSync);
|
|
10
|
+
|
|
11
|
+
this.ctx = ctx;
|
|
12
|
+
this.behavior = vtkCameraSynchronizer.newInstance(this.getProperties(config));
|
|
13
|
+
this.behavior.update();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_createClass(CameraSync, [{
|
|
17
|
+
key: "getProperties",
|
|
18
|
+
value: function getProperties(_ref) {
|
|
19
|
+
var actorBounds = _ref.actorBounds,
|
|
20
|
+
srcRenderer = _ref.srcRenderer,
|
|
21
|
+
dstRenderer = _ref.dstRenderer;
|
|
22
|
+
var distance = 3.4 * Math.max(actorBounds[1] - actorBounds[0], actorBounds[3] - actorBounds[2], actorBounds[5] - actorBounds[4]);
|
|
23
|
+
var focalPoint = [0.5 * (actorBounds[0] + actorBounds[1]), 0.5 * (actorBounds[2] + actorBounds[3]), 0.5 * (actorBounds[4] + actorBounds[5])];
|
|
24
|
+
var mode = vtkCameraSynchronizer.SynchronizationMode.MODE_ORIENTATION;
|
|
25
|
+
return {
|
|
26
|
+
distance: distance,
|
|
27
|
+
focalPoint: focalPoint,
|
|
28
|
+
mode: mode,
|
|
29
|
+
srcRenderer: this.ctx.getInstance(srcRenderer),
|
|
30
|
+
dstRenderer: this.ctx.getInstance(dstRenderer)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "update",
|
|
35
|
+
value: function update(config) {
|
|
36
|
+
this.behavior.set(this.getProperties(config));
|
|
37
|
+
this.behavior.update();
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "delete",
|
|
41
|
+
value: function _delete() {
|
|
42
|
+
this.behavior.delete();
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
45
|
+
|
|
46
|
+
return CameraSync;
|
|
47
|
+
}();
|
|
48
|
+
|
|
49
|
+
var BEHAVIORS_TYPES = {
|
|
50
|
+
CameraSync: CameraSync
|
|
51
|
+
};
|
|
52
|
+
function applyBehaviors(renderWindow, state, context) {
|
|
53
|
+
if (!state.behaviors || !renderWindow.getSynchronizedViewId) {
|
|
54
|
+
return;
|
|
55
|
+
} // Apply auto behavior
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var rwId = renderWindow.getSynchronizedViewId();
|
|
59
|
+
|
|
60
|
+
if (!BEHAVIORS[rwId]) {
|
|
61
|
+
BEHAVIORS[rwId] = {};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var localBehaviors = BEHAVIORS[rwId];
|
|
65
|
+
|
|
66
|
+
if (state.behaviors.autoOrientation) {
|
|
67
|
+
var renderers = renderWindow.getRenderers();
|
|
68
|
+
|
|
69
|
+
if (!localBehaviors.autoOrientationAxes && renderers.length === 2) {
|
|
70
|
+
var srcRenderer = null;
|
|
71
|
+
var dstRenderer = null;
|
|
72
|
+
|
|
73
|
+
for (var i = 0; i < renderers.length; i++) {
|
|
74
|
+
var renderer = renderers[i];
|
|
75
|
+
|
|
76
|
+
if (renderer.getInteractive()) {
|
|
77
|
+
srcRenderer = renderer;
|
|
78
|
+
} else {
|
|
79
|
+
dstRenderer = renderer;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (srcRenderer && dstRenderer) {
|
|
84
|
+
localBehaviors.autoOrientationAxes = vtkCameraSynchronizer.newInstance({
|
|
85
|
+
srcRenderer: srcRenderer,
|
|
86
|
+
dstRenderer: dstRenderer
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (localBehaviors.autoOrientationAxes && renderers.length !== 2) {
|
|
92
|
+
localBehaviors.autoOrientationAxes.delete();
|
|
93
|
+
delete localBehaviors.autoOrientationAxes;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var currentSets = Object.keys(state.behaviors);
|
|
98
|
+
var existingSets = Object.keys(localBehaviors);
|
|
99
|
+
|
|
100
|
+
for (var _i = 0; _i < currentSets.length; _i++) {
|
|
101
|
+
var key = currentSets[_i];
|
|
102
|
+
|
|
103
|
+
if (!localBehaviors[key]) {
|
|
104
|
+
var config = state.behaviors[key];
|
|
105
|
+
|
|
106
|
+
if (BEHAVIORS_TYPES[config.type]) {
|
|
107
|
+
localBehaviors[key] = new BEHAVIORS_TYPES[config.type](context, config);
|
|
108
|
+
} else {
|
|
109
|
+
console.log('No mapping for', config);
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
localBehaviors[key].update(state.behaviors[key]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (var _i2 = 0; _i2 < existingSets.length; _i2++) {
|
|
117
|
+
var _key = currentSets[_i2];
|
|
118
|
+
|
|
119
|
+
if (!state.behaviors[_key]) {
|
|
120
|
+
// Need to delete previously created behavior
|
|
121
|
+
localBehaviors[_key].delete();
|
|
122
|
+
|
|
123
|
+
delete localBehaviors[_key];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
var BehaviorManager = {
|
|
128
|
+
applyBehaviors: applyBehaviors
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { applyBehaviors, BehaviorManager as default };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { vtkObject } from './../../../interfaces' ;
|
|
2
|
+
import { Nullable } from './../../../types' ;
|
|
3
|
+
import { ISynchronizerContext, IViewState } from "..";
|
|
4
|
+
|
|
5
|
+
export type BuilderFunction = <T extends vtkObject>(type: string, initialProps?: Record<string, unknown>) => Nullable<T>;
|
|
6
|
+
export type UpdaterFunction = (instance: vtkObject, state: IViewState, context: ISynchronizerContext) => void;
|
|
7
|
+
|
|
8
|
+
export interface IObjectManager {
|
|
9
|
+
/**
|
|
10
|
+
* Build a vtkObject.
|
|
11
|
+
*/
|
|
12
|
+
build: BuilderFunction;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {String} type The type to update
|
|
16
|
+
* @param {vtkObject} instance The specific instance
|
|
17
|
+
* @param {IViewState} props
|
|
18
|
+
* @param {ISynchronizerContext} context
|
|
19
|
+
*/
|
|
20
|
+
update(type: string, instance: vtkObject, props: IViewState, context: ISynchronizerContext): Promise<Error | void>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Defines a new type handler with the specified builder and updater functions
|
|
24
|
+
*
|
|
25
|
+
* @param {String} type The type you wish to register
|
|
26
|
+
* @param {BuilderFunction} [buildFn] The builder function to associate with the type
|
|
27
|
+
* @param {UpdaterFunction} [updateFn] The updater function to associate with the type
|
|
28
|
+
*/
|
|
29
|
+
setTypeMapping(type: string, buildFn?: BuilderFunction, updateFn?: UpdaterFunction): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Clear all type mappings
|
|
33
|
+
*/
|
|
34
|
+
clearTypeMapping(): void;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get a list of all supported types
|
|
38
|
+
*
|
|
39
|
+
* @returns {string[]}
|
|
40
|
+
*/
|
|
41
|
+
getSupportedTypes(): string[];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Clear all one time updaters
|
|
45
|
+
*/
|
|
46
|
+
clearOneTimeUpdaters(): void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Update the associated render window
|
|
50
|
+
*/
|
|
51
|
+
updateRenderWindow(): void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Register a new type to exclude
|
|
55
|
+
*
|
|
56
|
+
* @param {string} type The type to exclude
|
|
57
|
+
* @param {string} propertyName The property name to exclude
|
|
58
|
+
* @param {unknown} propertyValue The property value to exclude
|
|
59
|
+
*/
|
|
60
|
+
excludeInstance(type: string, propertyName: string, propertyValue: unknown): void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Set the default types mapping
|
|
64
|
+
*
|
|
65
|
+
* @param {boolean} [reset] Clear all existing type mappings, defaults to true
|
|
66
|
+
*/
|
|
67
|
+
setDefaultMapping(reset?: boolean): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Apply the default aliases
|
|
71
|
+
*/
|
|
72
|
+
applyDefaultAliases(): void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Always update the camera
|
|
76
|
+
*/
|
|
77
|
+
alwaysUpdateCamera(): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default IObjectManager;
|