@kitware/vtk.js 23.4.2 → 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.
Files changed (180) hide show
  1. package/Common/Core/Math/Constants.js +12 -0
  2. package/Common/Core/Math/index.js +1 -1
  3. package/Common/Core/Math.js +1 -1
  4. package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
  5. package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
  6. package/Common/DataModel/AbstractPointLocator.js +40 -0
  7. package/Common/DataModel/BoundingBox.d.ts +659 -0
  8. package/Common/DataModel/Collection.d.ts +118 -0
  9. package/Common/DataModel/Collection.js +113 -0
  10. package/Common/DataModel/DataSet/Constants.d.ts +27 -0
  11. package/Common/DataModel/EdgeLocator.d.ts +79 -0
  12. package/Common/DataModel/EdgeLocator.js +85 -0
  13. package/Common/DataModel/ITKHelper.d.ts +54 -0
  14. package/Common/DataModel/IncrementalOctreeNode.d.ts +297 -0
  15. package/Common/DataModel/IncrementalOctreeNode.js +640 -0
  16. package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
  17. package/Common/DataModel/IncrementalOctreePointLocator.js +398 -0
  18. package/Common/DataModel/Locator.d.ts +43 -0
  19. package/Common/DataModel/Locator.js +37 -0
  20. package/Common/DataModel/Plane.js +1 -1
  21. package/Common/DataModel/PolyData/Constants.d.ts +6 -0
  22. package/Common/DataModel/PolyLine.d.ts +63 -0
  23. package/Common/DataModel/PolyLine.js +77 -0
  24. package/Common/DataModel/Polygon/Constants.js +12 -0
  25. package/Common/DataModel/Polygon.js +1 -1
  26. package/Common/DataModel/Quad/Constants.js +9 -0
  27. package/Common/DataModel/Quad.d.ts +91 -0
  28. package/Common/DataModel/Quad.js +235 -0
  29. package/Common/DataModel/SelectionNode/Constants.d.ts +27 -0
  30. package/Common/DataModel/Spline1D/Constants.js +17 -0
  31. package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
  32. package/Common/Transform/Transform.js +51 -0
  33. package/Filters/Core/PolyDataNormals.js +124 -0
  34. package/Filters/General/ClipClosedSurface/Constants.js +10 -0
  35. package/Filters/General/ClipClosedSurface.d.ts +95 -0
  36. package/Filters/General/ClipClosedSurface.js +972 -0
  37. package/Filters/General/ContourTriangulator/Constants.js +6 -0
  38. package/Filters/General/ContourTriangulator/helper.js +1951 -0
  39. package/Filters/General/ContourTriangulator.d.ts +136 -0
  40. package/Filters/General/ContourTriangulator.js +202 -0
  41. package/Filters/General/ImageMarchingCubes.js +1 -1
  42. package/Filters/General/MoleculeToRepresentation.js +1 -1
  43. package/Filters/General/OBBTree/OBBNode.js +82 -0
  44. package/Filters/General/OBBTree/helper.js +92 -0
  45. package/Filters/General/OBBTree.js +1243 -0
  46. package/Filters/General/TubeFilter.js +1 -1
  47. package/Filters/Sources/LineSource.js +1 -1
  48. package/Filters/Sources/PlaneSource.js +1 -1
  49. package/Filters/Texture/TextureMapToPlane.js +1 -1
  50. package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
  51. package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
  52. package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
  53. package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
  54. package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
  55. package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
  56. package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
  57. package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
  58. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
  59. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
  60. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
  61. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
  62. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
  63. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
  64. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
  65. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
  66. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
  67. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
  68. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
  69. package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
  70. package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
  71. package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
  72. package/Interaction/Style/InteractorStyleManipulator.d.ts +348 -0
  73. package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
  74. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +1 -1
  75. package/Interaction/Widgets/LabelRepresentation.js +1 -1
  76. package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
  77. package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +1 -1
  78. package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -1
  79. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -1
  80. package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
  81. package/Proxy/Core/LookupTableProxy.d.ts +45 -0
  82. package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
  83. package/Proxy/Core/ProxyManager.d.ts +115 -0
  84. package/Proxy/Core/SourceProxy.d.ts +22 -0
  85. package/Proxy/Core/View2DProxy.d.ts +7 -0
  86. package/Proxy/Core/View2DProxy.js +1 -1
  87. package/Proxy/Core/ViewProxy.d.ts +86 -0
  88. package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
  89. package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
  90. package/README.md +2 -2
  91. package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
  92. package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
  93. package/Rendering/Core/AbstractImageMapper.js +44 -0
  94. package/Rendering/Core/Camera.js +1 -1
  95. package/Rendering/Core/CellPicker.js +1 -1
  96. package/Rendering/Core/ColorTransferFunction/ColorMaps.d.ts +24 -0
  97. package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
  98. package/Rendering/Core/ColorTransferFunction.js +1 -1
  99. package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
  100. package/Rendering/Core/Coordinate.js +1 -1
  101. package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
  102. package/Rendering/Core/Glyph3DMapper.js +1 -1
  103. package/Rendering/Core/HardwareSelector.d.ts +84 -0
  104. package/Rendering/Core/ImageArrayMapper.d.ts +253 -0
  105. package/Rendering/Core/ImageArrayMapper.js +242 -0
  106. package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
  107. package/Rendering/Core/ImageMapper.js +1 -1
  108. package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
  109. package/Rendering/Core/ImageResliceMapper/Constants.d.ts +11 -0
  110. package/Rendering/Core/ImageResliceMapper/Constants.js +11 -0
  111. package/Rendering/Core/ImageResliceMapper.d.ts +245 -0
  112. package/Rendering/Core/ImageResliceMapper.js +70 -0
  113. package/Rendering/Core/InteractorObserver.d.ts +132 -0
  114. package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
  115. package/Rendering/Core/InteractorStyle.d.ts +229 -0
  116. package/Rendering/Core/Light.js +1 -1
  117. package/Rendering/Core/Mapper/Constants.d.ts +26 -0
  118. package/Rendering/Core/Mapper.js +1 -1
  119. package/Rendering/Core/Picker.js +1 -1
  120. package/Rendering/Core/Prop/Constants.d.ts +9 -0
  121. package/Rendering/Core/Prop/Constants.js +9 -0
  122. package/Rendering/Core/Property/Constants.d.ts +24 -0
  123. package/Rendering/Core/Property2D/Constants.d.ts +9 -0
  124. package/Rendering/Core/RenderWindow.js +1 -1
  125. package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
  126. package/Rendering/Core/Renderer.js +1 -1
  127. package/Rendering/Core/VolumeMapper/Constants.d.ts +20 -0
  128. package/Rendering/Core/VolumeMapper.js +1 -1
  129. package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
  130. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +129 -0
  131. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +131 -0
  132. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
  133. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +763 -0
  134. package/Rendering/OpenGL/HardwareSelector/Constants.d.ts +8 -0
  135. package/Rendering/OpenGL/HardwareSelector.d.ts +339 -0
  136. package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
  137. package/Rendering/OpenGL/PolyDataMapper.js +1 -1
  138. package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
  139. package/Rendering/OpenGL/RenderWindow/Constants.d.ts +10 -0
  140. package/Rendering/OpenGL/RenderWindow/Constants.js +13 -0
  141. package/Rendering/OpenGL/RenderWindow/ContextProxy.js +70 -0
  142. package/Rendering/OpenGL/RenderWindow.d.ts +9 -2
  143. package/Rendering/OpenGL/RenderWindow.js +2 -1
  144. package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
  145. package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
  146. package/Rendering/WebGPU/Actor2D.js +151 -0
  147. package/Rendering/WebGPU/BufferManager.js +1 -1
  148. package/Rendering/WebGPU/CellArrayMapper.js +853 -0
  149. package/Rendering/WebGPU/IndexBuffer.js +397 -0
  150. package/Rendering/WebGPU/PolyDataMapper2D.js +99 -0
  151. package/Rendering/WebGPU/RenderWindow.js +3 -1
  152. package/Rendering/WebGPU/SimpleMapper.js +290 -0
  153. package/Widgets/Core/AbstractWidget.d.ts +187 -0
  154. package/Widgets/Core/AbstractWidgetFactory.d.ts +131 -0
  155. package/Widgets/Core/StateBuilder/color3Mixin.js +24 -0
  156. package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
  157. package/Widgets/Core/StateBuilder.d.ts +29 -0
  158. package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
  159. package/Widgets/Core/WidgetManager.d.ts +231 -0
  160. package/Widgets/Core/WidgetState.d.ts +81 -0
  161. package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
  162. package/Widgets/Manipulators/AbstractManipulator.js +57 -0
  163. package/Widgets/Manipulators/LineManipulator.js +1 -1
  164. package/Widgets/Manipulators/TrackballManipulator.js +1 -1
  165. package/Widgets/Representations/GlyphRepresentation.js +325 -0
  166. package/Widgets/Representations/LineHandleRepresentation.js +116 -0
  167. package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
  168. package/Widgets/Representations/WidgetRepresentation.js +1 -1
  169. package/Widgets/Widgets3D/AngleWidget.js +1 -1
  170. package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
  171. package/Widgets/Widgets3D/LabelWidget/behavior.js +157 -0
  172. package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
  173. package/Widgets/Widgets3D/LabelWidget.js +78 -0
  174. package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
  175. package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
  176. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  177. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  178. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
  179. package/index.d.ts +133 -74
  180. package/package.json +1 -1
@@ -0,0 +1,62 @@
1
+ import vtkLookupTableProxy from './LookupTableProxy';
2
+ import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
3
+ import { VtkProxy } from './../../macros';
4
+
5
+ // [x, r/h, g/s, b/v, m=0.5, s=0.0]
6
+ export interface PiecewiseGaussian {
7
+ position: number;
8
+ height: number;
9
+ width: number;
10
+ xBias: number;
11
+ yBias: number;
12
+ }
13
+
14
+ export interface PiecewiseNode {
15
+ x: number;
16
+ y: number;
17
+ midpoint: number;
18
+ sharpness: number;
19
+ }
20
+
21
+ export enum IPiecewiseFunctionProxyMode {
22
+ Gaussians = 0,
23
+ Points = 1,
24
+ Nodes = 2,
25
+ }
26
+
27
+ export interface IPiecewiseFunctionProxyDefaults {
28
+ Gaussians: PiecewiseGaussian[];
29
+ Points: number[][];
30
+ Nodes: PiecewiseNode[];
31
+ }
32
+
33
+ export interface vtkPiecewiseFunctionProxy extends VtkProxy {
34
+ setGaussians(gaussians: PiecewiseGaussian[]): void;
35
+ getGaussians(): PiecewiseGaussian[];
36
+ setPoints(points: number[][]): void;
37
+ getPoints(): number[][];
38
+ setNodes(nodes: PiecewiseNode[]): void;
39
+ getNodes(): PiecewiseNode[];
40
+ setMode(mode: number): void;
41
+ getMode(): number;
42
+ applyMode(): void;
43
+ getLookupTableProxy(): vtkLookupTableProxy;
44
+ setDataRange(min: number, max: number): void;
45
+ getDataRange(): [number, number];
46
+ getPiecewiseFunction(): vtkPiecewiseFunction;
47
+ }
48
+
49
+ export interface IPiecewiseFunctionProxyInitialValues {
50
+ piecewiseFunction?: vtkPiecewiseFunction;
51
+ }
52
+
53
+ export function newInstance(
54
+ initialValues?: IPiecewiseFunctionProxyInitialValues
55
+ ): vtkPiecewiseFunctionProxy;
56
+
57
+ export declare const vtkPiecewiseFunctionProxy: {
58
+ newInstance: typeof newInstance;
59
+ Mode: typeof IPiecewiseFunctionProxyMode;
60
+ Defaults: IPiecewiseFunctionProxyDefaults;
61
+ };
62
+ export default vtkPiecewiseFunctionProxy;
@@ -0,0 +1,115 @@
1
+ import { vtkObject } from './../../interfaces';
2
+ import vtkSourceProxy from './SourceProxy';
3
+ import vtkViewProxy from './ViewProxy';
4
+ import vtkAbstractRepresentationProxy from './AbstractRepresentationProxy';
5
+ import vtkLookupTableProxy from './LookupTableProxy';
6
+ import vtkPiecewiseFunctionProxy from './PiecewiseFunctionProxy';
7
+ import { VtkProxy } from './../../macros';
8
+
9
+ export type ProxyConfiguration = object;
10
+
11
+ export interface ProxyRegistrationChangeInfo {
12
+ action: 'register' | 'unregister';
13
+ proxyId: string;
14
+ proxyName: string;
15
+ proxyGroup: string;
16
+ proxy: VtkProxy;
17
+ }
18
+
19
+ export interface IProxyManagerInitialValues {
20
+ proxyConfiguration?: ProxyConfiguration;
21
+ }
22
+
23
+ export interface vtkProxyManager extends vtkObject {
24
+ // core //
25
+
26
+ setProxyConfiguration(config: ProxyConfiguration): boolean;
27
+ getProxyConfiguration(): ProxyConfiguration;
28
+
29
+ setActiveSource<T>(sourceProxy: vtkSourceProxy<T>): boolean;
30
+ getActiveSource<T>(): vtkSourceProxy<T>;
31
+
32
+ setActiveView(viewProxy: vtkViewProxy): boolean;
33
+ getActiveView(): vtkViewProxy;
34
+
35
+ onProxyRegistrationChange(
36
+ callback: (changeInfo: ProxyRegistrationChangeInfo) => void
37
+ );
38
+
39
+ getProxyById<T extends VtkProxy>(id: string): T | undefined;
40
+ getProxyGroups(): string[];
41
+ getProxyInGroup(groupName: string): VtkProxy[];
42
+
43
+ getSources(): vtkSourceProxy<any>[];
44
+ getRepresentations(): vtkAbstractRepresentationProxy[];
45
+ getViews(): vtkViewProxy[];
46
+
47
+ createProxy<T extends VtkProxy>(
48
+ group: string,
49
+ name: string,
50
+ options?: Object
51
+ ): T;
52
+
53
+ getRepresentation<T extends vtkAbstractRepresentationProxy>(
54
+ source: vtkSourceProxy<any>,
55
+ view: vtkViewProxy
56
+ ): T | null;
57
+
58
+ deleteProxy(proxy: VtkProxy): void;
59
+
60
+ // view //
61
+
62
+ render(view?: vtkViewProxy): void;
63
+ renderAllViews(): void;
64
+ setAnimationOnAllViews(): void;
65
+ autoAnimateViews(debounceTimeout: number): void;
66
+ resizeAllViews(): void;
67
+ resetCamera(view?: vtkViewProxy): void;
68
+ createRepresentationInAllViews(source: vtkSourceProxy<any>): void;
69
+ resetCameraInAllViews(): void;
70
+
71
+ // properties //
72
+
73
+ // these are specific to the proxy configuration...
74
+ getLookupTable(arrayName: string, options?: any): vtkLookupTableProxy;
75
+ getPiecewiseFunction(
76
+ arrayName: string,
77
+ options?: any
78
+ ): vtkPiecewiseFunctionProxy;
79
+ rescaleTransferFunctionToDataRange(
80
+ arrayName: string,
81
+ dataRange: [number, number]
82
+ ): void;
83
+ }
84
+
85
+ /**
86
+ * Decorates a given publicAPI + model with vtkProxyManager characteristics.
87
+ *
88
+ * @param publicAPI
89
+ * @param model
90
+ * @param {IProxyManagerInitialValues} [initialValues]
91
+ */
92
+ export function extend(
93
+ publicAPI: object,
94
+ model: object,
95
+ initialValues?: IProxyManagerInitialValues
96
+ ): void;
97
+
98
+ /**
99
+ * Creates a vtkProxyManager.
100
+ * @param {IProxyManagerInitialValues} [initialValues]
101
+ */
102
+ export function newInstance(
103
+ initialValues?: IProxyManagerInitialValues
104
+ ): vtkProxyManager;
105
+
106
+ /**
107
+ * vtkProxyManager is the central manager for managing proxy resources
108
+ * in vtk.js.
109
+ */
110
+ export declare const vtkProxyManager: {
111
+ newInstance: typeof newInstance;
112
+ extend: typeof extend;
113
+ };
114
+
115
+ export default vtkProxyManager;
@@ -0,0 +1,22 @@
1
+ import { vtkAlgorithm } from './../../interfaces';
2
+ import { VtkProxy } from './../../macros';
3
+
4
+ export interface vtkSourceProxy<T> extends VtkProxy {
5
+ setInputProxy(source: vtkSourceProxy<T>): void;
6
+ setInputData(dataset: T, type?: string): void;
7
+ setInputAlgorithm(
8
+ algo: vtkAlgorithm,
9
+ type: string,
10
+ autoUpdate: boolean
11
+ ): void;
12
+ update(): void;
13
+
14
+ getName(): string;
15
+ setName(name: string): boolean;
16
+ getType(): string;
17
+ getDataset(): T | null;
18
+ getAlgo(): vtkAlgorithm | null;
19
+ getInputProxy(): vtkSourceProxy<T> | null;
20
+ }
21
+
22
+ export default vtkSourceProxy;
@@ -0,0 +1,7 @@
1
+ import vtkViewProxy from './ViewProxy';
2
+
3
+ export interface vtkView2DProxy extends vtkViewProxy {
4
+ getAxis(): number;
5
+ }
6
+
7
+ export default vtkView2DProxy;
@@ -1,7 +1,7 @@
1
1
  import macro from '../../macros.js';
2
2
  import vtkMouseRangeManipulator from '../../Interaction/Manipulators/MouseRangeManipulator.js';
3
3
  import vtkViewProxy from './ViewProxy.js';
4
- import { j as cross, D as getMajorAxisIndex } from '../../Common/Core/Math/index.js';
4
+ import { k as cross, D as getMajorAxisIndex } from '../../Common/Core/Math/index.js';
5
5
 
6
6
  var DEFAULT_STEP_WIDTH = 512;
7
7
 
@@ -0,0 +1,86 @@
1
+ import vtkActor from './../../Rendering/Core/Actor';
2
+ import vtkAbstractRepresentationProxy from './AbstractRepresentationProxy';
3
+ import { Vector3, Vector4 } from './../../types';
4
+ import vtkCamera from './../../Rendering/Core/Camera';
5
+ import vtkRenderWindowInteractor from './../../Rendering/Core/RenderWindowInteractor';
6
+ import vtkInteractorStyle from './../../Rendering/Core/InteractorStyle';
7
+ import { vtkSubscription, vtkObject } from './../../interfaces';
8
+ import vtkRenderer from './../../Rendering/Core/Renderer';
9
+ import vtkRenderWindow from './../../Rendering/Core/RenderWindow';
10
+ import vtkOpenGLRenderWindow from './../../Rendering/OpenGL/RenderWindow';
11
+ import { VtkProxy } from './../../macros';
12
+
13
+ export interface vtkViewProxy extends VtkProxy {
14
+ setPresetToInteractor3D(nameOrDefinitions: string | Object): boolean;
15
+ setPresetToInteractor2D(nameOrDefinitions: string | Object): boolean;
16
+
17
+ setOrientationAxesType(type: string): void;
18
+ setOrientationAxesVisibility(visible: boolean): boolean;
19
+ registerOrientationAxis(name: string, actor: vtkActor): void;
20
+ unregisterOrientationAxis(name: string): void;
21
+ listOrientationAxis(): string[];
22
+ setPresetToOrientationAxes(nameOrDefinitions: string | Object): boolean;
23
+
24
+ setContainer(container: HTMLElement | null): void;
25
+ resize(): void;
26
+ renderLater(): void;
27
+ render(blocking?: boolean): void;
28
+ resetCamera(): void;
29
+
30
+ addRepresentation(representation: vtkAbstractRepresentationProxy): void;
31
+ removeRepresentation(representation: vtkAbstractRepresentationProxy): void;
32
+
33
+ // TODO correct?
34
+ captureImage(opts: { format: string } & Object): Array<Promise<string>>;
35
+ openCaptureImage(target: string): void;
36
+
37
+ // TODO corner annotations
38
+
39
+ setBackground(color: Vector3 | Vector4): void;
40
+ getBackground(): Vector3 | Vector4;
41
+
42
+ setAnimation(enable: boolean, requester?: vtkObject);
43
+
44
+ updateOrientation(
45
+ axisIndex: 0 | 1 | 2,
46
+ orientation: -1 | 1,
47
+ viewUp: Vector3,
48
+ animateSteps: number
49
+ ): Promise<void>;
50
+ moveCamera(
51
+ focalPoint: Vector3,
52
+ position: Vector3,
53
+ viewUp: Vector3,
54
+ animateSteps: number
55
+ ): Promise<void>;
56
+
57
+ resetOrientation(animateSteps: number): void;
58
+ rotate(angle): void;
59
+
60
+ focusTo(focalPoint: Vector3): void;
61
+
62
+ getCamera(): vtkCamera;
63
+ // getAnnotationOpacity
64
+ getContainer(): HTMLElement | null;
65
+ // getCornerAnnotation
66
+ getInteractor(): vtkRenderWindowInteractor;
67
+ getInteractorStyle2D(): vtkInteractorStyle;
68
+ getInteractorStyle3D(): vtkInteractorStyle;
69
+ getOpenGLRenderWindow(): vtkOpenGLRenderWindow;
70
+ getOrientationAxesType(): string;
71
+ getPresetToOrientationAxes(): any;
72
+ getRenderer(): vtkRenderer;
73
+ getRenderWindow(): vtkRenderWindow;
74
+ getRepresentations(): vtkAbstractRepresentationProxy[];
75
+ getUseParallelRendering(): boolean;
76
+ getDisableAnimation(): boolean;
77
+ setDisableAnimation(disabled: boolean): boolean;
78
+
79
+ onResize(
80
+ cb: (size: { width: number; height: number }) => void
81
+ ): vtkSubscription;
82
+
83
+ // TODO proxy property mappings
84
+ }
85
+
86
+ export default vtkViewProxy;
@@ -0,0 +1,27 @@
1
+ import vtkAbstractRepresentationProxy from './../Core/AbstractRepresentationProxy';
2
+
3
+ export interface vtkSliceRepresentationProxy
4
+ extends vtkAbstractRepresentationProxy {
5
+ /**
6
+ * @param mode XYZIJK
7
+ */
8
+ setSlicingMode(mode: string): boolean;
9
+ getSlicingMode(): string;
10
+ getSliceIndex(): number;
11
+ getAnnotations(): any;
12
+
13
+ // proxy property mappings
14
+
15
+ setVisibility(visible: boolean): boolean;
16
+ getVisibility(): boolean;
17
+ setWindowWidth(width: number): boolean;
18
+ getWindowWidth(): number;
19
+ setWindowLevel(level: number): boolean;
20
+ getWindowLevel(): number;
21
+ setInterpolationType(type: number): boolean;
22
+ getInterpolationType(): number;
23
+ setSlice(type: number): boolean;
24
+ getSlice(): number;
25
+ }
26
+
27
+ export default vtkSliceRepresentationProxy;
@@ -0,0 +1,44 @@
1
+ import vtkAbstractRepresentationProxy from './../Core/AbstractRepresentationProxy';
2
+ import vtkImageCropFilter from './../../Filters/General/ImageCropFilter';
3
+
4
+ export interface vtkVolumeRepresentationProxy
5
+ extends vtkAbstractRepresentationProxy {
6
+ setIs2DVolume(is2D: boolean): void;
7
+ getIs2DVolume(): boolean;
8
+ isVisible(): boolean;
9
+ setVisibility(visible: boolean): void;
10
+ getVisibility(): boolean;
11
+ setSliceVisibility(isVisible: boolean): void;
12
+ getSliceVisibility(): boolean;
13
+ setSampleDistance(samp: number): void;
14
+ getSampleDistance(): number;
15
+ setEdgeGradient(grad: number): void;
16
+ getEdgeGradient(): number;
17
+ getCropFilter(): vtkImageCropFilter;
18
+
19
+ // proxy property mappings
20
+ getXSlice(): number;
21
+ setXSlice(slice: number): boolean;
22
+ getYSlice(): number;
23
+ setYSlice(slice: number): boolean;
24
+ getZSlice(): number;
25
+ setZSlice(slice: number): boolean;
26
+ getVolumeVisibility(): boolean;
27
+ setVolumeVisibility(visible: boolean): boolean;
28
+ getXSliceVisibility(): boolean;
29
+ setXSliceVisibility(visible: boolean): boolean;
30
+ getYSliceVisibility(): boolean;
31
+ setYSliceVisibility(visible: boolean): boolean;
32
+ getZSliceVisibility(): boolean;
33
+ setZSliceVisibility(visible: boolean): boolean;
34
+ getWindowWidth(): number;
35
+ setWindowWidth(width: number): boolean;
36
+ getWindowLevel(): number;
37
+ setWindowLevel(level: number): boolean;
38
+ getUseShadow(): boolean;
39
+ setUseShadow(useShadow: boolean): boolean;
40
+ getCroppingPlanes(): number[];
41
+ setCroppingPlanes(planes: number[]): boolean;
42
+ }
43
+
44
+ export default vtkVolumeRepresentationProxy;
package/README.md CHANGED
@@ -48,8 +48,8 @@ In general VTK tries to be as portable as possible; the specific configurations
48
48
 
49
49
  vtk.js supports the following development environments:
50
50
 
51
- - Node 12+
52
- - NPM 6+
51
+ - Node 14+
52
+ - NPM 7+
53
53
 
54
54
  and we use [@babel/preset-env](https://www.npmjs.com/package/@babel/preset-env) with the [defaults](https://github.com/Kitware/vtk-js/blob/master/.browserslistrc) set of [browsers target](https://browserl.ist/?q=defaults).
55
55
  But when built from source this could be adjusted to support any browser as long they provide WebGL.
@@ -0,0 +1,127 @@
1
+ import { vec3 } from 'gl-matrix';
2
+ import vtkPlane from '../../../Common/DataModel/Plane.js';
3
+
4
+ /**
5
+ * Perform plane-line intersection, where the line is defined by two points (p1, p2),
6
+ * and the plane is defined by the imageData and slice number.
7
+ *
8
+ * @param {Vector3} p1
9
+ * @param {Vector3} p2
10
+ * @param {vtkImageMapper|vtkImageArrayMapper} mapper
11
+ */
12
+
13
+ function doPicking(p1, p2, mapper) {
14
+ var imageData = mapper.getCurrentImage();
15
+ var extent = imageData.getExtent(); // Slice origin
16
+
17
+ var ijk = [extent[0], extent[2], extent[4]];
18
+
19
+ var _mapper$getClosestIJK = mapper.getClosestIJKAxis(),
20
+ ijkMode = _mapper$getClosestIJK.ijkMode;
21
+
22
+ var nSlice = mapper.isA('vtkImageArrayMapper') ? mapper.getSubSlice() : mapper.getSlice();
23
+
24
+ if (ijkMode !== mapper.getSlicingMode()) {
25
+ // If not IJK slicing, get the IJK slice from the XYZ position/slice
26
+ nSlice = mapper.getSliceAtPosition(nSlice);
27
+ }
28
+
29
+ ijk[ijkMode] += nSlice;
30
+ var worldOrigin = [0, 0, 0];
31
+ imageData.indexToWorld(ijk, worldOrigin); // Normal computation
32
+
33
+ ijk[ijkMode] += 1;
34
+ var worldNormal = [0, 0, 0];
35
+ imageData.indexToWorld(ijk, worldNormal);
36
+ worldNormal[0] -= worldOrigin[0];
37
+ worldNormal[1] -= worldOrigin[1];
38
+ worldNormal[2] -= worldOrigin[2];
39
+ vec3.normalize(worldNormal, worldNormal);
40
+ var intersect = vtkPlane.intersectWithLine(p1, p2, worldOrigin, worldNormal);
41
+
42
+ if (intersect.intersection) {
43
+ var point = intersect.x;
44
+ var absoluteIJK = [0, 0, 0];
45
+ imageData.worldToIndex(point, absoluteIJK); // `t` is the parametric position along the line
46
+ // defined in Plane.intersectWithLine
47
+
48
+ return {
49
+ t: intersect.t,
50
+ absoluteIJK: absoluteIJK
51
+ };
52
+ }
53
+
54
+ return null;
55
+ }
56
+ /**
57
+ * Implement point picking for image plane.
58
+ * The plane is defined by the imageData and current slice number,
59
+ * set in the input mapper.
60
+ *
61
+ * @param {Vector3} p1
62
+ * @param {Vector3} p2
63
+ * @param {vtkImageMapper|vtkImageArrayMapper} mapper
64
+ */
65
+
66
+
67
+ function intersectWithLineForPointPicking(p1, p2, mapper) {
68
+ var pickingData = doPicking(p1, p2, mapper);
69
+
70
+ if (pickingData) {
71
+ var imageData = mapper.getCurrentImage();
72
+ var extent = imageData.getExtent(); // Get closer integer ijk
73
+ // NB: point picking means closest slice, means rounding
74
+
75
+ var ijk = [Math.round(pickingData.absoluteIJK[0]), Math.round(pickingData.absoluteIJK[1]), Math.round(pickingData.absoluteIJK[2])]; // Are we outside our actual extent
76
+
77
+ if (ijk[0] < extent[0] || ijk[0] > extent[1] || ijk[1] < extent[2] || ijk[1] > extent[3] || ijk[2] < extent[4] || ijk[2] > extent[5]) {
78
+ return null;
79
+ }
80
+
81
+ return {
82
+ t: pickingData.t,
83
+ ijk: ijk
84
+ };
85
+ }
86
+
87
+ return null;
88
+ }
89
+ /**
90
+ * Implement cell picking for image plane.
91
+ * The plane is defined by the imageData and current slice number,
92
+ * set in the input mapper.
93
+ *
94
+ * @param {Vector3} p1
95
+ * @param {Vector3} p2
96
+ * @param {vtkImageMapper|vtkImageArrayMapper} mapper
97
+ */
98
+
99
+ function intersectWithLineForCellPicking(p1, p2, mapper) {
100
+ var pickingData = doPicking(p1, p2, mapper);
101
+
102
+ if (pickingData) {
103
+ var imageData = mapper.getCurrentImage();
104
+ var extent = imageData.getExtent();
105
+ var absIJK = pickingData.absoluteIJK; // Get closer integer ijk
106
+ // NB: cell picking means closest voxel, means flooring
107
+
108
+ var ijk = [Math.floor(absIJK[0]), Math.floor(absIJK[1]), Math.floor(absIJK[2])]; // Are we outside our actual extent
109
+
110
+ if (ijk[0] < extent[0] || ijk[0] > extent[1] - 1 || ijk[1] < extent[2] || ijk[1] > extent[3] - 1 || ijk[2] < extent[4] || // handle single-slice images
111
+ ijk[2] > (extent[5] ? extent[5] - 1 : extent[5])) {
112
+ return null;
113
+ } // Parametric coordinates within cell
114
+
115
+
116
+ var pCoords = [absIJK[0] - ijk[0], absIJK[1] - ijk[1], absIJK[2] - ijk[2]];
117
+ return {
118
+ t: pickingData.t,
119
+ ijk: ijk,
120
+ pCoords: pCoords
121
+ };
122
+ }
123
+
124
+ return null;
125
+ }
126
+
127
+ export { intersectWithLineForCellPicking, intersectWithLineForPointPicking };
@@ -0,0 +1,82 @@
1
+ import vtkAbstractMapper3D, { IAbstractMapper3DInitialValues } from './AbstractMapper3D';
2
+ import vtkImageData from './../../Common/DataModel/ImageData';
3
+ import { Nullable } from './../../types';
4
+
5
+
6
+ export interface IAbstractImageMapperInitialValues extends IAbstractMapper3DInitialValues {
7
+ customDisplayExtent?: number[];
8
+ useCustomExtents?: boolean;
9
+ slice?: number;
10
+ }
11
+
12
+ export interface vtkAbstractImageMapper extends vtkAbstractMapper3D {
13
+
14
+ /**
15
+ *
16
+ */
17
+ getIsOpaque(): boolean;
18
+
19
+ /**
20
+ * Return currently active image for the mapper. Overridden by deriving classes.
21
+ */
22
+ getCurrentImage(): Nullable<vtkImageData>;
23
+
24
+ /**
25
+ * Get the slice index.
26
+ */
27
+ getSlice(): number;
28
+
29
+ /**
30
+ *
31
+ * @param {Number} slice The slice index.
32
+ */
33
+ setSlice(slice: number): boolean;
34
+
35
+ /**
36
+ *
37
+ */
38
+ getUseCustomExtents(): boolean;
39
+
40
+ /**
41
+ *
42
+ * @param {Boolean} useCustomExtents
43
+ */
44
+ setUseCustomExtents(useCustomExtents: boolean): boolean;
45
+
46
+ /**
47
+ *
48
+ * @param {Number} x1 The x coordinate of the first point.
49
+ * @param {Number} x2 The x coordinate of the second point.
50
+ * @param {Number} y1 The y coordinate of the first point.
51
+ * @param {Number} y2 The y coordinate of the second point.
52
+ * @param {Number} z1 The z coordinate of the first point.
53
+ * @param {Number} z2 The z coordinate of the second point.
54
+ */
55
+ setCustomDisplayExtent(x1: number, x2: number, y1: number, y2: number, z1: number, z2: number): boolean;
56
+
57
+ /**
58
+ *
59
+ * @param customDisplayExtent
60
+ */
61
+ setCustomDisplayExtentFrom(customDisplayExtent: number[]): boolean;
62
+ }
63
+
64
+ /**
65
+ * Method use to decorate a given object (publicAPI+model) with vtkAbstractImageMapper characteristics.
66
+ *
67
+ * @param publicAPI object on which methods will be bounds (public)
68
+ * @param model object on which data structure will be bounds (protected)
69
+ * @param {IAbstractImageMapperInitialValues} [initialValues] (default: {})
70
+ */
71
+ export function extend(publicAPI: object, model: object, initialValues?: IAbstractImageMapperInitialValues): void;
72
+
73
+ /**
74
+ * vtkImageMapper provides 2D image display support for vtk.
75
+ * It can be associated with a vtkImageSlice prop and placed within a Renderer.
76
+ *
77
+ * This class resolves coincident topology with the same methods as vtkMapper.
78
+ */
79
+ export declare const vtkAbstractImageMapper: {
80
+ extend: typeof extend;
81
+ }
82
+ export default vtkAbstractImageMapper;
@@ -0,0 +1,44 @@
1
+ import macro from '../../macros.js';
2
+ import vtkAbstractMapper3D from './AbstractMapper3D.js';
3
+
4
+ // vtkAbstractImageMapper methods
5
+ // ----------------------------------------------------------------------------
6
+
7
+ function vtkAbstractImageMapper(publicAPI, model) {
8
+ model.classHierarchy.push('vtkAbstractImageMapper');
9
+
10
+ publicAPI.getIsOpaque = function () {
11
+ return true;
12
+ };
13
+
14
+ publicAPI.getCurrentImage = function () {
15
+ return null;
16
+ };
17
+ } // ----------------------------------------------------------------------------
18
+ // Object factory
19
+ // ----------------------------------------------------------------------------
20
+
21
+
22
+ var DEFAULT_VALUES = {
23
+ slice: 0,
24
+ customDisplayExtent: [0, 0, 0, 0, 0, 0],
25
+ useCustomExtents: false,
26
+ backgroundColor: [0, 0, 0, 1]
27
+ }; // ----------------------------------------------------------------------------
28
+
29
+ function extend(publicAPI, model) {
30
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
31
+ Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
32
+
33
+ vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
34
+ macro.setGet(publicAPI, model, ['slice', 'useCustomExtents']);
35
+ macro.setGetArray(publicAPI, model, ['customDisplayExtent'], 6);
36
+ macro.setGetArray(publicAPI, model, ['backgroundColor'], 4);
37
+ vtkAbstractImageMapper(publicAPI, model);
38
+ } // ----------------------------------------------------------------------------
39
+
40
+ var vtkAbstractImageMapper$1 = {
41
+ extend: extend
42
+ };
43
+
44
+ export { vtkAbstractImageMapper$1 as default, extend };
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
2
  import { mat4, vec4, vec3, quat } from 'gl-matrix';
3
3
  import macro from '../../macros.js';
4
- import { r as radiansFromDegrees, k as add, j as cross } from '../../Common/Core/Math/index.js';
4
+ import { r as radiansFromDegrees, l as add, k as cross } from '../../Common/Core/Math/index.js';
5
5
 
6
6
  var vtkDebugMacro = macro.vtkDebugMacro;
7
7
  /* eslint-disable new-cap */
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import macro from '../../macros.js';
3
- import { l as normalize } from '../../Common/Core/Math/index.js';
3
+ import { g as normalize } from '../../Common/Core/Math/index.js';
4
4
  import vtkPicker from './Picker.js';
5
5
  import vtkPoints from '../../Common/Core/Points.js';
6
6
  import vtkTriangle from '../../Common/DataModel/Triangle.js';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * vtkColorMaps represents a global registry of preset color maps.
3
+ */
4
+
5
+ import { Vector3 } from '../../../types';
6
+
7
+ export interface IColorMapPreset {
8
+ Name: string;
9
+ Creator?: string;
10
+ ColorSpace?: string;
11
+ NanColor?: Vector3;
12
+ RGBPoints: number[];
13
+ IndexedColors?: number[];
14
+ Annotations?: (number | string)[];
15
+ }
16
+
17
+ export declare const vtkColorMaps: {
18
+ addPreset(preset: IColorMapPreset): void;
19
+ removePresetByName(name: string): void;
20
+ getPresetByName(name: string): IColorMapPreset;
21
+ rgbPresetNames: string[];
22
+ };
23
+
24
+ export default vtkColorMaps;