@kitware/vtk.js 33.0.0-beta.2 → 33.0.0-beta.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 (87) hide show
  1. package/Common/Core/DataArray.d.ts +21 -0
  2. package/Common/Core/DataArray.js +39 -0
  3. package/Common/Core/Math/index.js +1 -1
  4. package/Common/Core/Math.js +1 -1
  5. package/Common/Core/URLExtract.js +2 -6
  6. package/Common/DataModel/Line.js +1 -0
  7. package/Common/DataModel/PolyLine.js +4 -0
  8. package/Filters/Core/ThresholdPoints.d.ts +72 -0
  9. package/Filters/Core/ThresholdPoints.js +219 -0
  10. package/Filters/General/ContourTriangulator/helper.js +1 -1
  11. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +1 -1
  12. package/IO/Geometry/DracoReader.d.ts +4 -4
  13. package/IO/Geometry/DracoReader.js +154 -105
  14. package/IO/Geometry/GLTFImporter/Animations.js +239 -0
  15. package/IO/Geometry/GLTFImporter/Constants.js +87 -0
  16. package/IO/Geometry/GLTFImporter/Decoder.js +69 -0
  17. package/IO/Geometry/GLTFImporter/Extensions.js +110 -0
  18. package/IO/Geometry/GLTFImporter/ORMTexture.worker.js +42 -0
  19. package/IO/Geometry/GLTFImporter/Parser.js +359 -0
  20. package/IO/Geometry/GLTFImporter/Reader.js +518 -0
  21. package/IO/Geometry/GLTFImporter/Utils.js +165 -0
  22. package/IO/Geometry/GLTFImporter.d.ts +266 -0
  23. package/IO/Geometry/GLTFImporter.js +245 -0
  24. package/IO/Geometry/IFCImporter.d.ts +163 -0
  25. package/IO/Geometry/IFCImporter.js +270 -0
  26. package/IO/Geometry/STLReader.d.ts +14 -0
  27. package/IO/Geometry/STLReader.js +57 -1
  28. package/IO/Geometry.js +5 -1
  29. package/IO/Image/HDRReader/Utils.js +1 -1
  30. package/IO/Image/HDRReader.js +1 -1
  31. package/IO/Image/TGAReader/Constants.js +28 -0
  32. package/IO/Image/TGAReader.d.ts +121 -0
  33. package/IO/Image/TGAReader.js +418 -0
  34. package/IO/Image/TIFFReader.d.ts +133 -0
  35. package/IO/Image/TIFFReader.js +144 -0
  36. package/IO/Image.js +5 -1
  37. package/IO/XML/XMLPolyDataWriter.js +1 -0
  38. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
  39. package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
  40. package/Rendering/Core/AbstractImageMapper.d.ts +81 -0
  41. package/Rendering/Core/AbstractImageMapper.js +5 -2
  42. package/Rendering/Core/AbstractPicker.d.ts +13 -13
  43. package/Rendering/Core/AbstractPicker.js +1 -1
  44. package/Rendering/Core/Actor2D.d.ts +22 -0
  45. package/Rendering/Core/Actor2D.js +1 -1
  46. package/Rendering/Core/CellPicker.js +4 -1
  47. package/Rendering/Core/Glyph3DMapper.d.ts +45 -29
  48. package/Rendering/Core/ImageCPRMapper.js +6 -5
  49. package/Rendering/Core/ImageProperty.d.ts +42 -1
  50. package/Rendering/Core/ImageProperty.js +7 -5
  51. package/Rendering/Core/ImageResliceMapper.d.ts +1 -2
  52. package/Rendering/Core/ImageResliceMapper.js +5 -4
  53. package/Rendering/Core/PointPicker.js +10 -1
  54. package/Rendering/Core/Prop3D.js +1 -1
  55. package/Rendering/Core/RenderWindowInteractor.d.ts +1 -1
  56. package/Rendering/Core/RenderWindowInteractor.js +1 -1
  57. package/Rendering/Core/Viewport.js +13 -3
  58. package/Rendering/Core/VolumeMapper.d.ts +70 -0
  59. package/Rendering/Core/VolumeMapper.js +10 -5
  60. package/Rendering/Core/VolumeProperty.d.ts +20 -1
  61. package/Rendering/Core/VolumeProperty.js +7 -5
  62. package/Rendering/Misc/CanvasView.js +4 -2
  63. package/Rendering/Misc/RemoteView.d.ts +9 -3
  64. package/Rendering/Misc/RemoteView.js +7 -3
  65. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +2 -2
  66. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +1 -1
  67. package/Rendering/OpenGL/ImageCPRMapper.js +18 -2
  68. package/Rendering/OpenGL/ImageMapper.js +42 -11
  69. package/Rendering/OpenGL/ImageResliceMapper.js +20 -4
  70. package/Rendering/OpenGL/Renderer.js +1 -1
  71. package/Rendering/OpenGL/Texture/supportsNorm16Linear.js +97 -0
  72. package/Rendering/OpenGL/Texture.d.ts +29 -8
  73. package/Rendering/OpenGL/Texture.js +172 -34
  74. package/Rendering/OpenGL/VolumeMapper.js +22 -4
  75. package/Rendering/SceneGraph/ViewNode.js +12 -2
  76. package/Rendering/WebXR/RenderWindowHelper.js +9 -0
  77. package/Widgets/Core/WidgetManager.d.ts +12 -1
  78. package/Widgets/Representations/WidgetRepresentation.d.ts +1 -7
  79. package/Widgets/Widgets3D/AngleWidget/behavior.js +2 -0
  80. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +1 -1
  81. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +17 -0
  82. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -0
  83. package/Widgets/Widgets3D/ResliceCursorWidget.d.ts +1 -8
  84. package/Widgets/Widgets3D/ShapeWidget/behavior.js +3 -0
  85. package/_virtual/rollup-plugin-worker-loader__module_Sources/IO/Geometry/GLTFImporter/ORMTexture.worker.js +296 -0
  86. package/index.d.ts +5 -0
  87. package/package.json +19 -17
@@ -36,6 +36,7 @@ function vtkXMLPolyDataWriter(publicAPI, model) {
36
36
  });
37
37
  publicAPI.processDataSetAttributes(piece, 'PointData', dataObject.getPointData());
38
38
  publicAPI.processDataSetAttributes(piece, 'CellData', dataObject.getCellData());
39
+ publicAPI.processDataSetAttributes(piece, 'FieldData', dataObject.getFieldData());
39
40
  publicAPI.processDataArray(piece.ele('Points'), dataObject.getPoints());
40
41
  POLYDATA_FIELDS.forEach(cellType => {
41
42
  const cellTypeName = camelize(cellType);
@@ -2,7 +2,7 @@ import { mat4, vec3 } from 'gl-matrix';
2
2
  import { m as macro } from '../../macros2.js';
3
3
  import vtkCompositeCameraManipulator from './CompositeCameraManipulator.js';
4
4
  import vtkCompositeMouseManipulator from './CompositeMouseManipulator.js';
5
- import { r as radiansFromDegrees, C as degreesFromRadians } from '../../Common/Core/Math/index.js';
5
+ import { r as radiansFromDegrees, A as degreesFromRadians } from '../../Common/Core/Math/index.js';
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
8
  // vtkMouseCameraTrackballRollManipulator methods
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkInteractorStyle from '../../Rendering/Core/InteractorStyle.js';
3
3
  import vtkInteractorStyleConstants from '../../Rendering/Core/InteractorStyle/Constants.js';
4
- import { C as degreesFromRadians } from '../../Common/Core/Math/index.js';
4
+ import { A as degreesFromRadians } from '../../Common/Core/Math/index.js';
5
5
  import { Device, Input } from '../../Rendering/Core/RenderWindowInteractor/Constants.js';
6
6
 
7
7
  const {
@@ -122,6 +122,87 @@ export interface vtkAbstractImageMapper extends vtkAbstractMapper3D {
122
122
  * @param customDisplayExtent
123
123
  */
124
124
  setCustomDisplayExtentFrom(customDisplayExtent: number[]): boolean;
125
+
126
+ /**
127
+ * Set the opacity texture width.
128
+ *
129
+ * The default width (1024) should be fine in most instances.
130
+ * Only set this property if your opacity function range width is
131
+ * larger than 1024.
132
+ *
133
+ * A reasonable max texture size would be either 2048 or 4096, as those
134
+ * widths are supported by the vast majority of devices. Any width larger
135
+ * than that will have issues with device support.
136
+ *
137
+ * Specifying a width that is less than or equal to 0 will use the largest
138
+ * possible texture width on the device. Use this with caution! The max texture
139
+ * width of one device may not be the same for another device.
140
+ *
141
+ * You can find more information about supported texture widths at the following link:
142
+ * https://web3dsurvey.com/webgl/parameters/MAX_TEXTURE_SIZE
143
+ *
144
+ * @param {Number} width the texture width (defaults to 1024)
145
+ */
146
+ setOpacityTextureWidth(width: number): boolean;
147
+
148
+ /**
149
+ * Get the opacity texture width.
150
+ */
151
+ getOpacityTextureWidth(): number;
152
+
153
+ /**
154
+ * Set the color texture width.
155
+ *
156
+ * The default width (1024) should be fine in most instances.
157
+ * Only set this property if your color transfer function range width is
158
+ * larger than 1024.
159
+ *
160
+ * A reasonable max texture size would be either 2048 or 4096, as those
161
+ * widths are supported by the vast majority of devices. Any width larger
162
+ * than that will have issues with device support.
163
+ *
164
+ * Specifying a width that is less than or equal to 0 will use the largest
165
+ * possible texture width on the device. Use this with caution! The max texture
166
+ * width of one device may not be the same for another device.
167
+ *
168
+ * You can find more information about supported texture widths at the following link:
169
+ * https://web3dsurvey.com/webgl/parameters/MAX_TEXTURE_SIZE
170
+ *
171
+ * @param {Number} width the texture width (defaults to 1024)
172
+ */
173
+ setColorTextureWidth(width: number): boolean;
174
+
175
+ /**
176
+ * Get the color texture width.
177
+ */
178
+ getColorTextureWidth(): number;
179
+
180
+ /**
181
+ * Set the label outline texture width.
182
+ *
183
+ * The default width (1024) should be fine in most instances.
184
+ * Only set this property if you have more than 1024 labels
185
+ * that you want to render with thickness.
186
+ *
187
+ * A reasonable max texture size would be either 2048 or 4096, as those
188
+ * widths are supported by the vast majority of devices. Any width larger
189
+ * than that will have issues with device support.
190
+ *
191
+ * Specifying a width that is less than or equal to 0 will use the largest
192
+ * possible texture width on the device. Use this with caution! The max texture
193
+ * width of one device may not be the same for another device.
194
+ *
195
+ * You can find more information about supported texture widths at the following link:
196
+ * https://web3dsurvey.com/webgl/parameters/MAX_TEXTURE_SIZE
197
+ *
198
+ * @param {Number} width the texture width (defaults to 1024)
199
+ */
200
+ setLabelOutlineTextureWidth(width: number): boolean;
201
+
202
+ /**
203
+ * Get the label outline texture width.
204
+ */
205
+ getLabelOutlineTextureWidth(): number;
125
206
  }
126
207
 
127
208
  /**
@@ -24,7 +24,10 @@ const DEFAULT_VALUES = {
24
24
  slice: 0,
25
25
  customDisplayExtent: [0, 0, 0, 0, 0, 0],
26
26
  useCustomExtents: false,
27
- backgroundColor: [0, 0, 0, 1]
27
+ backgroundColor: [0, 0, 0, 1],
28
+ colorTextureWidth: 1024,
29
+ opacityTextureWidth: 1024,
30
+ labelOutlineTextureWidth: 1024
28
31
  };
29
32
 
30
33
  // ----------------------------------------------------------------------------
@@ -35,7 +38,7 @@ function extend(publicAPI, model) {
35
38
 
36
39
  // Build VTK API
37
40
  vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
38
- macro.setGet(publicAPI, model, ['slice', 'useCustomExtents']);
41
+ macro.setGet(publicAPI, model, ['slice', 'useCustomExtents', 'colorTextureWidth', 'opacityTextureWidth', 'labelOutlineTextureWidth']);
39
42
  macro.setGetArray(publicAPI, model, ['customDisplayExtent'], 6);
40
43
  macro.setGetArray(publicAPI, model, ['backgroundColor'], 4);
41
44
  vtkAbstractImageMapper(publicAPI, model);
@@ -1,6 +1,6 @@
1
1
  import { vtkObject } from './../../interfaces';
2
2
  import { Vector3 } from './../../types';
3
- import vtkActor from './Actor';
3
+ import vtkProp3D from './Prop3D';
4
4
  import vtkRenderer from './Renderer';
5
5
 
6
6
  /**
@@ -10,8 +10,8 @@ export interface IAbstractPickerInitialValues {
10
10
  renderer?: vtkRenderer;
11
11
  selectionPoint?: Vector3;
12
12
  pickPosition?: Vector3;
13
- pickFromList?: number;
14
- pickList?: vtkActor[];
13
+ pickFromList?: boolean;
14
+ pickList?: vtkProp3D[];
15
15
  }
16
16
 
17
17
  /**
@@ -20,15 +20,15 @@ export interface IAbstractPickerInitialValues {
20
20
  export interface vtkAbstractPicker extends vtkObject {
21
21
  /**
22
22
  *
23
- * @param {vtkActor} actor
23
+ * @param {vtkProp3D} prop
24
24
  */
25
- addPickList(actor: vtkActor): void;
25
+ addPickList(prop: vtkProp3D): void;
26
26
 
27
27
  /**
28
28
  *
29
- * @param {vtkActor} actor
29
+ * @param {vtkProp3D} prop
30
30
  */
31
- deletePickList(actor: vtkActor): void;
31
+ deletePickList(prop: vtkProp3D): void;
32
32
 
33
33
  /**
34
34
  *
@@ -38,7 +38,7 @@ export interface vtkAbstractPicker extends vtkObject {
38
38
  /**
39
39
  *
40
40
  */
41
- getPickList(): boolean;
41
+ getPickList(): vtkProp3D[];
42
42
 
43
43
  /**
44
44
  * Get the picked position
@@ -82,17 +82,17 @@ export interface vtkAbstractPicker extends vtkObject {
82
82
 
83
83
  /**
84
84
  *
85
- * @param {Number} pickFromList
86
- * @default 0
85
+ * @param {Boolean} pickFromList
86
+ * @default false
87
87
  */
88
- setPickFromList(pickFromList: number): boolean;
88
+ setPickFromList(pickFromList: boolean): boolean;
89
89
 
90
90
  /**
91
91
  *
92
- * @param {vtkActor[]} pickList
92
+ * @param {vtkProp3D[]} pickList
93
93
  * @default []
94
94
  */
95
- setPickList(pickList: vtkActor[]): boolean;
95
+ setPickList(pickList: vtkProp3D[]): boolean;
96
96
  }
97
97
 
98
98
  /**
@@ -38,7 +38,7 @@ const DEFAULT_VALUES = {
38
38
  renderer: null,
39
39
  selectionPoint: [0.0, 0.0, 0.0],
40
40
  pickPosition: [0.0, 0.0, 0.0],
41
- pickFromList: 0,
41
+ pickFromList: false,
42
42
  pickList: []
43
43
  };
44
44
 
@@ -54,6 +54,28 @@ export interface vtkActor2D extends vtkProp {
54
54
  */
55
55
  getMapper(): vtkMapper2D;
56
56
 
57
+ /**
58
+ * Set the layer number for this 2D actor.
59
+ * The scenegraph uses this layer number to sort actor 2D overlays/underlays on top of each other.
60
+ * The actor2D with the highest layer number is going to be rendered at the very front i.e. it is
61
+ * the top-most layer.
62
+ * If two actor2D instances share the same layer number, they are rendered in the order in which
63
+ * they were added to the renderer via `addActor` or `addActor2D`.
64
+ * By default, each actor2D has a layer number of 0.
65
+ */
66
+ setLayerNumber(layer: number): void;
67
+
68
+ /**
69
+ * Get the layer number for this 2D actor.
70
+ * The scenegraph uses this layer number to sort actor 2D overlays/underlays on top of each other.
71
+ * The actor2D with the highest layer number is going to be rendered at the very front i.e. it is
72
+ * the top-most layer.
73
+ * If two actor2D instances share the same layer number, they are rendered in the order in which
74
+ * they were added to the renderer via `addActor` or `addActor2D`.
75
+ * By default, each actor2D has a layer number of 0.
76
+ */
77
+ getLayerNumber(): number;
78
+
57
79
  /**
58
80
  *
59
81
  */
@@ -145,7 +145,7 @@ function extend(publicAPI, model) {
145
145
 
146
146
  // Build VTK API
147
147
  macro.set(publicAPI, model, ['property']);
148
- macro.setGet(publicAPI, model, ['mapper']);
148
+ macro.setGet(publicAPI, model, ['mapper', 'layerNumber']);
149
149
 
150
150
  // Object methods
151
151
  vtkActor2D(publicAPI, model);
@@ -219,7 +219,10 @@ function vtkCellPicker(publicAPI, model) {
219
219
 
220
220
  // calculate opacity table
221
221
  const numIComps = 1;
222
- const oWidth = 1024;
222
+ let oWidth = mapper.getOpacityTextureWidth();
223
+ if (oWidth <= 0) {
224
+ oWidth = 1024;
225
+ }
223
226
  const tmpTable = new Float32Array(oWidth);
224
227
  const opacityArray = new Float32Array(oWidth);
225
228
  let ofun;
@@ -12,11 +12,11 @@ interface IPrimitiveCount {
12
12
  export interface IGlyph3DMapperInitialValues extends IMapperInitialValues {
13
13
  orient?: boolean;
14
14
  orientationMode?: OrientationModes;
15
- orientationArray?: number[];
15
+ orientationArray?: string;
16
16
  scaling?: boolean;
17
17
  scaleFactor?: number;
18
18
  scaleMode?: ScaleModes;
19
- scaleArray?: number[];
19
+ scaleArray?: string;
20
20
  matrixArray?: number[];
21
21
  normalArray?: number[];
22
22
  colorArray?: number[];
@@ -24,29 +24,26 @@ export interface IGlyph3DMapperInitialValues extends IMapperInitialValues {
24
24
 
25
25
  export interface vtkGlyph3DMapper extends vtkMapper {
26
26
  /**
27
- * An orientation array is a vtkDataArray with 3 components. The first
28
- * component is the angle of rotation along the X axis. The second component
29
- * is the angle of rotation along the Y axis. The third component is the
30
- * angle of rotation along the Z axis. Orientation is specified in X,Y,Z
31
- * order but the rotations are performed in Z,X an Y.
32
- *
33
- * This definition is compliant with SetOrientation method on vtkProp3D.
27
+ * Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
28
+ * @return {Bounds} The bounds for the mapper.
29
+ */
30
+ getBounds(): Bounds;
31
+
32
+ /**
34
33
  *
35
- * By using vector or normal there is a degree of freedom or rotation left
36
- * (underconstrained). With the orientation array, there is no degree of
37
- * freedom left.
38
34
  */
39
- getOrientationMode(): OrientationModes;
35
+ buildArrays(): void;
40
36
 
41
37
  /**
42
- * Get orientation as string
38
+ *
43
39
  */
44
- getOrientationModeAsString(): string;
40
+ getPrimitiveCount(): IPrimitiveCount;
45
41
 
46
42
  /**
47
- * Get orientation as array
43
+ * Get scale mode
44
+ * @default `SCALE_BY_MAGNITUDE`
48
45
  */
49
- getOrientationArrayData(): number[];
46
+ getScaleMode(): ScaleModes;
50
47
 
51
48
  /**
52
49
  * Get scale factor to scale object by.
@@ -54,15 +51,20 @@ export interface vtkGlyph3DMapper extends vtkMapper {
54
51
  getScaleFactor(): number;
55
52
 
56
53
  /**
57
- * Get scale mode
58
- * @default `SCALE_BY_MAGNITUDE`
54
+ * Get scale mode as string
59
55
  */
60
- getScaleMode(): ScaleModes;
56
+ getScaleModeAsString(): string;
61
57
 
62
58
  /**
63
- * Get scale mode as string
59
+ * Sets the name of the array to use as scale values.
60
+ * @param {String} arrayName Name of the array
64
61
  */
65
- getScaleModeAsString(): string;
62
+ setScaleArray(arrayName: Nullable<string>): boolean;
63
+
64
+ /**
65
+ * Gets the name of the array used as scale values.
66
+ */
67
+ getScaleArray(): string;
66
68
 
67
69
  /**
68
70
  * Get scale mode as array
@@ -70,20 +72,29 @@ export interface vtkGlyph3DMapper extends vtkMapper {
70
72
  getScaleArrayData(): number[];
71
73
 
72
74
  /**
73
- * Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
74
- * @return {Bounds} The bounds for the mapper.
75
+ * An orientation array is a vtkDataArray with 3 components. The first
76
+ * component is the angle of rotation along the X axis. The second component
77
+ * is the angle of rotation along the Y axis. The third component is the
78
+ * angle of rotation along the Z axis. Orientation is specified in X,Y,Z
79
+ * order but the rotations are performed in Z,X an Y.
80
+ *
81
+ * This definition is compliant with SetOrientation method on vtkProp3D.
82
+ *
83
+ * By using vector or normal there is a degree of freedom or rotation left
84
+ * (underconstrained). With the orientation array, there is no degree of
85
+ * freedom left.
75
86
  */
76
- getBounds(): Bounds;
87
+ getOrientationMode(): OrientationModes;
77
88
 
78
89
  /**
79
- *
90
+ * Get orientation as string
80
91
  */
81
- buildArrays(): void;
92
+ getOrientationModeAsString(): string;
82
93
 
83
94
  /**
84
- *
95
+ * Get orientation as array
85
96
  */
86
- getPrimitiveCount(): IPrimitiveCount;
97
+ getOrientationArrayData(): number[];
87
98
 
88
99
  /**
89
100
  * Sets the name of the array to use as orientation.
@@ -91,6 +102,11 @@ export interface vtkGlyph3DMapper extends vtkMapper {
91
102
  */
92
103
  setOrientationArray(arrayName: Nullable<string>): boolean;
93
104
 
105
+ /**
106
+ * Gets the name of the array used as orientation values.
107
+ */
108
+ getOrientationArray(): string;
109
+
94
110
  /**
95
111
  * Orientation mode indicates if the OrientationArray provides the direction
96
112
  * vector for the orientation or the rotations around each axes.
@@ -1,4 +1,4 @@
1
- import { vec3, mat4, quat } from 'gl-matrix';
1
+ import { quat, vec3, mat4 } from 'gl-matrix';
2
2
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
3
3
  import vtkAbstractImageMapper from './AbstractImageMapper.js';
4
4
  import { m as macro } from '../../macros2.js';
@@ -270,7 +270,7 @@ function vtkImageCPRMapper(publicAPI, model) {
270
270
  // Object factory
271
271
  // ----------------------------------------------------------------------------
272
272
 
273
- const DEFAULT_VALUES = {
273
+ const defaultValues = initialValues => ({
274
274
  width: 10,
275
275
  uniformOrientation: [0, 0, 0, 1],
276
276
  useUniformOrientation: false,
@@ -282,14 +282,15 @@ const DEFAULT_VALUES = {
282
282
  normalDirection: [0, 0, 1],
283
283
  projectionSlabThickness: 1,
284
284
  projectionSlabNumberOfSamples: 1,
285
- projectionMode: ProjectionMode.MAX
286
- };
285
+ projectionMode: ProjectionMode.MAX,
286
+ ...initialValues
287
+ });
287
288
 
288
289
  // ----------------------------------------------------------------------------
289
290
 
290
291
  function extend(publicAPI, model) {
291
292
  let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
292
- Object.assign(model, DEFAULT_VALUES, initialValues);
293
+ Object.assign(model, defaultValues(initialValues));
293
294
 
294
295
  // Inheritance
295
296
  vtkAbstractImageMapper.extend(publicAPI, model, initialValues);
@@ -1,5 +1,5 @@
1
1
  import { vtkObject } from './../../interfaces';
2
- import { Nullable } from './../../types';
2
+ import { Extent, Nullable } from './../../types';
3
3
  import vtkColorTransferFunction from './ColorTransferFunction';
4
4
  import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
5
5
  import { InterpolationType } from './ImageProperty/Constants';
@@ -94,6 +94,28 @@ export interface vtkImageProperty extends vtkObject {
94
94
  */
95
95
  getScalarOpacity(idx?: number): vtkPiecewiseFunction;
96
96
 
97
+ /**
98
+ * Enable label outline rendering.
99
+ * @param {Boolean} useLabelOutline
100
+ */
101
+ setUseLabelOutline(useLabelOutline: boolean): boolean;
102
+
103
+ /**
104
+ * Check if label outline rendering.
105
+ */
106
+ getUseLabelOutline(): boolean;
107
+
108
+ /**
109
+ * Set the 0 to 1 opacity of the label outline.
110
+ * @param {Number} opacity
111
+ */
112
+ setLabelOutlineOpacity(opacity: number): boolean;
113
+
114
+ /**
115
+ * Get the 0 to 1 opacity of the label outline.
116
+ */
117
+ getLabelOutlineOpacity(): number;
118
+
97
119
  /**
98
120
  * gets the label outline thickness
99
121
  */
@@ -209,6 +231,25 @@ export interface vtkImageProperty extends vtkObject {
209
231
  * @param {Boolean} useLookupTableScalarRange
210
232
  */
211
233
  setUseLookupTableScalarRange(useLookupTableScalarRange: boolean): boolean;
234
+
235
+ /**
236
+ * Informs the mapper to only update the specified extents at the next render.
237
+ *
238
+ * If there are zero extents, the mapper updates the entire volume texture.
239
+ * Otherwise, the mapper will only update the texture by the specified extents
240
+ * during the next render call.
241
+ *
242
+ * This array is cleared after a successful render.
243
+ * @param extents
244
+ */
245
+ setUpdatedExtents(extents: Extent[]): boolean;
246
+
247
+ /**
248
+ * Retrieves the updated extents.
249
+ *
250
+ * This array is cleared after every successful render.
251
+ */
252
+ getUpdatedExtents(): Extent[];
212
253
  }
213
254
 
214
255
  /**
@@ -136,7 +136,7 @@ function vtkImageProperty(publicAPI, model) {
136
136
  // ----------------------------------------------------------------------------
137
137
  // Object factory
138
138
  // ----------------------------------------------------------------------------
139
- const DEFAULT_VALUES = {
139
+ const defaultValues = initialValues => ({
140
140
  independentComponents: false,
141
141
  interpolationType: InterpolationType.LINEAR,
142
142
  colorWindow: 255,
@@ -147,14 +147,16 @@ const DEFAULT_VALUES = {
147
147
  useLookupTableScalarRange: false,
148
148
  useLabelOutline: false,
149
149
  labelOutlineThickness: [1],
150
- labelOutlineOpacity: 1.0
151
- };
150
+ labelOutlineOpacity: 1.0,
151
+ updatedExtents: [],
152
+ ...initialValues
153
+ });
152
154
 
153
155
  // ----------------------------------------------------------------------------
154
156
 
155
157
  function extend(publicAPI, model) {
156
158
  let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
157
- Object.assign(model, DEFAULT_VALUES, initialValues);
159
+ Object.assign(model, defaultValues(initialValues));
158
160
 
159
161
  // Build VTK API
160
162
  macro.obj(publicAPI, model);
@@ -168,7 +170,7 @@ function extend(publicAPI, model) {
168
170
  });
169
171
  }
170
172
  }
171
- macro.setGet(publicAPI, model, ['independentComponents', 'interpolationType', 'colorWindow', 'colorLevel', 'ambient', 'diffuse', 'opacity', 'useLookupTableScalarRange', 'useLabelOutline', 'labelOutlineOpacity']);
173
+ macro.setGet(publicAPI, model, ['independentComponents', 'interpolationType', 'colorWindow', 'colorLevel', 'ambient', 'diffuse', 'opacity', 'useLookupTableScalarRange', 'useLabelOutline', 'labelOutlineOpacity', 'updatedExtents']);
172
174
  macro.setGetArray(publicAPI, model, ['labelOutlineThickness']);
173
175
 
174
176
  // Object methods
@@ -1,10 +1,9 @@
1
1
  import vtkAbstractImageMapper, {
2
2
  IAbstractImageMapperInitialValues,
3
3
  } from './AbstractImageMapper';
4
- import vtkImageData from './../../Common/DataModel/ImageData';
5
4
  import vtkPlane from './../../Common/DataModel/Plane';
6
5
  import vtkPolyData from './../../Common/DataModel/PolyData';
7
- import { Bounds, Nullable, Vector3 } from './../../types';
6
+ import { Bounds } from './../../types';
8
7
  import { SlabTypes } from './ImageResliceMapper/Constants';
9
8
  import CoincidentTopologyHelper, {
10
9
  StaticCoincidentTopologyMethods,
@@ -38,19 +38,20 @@ function vtkImageResliceMapper(publicAPI, model) {
38
38
  // Object factory
39
39
  // ----------------------------------------------------------------------------
40
40
 
41
- const DEFAULT_VALUES = {
41
+ const defaultValues = initialValues => ({
42
42
  slabThickness: 0.0,
43
43
  slabTrapezoidIntegration: 0,
44
44
  slabType: SlabTypes.MEAN,
45
45
  slicePlane: null,
46
- slicePolyData: null
47
- };
46
+ slicePolyData: null,
47
+ ...initialValues
48
+ });
48
49
 
49
50
  // ----------------------------------------------------------------------------
50
51
 
51
52
  function extend(publicAPI, model) {
52
53
  let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
53
- Object.assign(model, DEFAULT_VALUES, initialValues);
54
+ Object.assign(model, defaultValues(initialValues));
54
55
 
55
56
  // Build VTK API
56
57
  vtkAbstractImageMapper.extend(publicAPI, model, initialValues);
@@ -80,6 +80,9 @@ function vtkPointPicker(publicAPI, model) {
80
80
  if (maxDist <= tolerance && maxDist < minPtDist) {
81
81
  // within tolerance
82
82
  minPtId = ptId;
83
+ x[0];
84
+ x[1];
85
+ x[2];
83
86
  minPtDist = maxDist;
84
87
  tMin = t;
85
88
  }
@@ -108,13 +111,19 @@ function vtkPointPicker(publicAPI, model) {
108
111
  if (maxDist <= tolerance && maxDist < minPtDist) {
109
112
  // within tolerance
110
113
  minPtId = ptId;
114
+ x[0];
115
+ x[1];
116
+ x[2];
111
117
  minPtDist = maxDist;
112
118
  tMin = t;
113
119
  }
114
120
  }
115
121
  }
116
122
  }
117
- model.pointId = minPtId;
123
+ if (minPtId > -1 && tMin < model.globalTMin) {
124
+ model.globalTMin = tMin;
125
+ model.pointId = minPtId;
126
+ }
118
127
  return tMin;
119
128
  };
120
129
  }
@@ -1,7 +1,7 @@
1
1
  import { mat4, quat } from 'gl-matrix';
2
2
  import { m as macro } from '../../macros2.js';
3
3
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
4
- import { C as degreesFromRadians, r as radiansFromDegrees, a as areMatricesEqual } from '../../Common/Core/Math/index.js';
4
+ import { A as degreesFromRadians, r as radiansFromDegrees, a as areMatricesEqual } from '../../Common/Core/Math/index.js';
5
5
  import vtkProp from './Prop.js';
6
6
 
7
7
  const VTK_EPSILON = 1e-6;
@@ -63,7 +63,7 @@ export interface IRenderWindowInteractorInitialValues {
63
63
  mouseScrollDebounceByPass?: boolean;
64
64
  }
65
65
 
66
- interface IPosition {
66
+ export interface IPosition {
67
67
  type: string;
68
68
  }
69
69
 
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { C as degreesFromRadians } from '../../Common/Core/Math/index.js';
2
+ import { A as degreesFromRadians } from '../../Common/Core/Math/index.js';
3
3
  import Constants from './RenderWindowInteractor/Constants.js';
4
4
 
5
5
  const {
@@ -46,10 +46,20 @@ function vtkViewport(publicAPI, model) {
46
46
  return allProps;
47
47
  }
48
48
  publicAPI.getViewPropsWithNestedProps = () => {
49
- const allPropsArray = [];
50
- for (let i = 0; i < model.props.length; i++) {
51
- gatherProps(model.props[i], allPropsArray);
49
+ let allPropsArray = [];
50
+ // Handle actor2D instances separately so that they can be overlayed and layered
51
+ const actors2D = publicAPI.getActors2D();
52
+ // Sort the actor2D list using its layer number
53
+ actors2D.sort((a, b) => a.getLayerNumber() - b.getLayerNumber());
54
+ // Filter out all the actor2D instances
55
+ const newPropList = model.props.filter(item => !actors2D.includes(item));
56
+ for (let i = 0; i < newPropList.length; i++) {
57
+ gatherProps(newPropList[i], allPropsArray);
52
58
  }
59
+ // Finally, add the actor2D props at the end of the list
60
+ // This works because, when traversing the render pass in vtkOpenGLRenderer, the children are
61
+ // traversed in the order that they are added to the list
62
+ allPropsArray = allPropsArray.concat(actors2D);
53
63
  return allPropsArray;
54
64
  };
55
65
  publicAPI.addActor2D = publicAPI.addViewProp;