@kitware/vtk.js 26.3.2 → 26.4.1

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 (55) hide show
  1. package/Common/Core/CellArray.d.ts +4 -0
  2. package/Common/Core/CellArray.js +4 -0
  3. package/Common/Core/LookupTable.js +4 -2
  4. package/Common/DataModel/Collection.d.ts +118 -0
  5. package/Common/DataModel/Collection.js +113 -0
  6. package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
  7. package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
  8. package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
  9. package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
  10. package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
  11. package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
  12. package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
  13. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
  14. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
  15. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
  16. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
  17. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
  18. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
  19. package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
  20. package/Interaction/Style/InteractorStyleManipulator.d.ts +333 -0
  21. package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
  22. package/Proxy/Core/LookupTableProxy.d.ts +45 -0
  23. package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
  24. package/Proxy/Core/ProxyManager.d.ts +81 -0
  25. package/Proxy/Core/SourceProxy.d.ts +22 -0
  26. package/Proxy/Core/View2DProxy.d.ts +7 -0
  27. package/Proxy/Core/ViewProxy.d.ts +86 -0
  28. package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
  29. package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
  30. package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
  31. package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
  32. package/Rendering/Core/AbstractImageMapper.js +42 -0
  33. package/Rendering/Core/CellPicker.js +1 -1
  34. package/Rendering/Core/ImageArrayMapper.d.ts +252 -0
  35. package/Rendering/Core/ImageArrayMapper.js +242 -0
  36. package/Rendering/Core/ImageMapper.d.ts +5 -35
  37. package/Rendering/Core/ImageMapper.js +16 -108
  38. package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
  39. package/Rendering/Core/InteractorStyle.d.ts +229 -0
  40. package/Rendering/Core/PointPicker.js +1 -1
  41. package/Rendering/Core/ScalarBarActor.js +4 -2
  42. package/Rendering/Core/Texture.d.ts +5 -0
  43. package/Rendering/Core/Texture.js +3 -1
  44. package/Rendering/OpenGL/ImageMapper.js +13 -7
  45. package/Rendering/OpenGL/PolyDataMapper.js +3 -1
  46. package/Rendering/OpenGL/RenderWindow.d.ts +8 -1
  47. package/Rendering/OpenGL/RenderWindow.js +3 -2
  48. package/Rendering/OpenGL/Texture.js +19 -18
  49. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  50. package/Widgets/Core/StateBuilder.d.ts +29 -0
  51. package/Widgets/Representations/PolyLineRepresentation.js +16 -8
  52. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +0 -11
  53. package/Widgets/Widgets3D/ResliceCursorWidget.js +7 -14
  54. package/index.d.ts +30 -0
  55. package/package.json +1 -1
@@ -0,0 +1,242 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import macro from '../../macros.js';
3
+ import vtkAbstractImageMapper from './AbstractImageMapper.js';
4
+ import vtkImageMapper from './ImageMapper.js';
5
+ import { N as createUninitializedBounds } from '../../Common/Core/Math/index.js';
6
+ import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
7
+ import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
8
+
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+ var staticOffsetAPI = CoincidentTopologyHelper.staticOffsetAPI,
13
+ otherStaticMethods = CoincidentTopologyHelper.otherStaticMethods;
14
+ var vtkErrorMacro = macro.vtkErrorMacro,
15
+ vtkWarningMacro = macro.vtkWarningMacro;
16
+ var SlicingMode = vtkImageMapper.SlicingMode; // ----------------------------------------------------------------------------
17
+ // vtkImageArrayMapper methods
18
+ // ----------------------------------------------------------------------------
19
+
20
+ function vtkImageArrayMapper(publicAPI, model) {
21
+ // Set our className
22
+ model.classHierarchy.push('vtkImageArrayMapper'); //------------------
23
+ // Private functions
24
+
25
+ var _computeSliceToSubSliceMap = function _computeSliceToSubSliceMap() {
26
+ var inputCollection = publicAPI.getInputData();
27
+
28
+ if (!inputCollection || inputCollection.empty()) {
29
+ // clear the map
30
+ if (model.sliceToSubSliceMap.length !== 0) {
31
+ model.sliceToSubSliceMap.length = 0;
32
+ publicAPI.modified();
33
+ }
34
+
35
+ return;
36
+ }
37
+
38
+ if (model.sliceToSubSliceMap.length === 0 || inputCollection.getMTime() > publicAPI.getMTime()) {
39
+ var perImageMap = inputCollection.map(function (image, index) {
40
+ var dim = image.getDimensions();
41
+ var out = new Array(dim[model.slicingMode]);
42
+
43
+ for (var i = 0; i < out.length; ++i) {
44
+ out[i] = {
45
+ imageIndex: index,
46
+ subSlice: i
47
+ };
48
+ }
49
+
50
+ return out;
51
+ });
52
+ model.sliceToSubSliceMap = perImageMap.flat();
53
+ publicAPI.modified();
54
+ }
55
+ };
56
+
57
+ var _superSetInputData = publicAPI.setInputData;
58
+ var _superSetInputConnection = publicAPI.setInputConnection; //------------------
59
+ // Public functions
60
+
61
+ publicAPI.setInputData = function (inputData) {
62
+ _superSetInputData(inputData);
63
+
64
+ _computeSliceToSubSliceMap();
65
+ };
66
+
67
+ publicAPI.setInputConnection = function (outputPort) {
68
+ var port = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
69
+
70
+ _superSetInputConnection(outputPort, port);
71
+
72
+ _computeSliceToSubSliceMap();
73
+ };
74
+
75
+ publicAPI.getImage = function () {
76
+ var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : publicAPI.getSlice();
77
+ var inputCollection = publicAPI.getInputData();
78
+
79
+ if (!inputCollection) {
80
+ vtkWarningMacro('No input set.');
81
+ } else if (slice < 0 || slice >= publicAPI.getTotalSlices()) {
82
+ vtkWarningMacro('Invalid slice number.');
83
+ } else {
84
+ _computeSliceToSubSliceMap();
85
+
86
+ return inputCollection.getItem(model.sliceToSubSliceMap[slice].imageIndex);
87
+ }
88
+
89
+ return null;
90
+ };
91
+
92
+ publicAPI.getBounds = function () {
93
+ var image = publicAPI.getCurrentImage();
94
+
95
+ if (!image) {
96
+ return createUninitializedBounds();
97
+ }
98
+
99
+ if (!model.useCustomExtents) {
100
+ return image.getBounds();
101
+ }
102
+
103
+ var ex = model.customDisplayExtent.slice(); // use sub-slice of the current image,
104
+ // which is the k-coordinate.
105
+
106
+ var nSlice = publicAPI.getSubSlice();
107
+ ex[4] = nSlice;
108
+ ex[5] = nSlice;
109
+ return image.extentToBounds(ex);
110
+ };
111
+
112
+ publicAPI.getBoundsForSlice = function () {
113
+ var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : publicAPI.getSlice();
114
+ var halfThickness = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
115
+ var image = publicAPI.getImage(slice);
116
+
117
+ if (!image) {
118
+ return createUninitializedBounds();
119
+ }
120
+
121
+ var extent = image.getSpatialExtent();
122
+ var nSlice = publicAPI.getSubSlice(slice);
123
+ extent[4] = nSlice - halfThickness;
124
+ extent[5] = nSlice + halfThickness;
125
+ return image.extentToBounds(extent);
126
+ };
127
+
128
+ publicAPI.getClosestIJKAxis = function () {
129
+ return {
130
+ ijkMode: model.slicingMode,
131
+ flip: false
132
+ };
133
+ };
134
+
135
+ publicAPI.computeTotalSlices = function () {
136
+ var inputCollection = publicAPI.getInputData();
137
+ var collectionLength = inputCollection.getNumberOfItems();
138
+ var slicesCount = 0;
139
+
140
+ for (var i = 0; i < collectionLength; ++i) {
141
+ var image = inputCollection.getItem(i);
142
+
143
+ if (image) {
144
+ slicesCount += image.getDimensions()[model.slicingMode];
145
+ }
146
+ }
147
+
148
+ return slicesCount;
149
+ };
150
+
151
+ publicAPI.getTotalSlices = function () {
152
+ _computeSliceToSubSliceMap();
153
+
154
+ return model.sliceToSubSliceMap.length;
155
+ }; // set slice number in terms of imageIndex and subSlice number.
156
+
157
+
158
+ publicAPI.setSlice = function (slice) {
159
+ var inputCollection = publicAPI.getInputData();
160
+
161
+ if (!inputCollection) {
162
+ // No input is set
163
+ vtkWarningMacro('No input set.');
164
+ return;
165
+ }
166
+
167
+ var totalSlices = publicAPI.getTotalSlices();
168
+
169
+ if (slice >= 0 && slice < totalSlices) {
170
+ model.slice = slice;
171
+ publicAPI.modified();
172
+ } else {
173
+ vtkErrorMacro("Slice number out of range. Acceptable range is: [0, ".concat(totalSlices > 0 ? totalSlices - 1 : 0, "]slice <= totalSlices"));
174
+ }
175
+ };
176
+
177
+ publicAPI.computeSlice = function (imageIndex, subSlice) {
178
+ _computeSliceToSubSliceMap();
179
+
180
+ return model.sliceToSubSliceMap.findIndex(function (x) {
181
+ return x.imageIndex === imageIndex && x.subSlice === subSlice;
182
+ });
183
+ };
184
+
185
+ publicAPI.getImageIndex = function () {
186
+ var _model$sliceToSubSlic;
187
+
188
+ var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : publicAPI.getSlice();
189
+
190
+ _computeSliceToSubSliceMap();
191
+
192
+ return (_model$sliceToSubSlic = model.sliceToSubSliceMap[slice]) === null || _model$sliceToSubSlic === void 0 ? void 0 : _model$sliceToSubSlic.imageIndex;
193
+ };
194
+
195
+ publicAPI.getSubSlice = function () {
196
+ var _model$sliceToSubSlic2;
197
+
198
+ var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : publicAPI.getSlice();
199
+
200
+ _computeSliceToSubSliceMap();
201
+
202
+ return (_model$sliceToSubSlic2 = model.sliceToSubSliceMap[slice]) === null || _model$sliceToSubSlic2 === void 0 ? void 0 : _model$sliceToSubSlic2.subSlice;
203
+ };
204
+
205
+ publicAPI.getCurrentImage = function () {
206
+ return publicAPI.getImage(publicAPI.getSlice());
207
+ };
208
+
209
+ publicAPI.intersectWithLineForPointPicking = function (p1, p2) {
210
+ return intersectWithLineForPointPicking(p1, p2, publicAPI);
211
+ };
212
+
213
+ publicAPI.intersectWithLineForCellPicking = function (p1, p2) {
214
+ return intersectWithLineForCellPicking(p1, p2, publicAPI);
215
+ };
216
+ } // ----------------------------------------------------------------------------
217
+
218
+
219
+ var DEFAULT_VALUES = {
220
+ slicingMode: SlicingMode.K,
221
+ sliceToSubSliceMap: []
222
+ };
223
+ function extend(publicAPI, model) {
224
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
225
+ Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
226
+
227
+ vtkAbstractImageMapper.extend(publicAPI, model, initialValues); // Build VTK API
228
+
229
+ macro.get(publicAPI, model, ['slicingMode']);
230
+ CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model); // Object methods
231
+
232
+ vtkImageArrayMapper(publicAPI, model);
233
+ } // ----------------------------------------------------------------------------
234
+
235
+ var newInstance = macro.newInstance(extend, 'vtkImageArrayMapper'); // ----------------------------------------------------------------------------
236
+
237
+ var index = _objectSpread(_objectSpread({
238
+ newInstance: newInstance,
239
+ extend: extend
240
+ }, staticOffsetAPI), otherStaticMethods);
241
+
242
+ export { index as default, extend, newInstance };
@@ -1,7 +1,8 @@
1
1
  import vtkCamera from './Camera';
2
2
  import vtkAbstractMapper, { IAbstractMapperInitialValues } from './AbstractMapper';
3
- import { Bounds, Vector3 } from './../../types';
3
+ import { Bounds, Nullable, Vector3 } from './../../types';
4
4
  import { SlicingMode } from './ImageMapper/Constants';
5
+ import vtkImageData from './../../Common/DataModel/ImageData';
5
6
 
6
7
 
7
8
  interface IClosestIJKAxis {
@@ -15,10 +16,6 @@ interface ICoincidentTopology {
15
16
  }
16
17
 
17
18
  export interface IImageMapperInitialValues extends IAbstractMapperInitialValues {
18
- displayExtent?: number[];
19
- customDisplayExtent?: number[];
20
- useCustomExtents?: boolean;
21
- slice?: number;
22
19
  closestIJKAxis?: IClosestIJKAxis;
23
20
  renderToRectangle?: boolean;
24
21
  sliceAtFocalPoint?: boolean;
@@ -94,20 +91,16 @@ export interface vtkImageMapper extends vtkAbstractMapper {
94
91
  getResolveCoincidentTopologyPolygonOffsetParameters(): ICoincidentTopology;
95
92
 
96
93
  /**
97
- * Get the slice index.
94
+ * Return currently active image. By default, there can only be one image
95
+ * for this mapper, if an input is set.
98
96
  */
99
- getSlice(): number;
97
+ getCurrentImage(): Nullable<vtkImageData>;
100
98
 
101
99
  /**
102
100
  * Get the slice number at a focal point.
103
101
  */
104
102
  getSliceAtFocalPoint(): boolean;
105
103
 
106
- /**
107
- *
108
- */
109
- getUseCustomExtents(): boolean;
110
-
111
104
  /**
112
105
  *
113
106
  * @param {Number[]} p1 The coordinates of the first point.
@@ -128,23 +121,6 @@ export interface vtkImageMapper extends vtkAbstractMapper {
128
121
  */
129
122
  setClosestIJKAxis(closestIJKAxis: IClosestIJKAxis): boolean;
130
123
 
131
- /**
132
- *
133
- * @param {Number} x1 The x coordinate of the first point.
134
- * @param {Number} x2 The x coordinate of the second point.
135
- * @param {Number} y1 The y coordinate of the first point.
136
- * @param {Number} y2 The y coordinate of the second point.
137
- * @param {Number} z1 The z coordinate of the first point.
138
- * @param {Number} z2 The z coordinate of the second point.
139
- */
140
- setCustomDisplayExtent(x1: number, x2: number, y1: number, y2: number, z1: number, z2: number): boolean;
141
-
142
- /**
143
- *
144
- * @param customDisplayExtent
145
- */
146
- setCustomDisplayExtentFrom(customDisplayExtent: number[]): boolean;
147
-
148
124
  /**
149
125
  *
150
126
  * @param {Number} factor
@@ -239,12 +215,6 @@ export interface vtkImageMapper extends vtkAbstractMapper {
239
215
  */
240
216
  sliceAtFocalPoint(sliceAtFocalPoint: boolean): boolean;
241
217
 
242
- /**
243
- *
244
- * @param {Boolean} useCustomExtents
245
- */
246
- setUseCustomExtents(useCustomExtents: boolean): boolean;
247
-
248
218
  /**
249
219
  * Set the slice for the X axis.
250
220
  * @param {Number} id The slice index.
@@ -1,11 +1,10 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import Constants from './ImageMapper/Constants.js';
3
3
  import macro from '../../macros.js';
4
- import vtkAbstractMapper from './AbstractMapper.js';
4
+ import vtkAbstractImageMapper from './AbstractImageMapper.js';
5
+ import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
5
6
  import { C as clampValue, O as multiply3x3_vect3, N as createUninitializedBounds } from '../../Common/Core/Math/index.js';
6
- import vtkPlane from '../../Common/DataModel/Plane.js';
7
7
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
8
- import { vec3 } from 'gl-matrix';
9
8
 
10
9
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
10
 
@@ -22,7 +21,7 @@ function vtkImageMapper(publicAPI, model) {
22
21
  model.classHierarchy.push('vtkImageMapper');
23
22
 
24
23
  publicAPI.getSliceAtPosition = function (pos) {
25
- var image = publicAPI.getInputData();
24
+ var image = publicAPI.getCurrentImage();
26
25
  var pos3;
27
26
 
28
27
  if (pos.length === 3) {
@@ -133,7 +132,7 @@ function vtkImageMapper(publicAPI, model) {
133
132
 
134
133
  publicAPI.getSlicingModeNormal = function () {
135
134
  var out = [0, 0, 0];
136
- var a = publicAPI.getInputData().getDirection();
135
+ var a = publicAPI.getCurrentImage().getDirection();
137
136
  var mat3 = [[a[0], a[1], a[2]], [a[3], a[4], a[5]], [a[6], a[7], a[8]]];
138
137
 
139
138
  switch (model.slicingMode) {
@@ -200,7 +199,7 @@ function vtkImageMapper(publicAPI, model) {
200
199
  // that its inverse is equal to its transpose. We therefore need to apply two
201
200
  // transpositions resulting in a no-op.
202
201
 
203
- var a = publicAPI.getInputData().getDirection();
202
+ var a = publicAPI.getCurrentImage().getDirection();
204
203
  multiply3x3_vect3(a, inVec3, out);
205
204
  var maxAbs = 0.0;
206
205
  var ijkMode = -1;
@@ -235,7 +234,7 @@ function vtkImageMapper(publicAPI, model) {
235
234
 
236
235
  model.slicingMode = mode;
237
236
 
238
- if (publicAPI.getInputData()) {
237
+ if (publicAPI.getCurrentImage()) {
239
238
  computeClosestIJKAxis();
240
239
  }
241
240
 
@@ -243,7 +242,7 @@ function vtkImageMapper(publicAPI, model) {
243
242
  };
244
243
 
245
244
  publicAPI.getClosestIJKAxis = function () {
246
- if ((model.closestIJKAxis === undefined || model.closestIJKAxis.ijkMode === SlicingMode.NONE) && publicAPI.getInputData()) {
245
+ if ((model.closestIJKAxis === undefined || model.closestIJKAxis.ijkMode === SlicingMode.NONE) && publicAPI.getCurrentImage()) {
247
246
  computeClosestIJKAxis();
248
247
  }
249
248
 
@@ -251,7 +250,7 @@ function vtkImageMapper(publicAPI, model) {
251
250
  };
252
251
 
253
252
  publicAPI.getBounds = function () {
254
- var image = publicAPI.getInputData();
253
+ var image = publicAPI.getCurrentImage();
255
254
 
256
255
  if (!image) {
257
256
  return createUninitializedBounds();
@@ -296,7 +295,7 @@ function vtkImageMapper(publicAPI, model) {
296
295
  publicAPI.getBoundsForSlice = function () {
297
296
  var slice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.slice;
298
297
  var halfThickness = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
299
- var image = publicAPI.getInputData();
298
+ var image = publicAPI.getCurrentImage();
300
299
 
301
300
  if (!image) {
302
301
  return createUninitializedBounds();
@@ -334,102 +333,16 @@ function vtkImageMapper(publicAPI, model) {
334
333
  return image.extentToBounds(extent);
335
334
  };
336
335
 
337
- publicAPI.getIsOpaque = function () {
338
- return true;
339
- };
340
-
341
- function doPicking(p1, p2) {
342
- var imageData = publicAPI.getInputData();
343
- var extent = imageData.getExtent(); // Slice origin
344
-
345
- var ijk = [extent[0], extent[2], extent[4]];
346
-
347
- var _publicAPI$getClosest4 = publicAPI.getClosestIJKAxis(),
348
- ijkMode = _publicAPI$getClosest4.ijkMode;
349
-
350
- var nSlice = model.slice;
351
-
352
- if (ijkMode !== model.slicingMode) {
353
- // If not IJK slicing, get the IJK slice from the XYZ position/slice
354
- nSlice = publicAPI.getSliceAtPosition(nSlice);
355
- }
356
-
357
- ijk[ijkMode] += nSlice;
358
- var worldOrigin = [0, 0, 0];
359
- imageData.indexToWorld(ijk, worldOrigin); // Normal computation
360
-
361
- ijk[ijkMode] += 1;
362
- var worldNormal = [0, 0, 0];
363
- imageData.indexToWorld(ijk, worldNormal);
364
- worldNormal[0] -= worldOrigin[0];
365
- worldNormal[1] -= worldOrigin[1];
366
- worldNormal[2] -= worldOrigin[2];
367
- vec3.normalize(worldNormal, worldNormal);
368
- var intersect = vtkPlane.intersectWithLine(p1, p2, worldOrigin, worldNormal);
369
-
370
- if (intersect.intersection) {
371
- var point = intersect.x;
372
- var absoluteIJK = [0, 0, 0];
373
- imageData.worldToIndex(point, absoluteIJK); // `t` is the parametric position along the line
374
- // defined in Plane.intersectWithLine
375
-
376
- return {
377
- t: intersect.t,
378
- absoluteIJK: absoluteIJK
379
- };
380
- }
381
-
382
- return null;
383
- }
384
-
385
336
  publicAPI.intersectWithLineForPointPicking = function (p1, p2) {
386
- var pickingData = doPicking(p1, p2);
387
-
388
- if (pickingData) {
389
- var imageData = publicAPI.getInputData();
390
- var extent = imageData.getExtent(); // Get closer integer ijk
391
- // NB: point picking means closest slice, means rounding
392
-
393
- var ijk = [Math.round(pickingData.absoluteIJK[0]), Math.round(pickingData.absoluteIJK[1]), Math.round(pickingData.absoluteIJK[2])]; // Are we outside our actual extent
394
-
395
- 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]) {
396
- return null;
397
- }
398
-
399
- return {
400
- t: pickingData.t,
401
- ijk: ijk
402
- };
403
- }
404
-
405
- return null;
337
+ return intersectWithLineForPointPicking(p1, p2, publicAPI);
406
338
  };
407
339
 
408
340
  publicAPI.intersectWithLineForCellPicking = function (p1, p2) {
409
- var pickingData = doPicking(p1, p2);
410
-
411
- if (pickingData) {
412
- var imageData = publicAPI.getInputData();
413
- var extent = imageData.getExtent();
414
- var absIJK = pickingData.absoluteIJK; // Get closer integer ijk
415
- // NB: cell picking means closest voxel, means flooring
416
-
417
- var ijk = [Math.floor(absIJK[0]), Math.floor(absIJK[1]), Math.floor(absIJK[2])]; // Are we outside our actual extent
418
-
419
- if (ijk[0] < extent[0] || ijk[0] > extent[1] - 1 || ijk[1] < extent[2] || ijk[1] > extent[3] - 1 || ijk[2] < extent[4] || ijk[2] > extent[5] - 1) {
420
- return null;
421
- } // Parametric coordinates within cell
422
-
423
-
424
- var pCoords = [absIJK[0] - ijk[0], absIJK[1] - ijk[1], absIJK[2] - ijk[2]];
425
- return {
426
- t: pickingData.t,
427
- ijk: ijk,
428
- pCoords: pCoords
429
- };
430
- }
341
+ return intersectWithLineForCellPicking(p1, p2, publicAPI);
342
+ };
431
343
 
432
- return null;
344
+ publicAPI.getCurrentImage = function () {
345
+ return publicAPI.getInputData();
433
346
  };
434
347
  } // ----------------------------------------------------------------------------
435
348
  // Object factory
@@ -437,10 +350,6 @@ function vtkImageMapper(publicAPI, model) {
437
350
 
438
351
 
439
352
  var DEFAULT_VALUES = {
440
- displayExtent: [0, 0, 0, 0, 0, 0],
441
- customDisplayExtent: [0, 0, 0, 0],
442
- useCustomExtents: false,
443
- slice: 0,
444
353
  slicingMode: SlicingMode.NONE,
445
354
  closestIJKAxis: {
446
355
  ijkMode: SlicingMode.NONE,
@@ -454,10 +363,9 @@ function extend(publicAPI, model) {
454
363
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
455
364
  Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
456
365
 
457
- vtkAbstractMapper.extend(publicAPI, model, initialValues);
366
+ vtkAbstractImageMapper.extend(publicAPI, model, initialValues);
458
367
  macro.get(publicAPI, model, ['slicingMode']);
459
- macro.setGet(publicAPI, model, ['slice', 'closestIJKAxis', 'useCustomExtents', 'renderToRectangle', 'sliceAtFocalPoint']);
460
- macro.setGetArray(publicAPI, model, ['customDisplayExtent'], 4);
368
+ macro.setGet(publicAPI, model, ['closestIJKAxis', 'renderToRectangle', 'sliceAtFocalPoint']);
461
369
  CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model); // Object methods
462
370
 
463
371
  vtkImageMapper(publicAPI, model);
@@ -0,0 +1,16 @@
1
+ export declare enum States {
2
+ IS_START = 0,
3
+ IS_NONE = 0,
4
+ IS_ROTATE = 1,
5
+ IS_PAN = 2,
6
+ IS_SPIN = 3,
7
+ IS_DOLLY = 4,
8
+ IS_CAMERA_POSE = 11,
9
+ IS_WINDOW_LEVEL = 1024,
10
+ IS_SLICE = 1025,
11
+ }
12
+
13
+ declare const _default: {
14
+ States: States;
15
+ };
16
+ export default _default;