@kitware/vtk.js 20.1.4 → 20.2.3
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/Base64.d.ts +14 -2
- package/Common/Core/Base64.js +31 -2
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.d.ts +168 -158
- package/Common/Core/Math.js +1 -1
- package/Common/Core/MatrixBuilder.js +39 -41
- package/Common/DataModel/Box.d.ts +73 -0
- package/Common/DataModel/ImageData.js +12 -14
- package/Common/Transform/LandmarkTransform.js +6 -7
- package/Filters/General/PaintFilter/PaintFilter.worker.js +8 -8
- package/Filters/General/PaintFilter.js +11 -11
- package/Filters/Sources/CubeSource.d.ts +7 -6
- package/Filters/Sources/PlaneSource.js +12 -13
- package/IO/Core/BinaryHelper.js +2 -4
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +2 -2
- package/IO/Core/ZipMultiDataSetReader.js +1 -1
- package/IO/Core/ZipMultiDataSetWriter.js +1 -1
- package/IO/Geometry/STLWriter.js +4 -4
- package/IO/Misc/OBJReader.d.ts +9 -8
- package/IO/Misc/SkyboxReader.js +1 -1
- package/IO/XML/XMLReader.js +3 -4
- package/IO/XML/XMLWriter.js +5 -6
- package/Imaging/Core/ImageReslice.js +18 -19
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +27 -28
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +8 -9
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +14 -15
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +12 -13
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +5 -6
- package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +8 -9
- package/Rendering/Core/Actor.js +3 -4
- package/Rendering/Core/AnnotatedCubeActor.d.ts +5 -6
- package/Rendering/Core/Camera.js +81 -84
- package/Rendering/Core/CellPicker.js +2 -2
- package/Rendering/Core/CubeAxesActor.js +37 -34
- package/Rendering/Core/Follower.js +20 -21
- package/Rendering/Core/Glyph3DMapper.js +30 -32
- package/Rendering/Core/ImageMapper.js +2 -2
- package/Rendering/Core/ImageSlice.js +5 -6
- package/Rendering/Core/Picker.d.ts +5 -5
- package/Rendering/Core/Picker.js +5 -6
- package/Rendering/Core/PixelSpaceCallbackMapper.js +3 -4
- package/Rendering/Core/Prop3D.js +24 -25
- package/Rendering/Core/Renderer.js +11 -12
- package/Rendering/Core/ScalarBarActor.js +37 -34
- package/Rendering/Core/Volume.js +3 -4
- package/Rendering/OpenGL/Actor.js +9 -10
- package/Rendering/OpenGL/Camera.js +8 -9
- package/Rendering/OpenGL/CellArrayBufferObject.js +6 -8
- package/Rendering/OpenGL/Glyph3DMapper.js +8 -9
- package/Rendering/OpenGL/ImageMapper.js +7 -7
- package/Rendering/OpenGL/ImageSlice.js +4 -4
- package/Rendering/OpenGL/PolyDataMapper.js +11 -13
- package/Rendering/OpenGL/RenderWindow.d.ts +21 -35
- package/Rendering/OpenGL/ShaderCache.js +1 -1
- package/Rendering/OpenGL/Skybox.js +4 -5
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +3 -4
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -1
- package/Rendering/OpenGL/Volume.js +6 -7
- package/Rendering/OpenGL/VolumeMapper.js +47 -49
- package/Rendering/OpenGL/glsl/vtkPolyDataFS.glsl.js +1 -1
- package/Rendering/WebGPU/Actor.js +8 -8
- package/Rendering/WebGPU/Camera.js +8 -8
- package/Rendering/WebGPU/ImageMapper.js +18 -19
- package/Rendering/WebGPU/ImageSlice.js +9 -9
- package/Rendering/WebGPU/PolyDataMapper.js +3 -4
- package/Rendering/WebGPU/Renderer.js +6 -7
- package/Rendering/WebGPU/Volume.js +3 -3
- package/Rendering/WebGPU/VolumePassFSQ.js +10 -10
- package/ThirdParty/index.js +2 -2
- package/Widgets/Manipulators/TrackballManipulator.js +5 -6
- package/Widgets/Representations/ArrowHandleRepresentation.js +10 -12
- package/Widgets/Representations/CircleContextRepresentation.js +4 -5
- package/Widgets/Representations/RectangleContextRepresentation.js +3 -3
- package/Widgets/Widgets3D/EllipseWidget/behavior.js +5 -5
- package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +6 -8
- package/Widgets/Widgets3D/PaintWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/ResliceCursorWidget.js +6 -7
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +10 -10
- package/Widgets/Widgets3D/SplineWidget/behavior.js +5 -5
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/package.json +2 -2
- package/types.d.ts +1 -0
- package/vtk.js +2 -2
- package/_vendor/base64-js/index.js_commonjs-exports.js +0 -1
- package/_vendor/blueimp-md5/js/md5.js_commonjs-module.js +0 -3
- package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/implementation.browser.js_commonjs-module.js +0 -3
- package/_vendor/globalthis/implementation.browser.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/shim.js_commonjs-proxy.js +0 -2
- package/_vendor/jszip/dist/jszip.min.js_commonjs-module.js +0 -3
- package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/alea.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/alea.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/tychei.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xor128.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xor4096.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xorwow.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/seedrandom.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/seedrandom.js_commonjs-proxy.js +0 -1
- package/_vendor/webworker-promise/lib/register.js_commonjs-module.js +0 -3
- package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy.js +0 -1
- package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy.js +0 -1
- package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module.js +0 -3
- package/_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js +0 -6
- package/_virtual/commonjsHelpers.js +0 -22
- package/_virtual/polyfill-node.buffer.js +0 -1971
- package/_virtual/polyfill-node.global.js +0 -5
- package/_virtual/rollup_plugin_ignore_empty_module_placeholder.js +0 -8
- package/vendor/base64-js/index.js +0 -72
- package/vendor/blueimp-md5/js/md5.js +0 -402
- package/vendor/d3-array/src/array.js +0 -1
- package/vendor/d3-array/src/ascending.js +0 -5
- package/vendor/d3-array/src/bin.js +0 -1
- package/vendor/d3-array/src/bisect.js +0 -10
- package/vendor/d3-array/src/bisector.js +0 -46
- package/vendor/d3-array/src/constant.js +0 -1
- package/vendor/d3-array/src/count.js +0 -1
- package/vendor/d3-array/src/cross.js +0 -1
- package/vendor/d3-array/src/cumsum.js +0 -1
- package/vendor/d3-array/src/descending.js +0 -1
- package/vendor/d3-array/src/deviation.js +0 -1
- package/vendor/d3-array/src/difference.js +0 -1
- package/vendor/d3-array/src/disjoint.js +0 -1
- package/vendor/d3-array/src/every.js +0 -1
- package/vendor/d3-array/src/extent.js +0 -1
- package/vendor/d3-array/src/filter.js +0 -1
- package/vendor/d3-array/src/fsum.js +0 -1
- package/vendor/d3-array/src/greatest.js +0 -1
- package/vendor/d3-array/src/greatestIndex.js +0 -1
- package/vendor/d3-array/src/group.js +0 -1
- package/vendor/d3-array/src/groupSort.js +0 -1
- package/vendor/d3-array/src/identity.js +0 -1
- package/vendor/d3-array/src/index.js +0 -1
- package/vendor/d3-array/src/intersection.js +0 -1
- package/vendor/d3-array/src/least.js +0 -1
- package/vendor/d3-array/src/leastIndex.js +0 -1
- package/vendor/d3-array/src/map.js +0 -1
- package/vendor/d3-array/src/max.js +0 -1
- package/vendor/d3-array/src/maxIndex.js +0 -1
- package/vendor/d3-array/src/mean.js +0 -1
- package/vendor/d3-array/src/median.js +0 -1
- package/vendor/d3-array/src/merge.js +0 -1
- package/vendor/d3-array/src/min.js +0 -1
- package/vendor/d3-array/src/minIndex.js +0 -1
- package/vendor/d3-array/src/mode.js +0 -1
- package/vendor/d3-array/src/nice.js +0 -1
- package/vendor/d3-array/src/number.js +0 -5
- package/vendor/d3-array/src/pairs.js +0 -1
- package/vendor/d3-array/src/permute.js +0 -1
- package/vendor/d3-array/src/quantile.js +0 -1
- package/vendor/d3-array/src/quickselect.js +0 -1
- package/vendor/d3-array/src/range.js +0 -1
- package/vendor/d3-array/src/reduce.js +0 -1
- package/vendor/d3-array/src/reverse.js +0 -1
- package/vendor/d3-array/src/scan.js +0 -1
- package/vendor/d3-array/src/set.js +0 -1
- package/vendor/d3-array/src/shuffle.js +0 -1
- package/vendor/d3-array/src/some.js +0 -1
- package/vendor/d3-array/src/sort.js +0 -1
- package/vendor/d3-array/src/subset.js +0 -1
- package/vendor/d3-array/src/sum.js +0 -1
- package/vendor/d3-array/src/superset.js +0 -1
- package/vendor/d3-array/src/threshold/freedmanDiaconis.js +0 -1
- package/vendor/d3-array/src/threshold/scott.js +0 -1
- package/vendor/d3-array/src/threshold/sturges.js +0 -1
- package/vendor/d3-array/src/ticks.js +0 -56
- package/vendor/d3-array/src/transpose.js +0 -1
- package/vendor/d3-array/src/union.js +0 -1
- package/vendor/d3-array/src/variance.js +0 -1
- package/vendor/d3-array/src/zip.js +0 -1
- package/vendor/d3-color/src/color.js +0 -373
- package/vendor/d3-color/src/cubehelix.js +0 -1
- package/vendor/d3-color/src/define.js +0 -12
- package/vendor/d3-color/src/index.js +0 -1
- package/vendor/d3-color/src/lab.js +0 -1
- package/vendor/d3-color/src/math.js +0 -1
- package/vendor/d3-format/src/defaultLocale.js +0 -20
- package/vendor/d3-format/src/exponent.js +0 -7
- package/vendor/d3-format/src/formatDecimal.js +0 -22
- package/vendor/d3-format/src/formatGroup.js +0 -20
- package/vendor/d3-format/src/formatNumerals.js +0 -9
- package/vendor/d3-format/src/formatPrefixAuto.js +0 -18
- package/vendor/d3-format/src/formatRounded.js +0 -13
- package/vendor/d3-format/src/formatSpecifier.js +0 -49
- package/vendor/d3-format/src/formatTrim.js +0 -13
- package/vendor/d3-format/src/formatTypes.js +0 -21
- package/vendor/d3-format/src/identity.js +0 -5
- package/vendor/d3-format/src/index.js +0 -1
- package/vendor/d3-format/src/locale.js +0 -150
- package/vendor/d3-format/src/precisionFixed.js +0 -7
- package/vendor/d3-format/src/precisionPrefix.js +0 -7
- package/vendor/d3-format/src/precisionRound.js +0 -8
- package/vendor/d3-interpolate/src/array.js +0 -19
- package/vendor/d3-interpolate/src/basis.js +0 -1
- package/vendor/d3-interpolate/src/basisClosed.js +0 -1
- package/vendor/d3-interpolate/src/color.js +0 -26
- package/vendor/d3-interpolate/src/constant.js +0 -3
- package/vendor/d3-interpolate/src/cubehelix.js +0 -1
- package/vendor/d3-interpolate/src/date.js +0 -8
- package/vendor/d3-interpolate/src/discrete.js +0 -1
- package/vendor/d3-interpolate/src/hcl.js +0 -1
- package/vendor/d3-interpolate/src/hsl.js +0 -1
- package/vendor/d3-interpolate/src/hue.js +0 -1
- package/vendor/d3-interpolate/src/index.js +0 -1
- package/vendor/d3-interpolate/src/lab.js +0 -1
- package/vendor/d3-interpolate/src/number.js +0 -7
- package/vendor/d3-interpolate/src/numberArray.js +0 -16
- package/vendor/d3-interpolate/src/object.js +0 -25
- package/vendor/d3-interpolate/src/piecewise.js +0 -1
- package/vendor/d3-interpolate/src/quantize.js +0 -1
- package/vendor/d3-interpolate/src/rgb.js +0 -26
- package/vendor/d3-interpolate/src/round.js +0 -7
- package/vendor/d3-interpolate/src/string.js +0 -66
- package/vendor/d3-interpolate/src/transform/decompose.js +0 -1
- package/vendor/d3-interpolate/src/transform/index.js +0 -1
- package/vendor/d3-interpolate/src/transform/parse.js +0 -1
- package/vendor/d3-interpolate/src/value.js +0 -24
- package/vendor/d3-interpolate/src/zoom.js +0 -1
- package/vendor/d3-scale/src/band.js +0 -1
- package/vendor/d3-scale/src/constant.js +0 -7
- package/vendor/d3-scale/src/continuous.js +0 -129
- package/vendor/d3-scale/src/diverging.js +0 -1
- package/vendor/d3-scale/src/identity.js +0 -1
- package/vendor/d3-scale/src/index.js +0 -1
- package/vendor/d3-scale/src/init.js +0 -10
- package/vendor/d3-scale/src/linear.js +0 -72
- package/vendor/d3-scale/src/log.js +0 -1
- package/vendor/d3-scale/src/nice.js +0 -1
- package/vendor/d3-scale/src/number.js +0 -5
- package/vendor/d3-scale/src/ordinal.js +0 -1
- package/vendor/d3-scale/src/pow.js +0 -1
- package/vendor/d3-scale/src/quantile.js +0 -1
- package/vendor/d3-scale/src/quantize.js +0 -1
- package/vendor/d3-scale/src/radial.js +0 -1
- package/vendor/d3-scale/src/sequential.js +0 -1
- package/vendor/d3-scale/src/sequentialQuantile.js +0 -1
- package/vendor/d3-scale/src/symlog.js +0 -1
- package/vendor/d3-scale/src/threshold.js +0 -1
- package/vendor/d3-scale/src/tickFormat.js +0 -35
- package/vendor/d3-scale/src/time.js +0 -1
- package/vendor/d3-scale/src/utcTime.js +0 -1
- package/vendor/d3-time/src/day.js +0 -1
- package/vendor/d3-time/src/duration.js +0 -1
- package/vendor/d3-time/src/hour.js +0 -1
- package/vendor/d3-time/src/index.js +0 -1
- package/vendor/d3-time/src/interval.js +0 -1
- package/vendor/d3-time/src/millisecond.js +0 -1
- package/vendor/d3-time/src/minute.js +0 -1
- package/vendor/d3-time/src/month.js +0 -1
- package/vendor/d3-time/src/second.js +0 -1
- package/vendor/d3-time/src/ticks.js +0 -1
- package/vendor/d3-time/src/utcDay.js +0 -1
- package/vendor/d3-time/src/utcHour.js +0 -1
- package/vendor/d3-time/src/utcMinute.js +0 -1
- package/vendor/d3-time/src/utcMonth.js +0 -1
- package/vendor/d3-time/src/utcWeek.js +0 -1
- package/vendor/d3-time/src/utcYear.js +0 -1
- package/vendor/d3-time/src/week.js +0 -1
- package/vendor/d3-time/src/year.js +0 -1
- package/vendor/d3-time-format/src/defaultLocale.js +0 -1
- package/vendor/d3-time-format/src/index.js +0 -1
- package/vendor/d3-time-format/src/isoFormat.js +0 -1
- package/vendor/d3-time-format/src/isoParse.js +0 -1
- package/vendor/d3-time-format/src/locale.js +0 -1
- package/vendor/define-properties/index.js +0 -60
- package/vendor/gl-matrix/esm/common.js +0 -30
- package/vendor/gl-matrix/esm/index.js +0 -1
- package/vendor/gl-matrix/esm/mat2.js +0 -1
- package/vendor/gl-matrix/esm/mat2d.js +0 -1
- package/vendor/gl-matrix/esm/mat3.js +0 -817
- package/vendor/gl-matrix/esm/mat4.js +0 -1868
- package/vendor/gl-matrix/esm/quat.js +0 -330
- package/vendor/gl-matrix/esm/quat2.js +0 -1
- package/vendor/gl-matrix/esm/vec2.js +0 -1
- package/vendor/gl-matrix/esm/vec3.js +0 -842
- package/vendor/gl-matrix/esm/vec4.js +0 -153
- package/vendor/globalthis/implementation.browser.js +0 -11
- package/vendor/globalthis/index.js +0 -25
- package/vendor/globalthis/polyfill.js +0 -14
- package/vendor/globalthis/shim.js +0 -25
- package/vendor/internmap/src/index.js +0 -1
- package/vendor/jszip/dist/jszip.min.js +0 -11
- package/vendor/object-keys/implementation.js +0 -124
- package/vendor/object-keys/index.js +0 -35
- package/vendor/object-keys/isArguments.js +0 -17
- package/vendor/pako/dist/pako.esm.mjs.js +0 -6707
- package/vendor/seedrandom/index.js +0 -77
- package/vendor/seedrandom/lib/alea.js +0 -117
- package/vendor/seedrandom/lib/tychei.js +0 -105
- package/vendor/seedrandom/lib/xor128.js +0 -84
- package/vendor/seedrandom/lib/xor4096.js +0 -150
- package/vendor/seedrandom/lib/xorshift7.js +0 -101
- package/vendor/seedrandom/lib/xorwow.js +0 -89
- package/vendor/seedrandom/seedrandom.js +0 -256
- package/vendor/webworker-promise/lib/register.js +0 -158
- package/vendor/webworker-promise/lib/tiny-emitter.js +0 -89
- package/vendor/webworker-promise/src/index.js +0 -110
- package/vendor/webworker-promise/src/tiny-emitter.js +0 -51
- package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +0 -13
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
3
3
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
4
|
-
import {
|
|
5
|
-
import { i as identity, f as fromRotation, m as multiply, r as rotate, a as rotateX, b as rotateY, c as rotateZ, t as translate, s as scale, d as copy } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
6
|
-
import { s as set, n as normalize, d as dot, c as cross, l as length, v as vec3, t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
4
|
+
import { mat4, vec3, glMatrix } from 'gl-matrix';
|
|
7
5
|
import { a as areMatricesEqual } from './Math/index.js';
|
|
8
6
|
|
|
9
7
|
var NoOp = function NoOp(v) {
|
|
10
8
|
return v;
|
|
11
9
|
};
|
|
12
10
|
|
|
13
|
-
var IDENTITY = identity(new Float64Array(16));
|
|
11
|
+
var IDENTITY = mat4.identity(new Float64Array(16));
|
|
14
12
|
var EPSILON = 1e-6;
|
|
15
13
|
|
|
16
14
|
var Transform = /*#__PURE__*/function () {
|
|
@@ -19,9 +17,9 @@ var Transform = /*#__PURE__*/function () {
|
|
|
19
17
|
|
|
20
18
|
_classCallCheck(this, Transform);
|
|
21
19
|
|
|
22
|
-
this.matrix = identity(new Float64Array(16));
|
|
20
|
+
this.matrix = mat4.identity(new Float64Array(16));
|
|
23
21
|
this.tmp = new Float64Array(3);
|
|
24
|
-
this.angleConv = useDegree ? toRadian : NoOp;
|
|
22
|
+
this.angleConv = useDegree ? glMatrix.toRadian : NoOp;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
_createClass(Transform, [{
|
|
@@ -30,82 +28,82 @@ var Transform = /*#__PURE__*/function () {
|
|
|
30
28
|
var src = new Float64Array(3);
|
|
31
29
|
var dst = new Float64Array(3);
|
|
32
30
|
var transf = new Float64Array(16);
|
|
33
|
-
set(src, originDirection[0], originDirection[1], originDirection[2]);
|
|
34
|
-
set(dst, targetDirection[0], targetDirection[1], targetDirection[2]);
|
|
35
|
-
normalize(src, src);
|
|
36
|
-
normalize(dst, dst);
|
|
37
|
-
var cosAlpha = dot(src, dst);
|
|
31
|
+
vec3.set(src, originDirection[0], originDirection[1], originDirection[2]);
|
|
32
|
+
vec3.set(dst, targetDirection[0], targetDirection[1], targetDirection[2]);
|
|
33
|
+
vec3.normalize(src, src);
|
|
34
|
+
vec3.normalize(dst, dst);
|
|
35
|
+
var cosAlpha = vec3.dot(src, dst);
|
|
38
36
|
|
|
39
37
|
if (cosAlpha >= 1) {
|
|
40
38
|
return this;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
cross(this.tmp, src, dst);
|
|
41
|
+
vec3.cross(this.tmp, src, dst);
|
|
44
42
|
|
|
45
|
-
if (length(this.tmp) < EPSILON) {
|
|
43
|
+
if (vec3.length(this.tmp) < EPSILON) {
|
|
46
44
|
// cross product is 0, so pick arbitrary axis perpendicular
|
|
47
45
|
// to originDirection.
|
|
48
|
-
cross(this.tmp, [1, 0, 0], originDirection);
|
|
46
|
+
vec3.cross(this.tmp, [1, 0, 0], originDirection);
|
|
49
47
|
|
|
50
|
-
if (length(this.tmp) < EPSILON) {
|
|
51
|
-
cross(this.tmp, [0, 1, 0], originDirection);
|
|
48
|
+
if (vec3.length(this.tmp) < EPSILON) {
|
|
49
|
+
vec3.cross(this.tmp, [0, 1, 0], originDirection);
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
fromRotation(transf, Math.acos(cosAlpha), this.tmp);
|
|
56
|
-
multiply(this.matrix, this.matrix, transf);
|
|
53
|
+
mat4.fromRotation(transf, Math.acos(cosAlpha), this.tmp);
|
|
54
|
+
mat4.multiply(this.matrix, this.matrix, transf);
|
|
57
55
|
return this;
|
|
58
56
|
}
|
|
59
57
|
}, {
|
|
60
58
|
key: "rotate",
|
|
61
|
-
value: function rotate
|
|
62
|
-
set.apply(vec3, [this.tmp].concat(_toConsumableArray(axis)));
|
|
63
|
-
normalize(this.tmp, this.tmp);
|
|
64
|
-
rotate(this.matrix, this.matrix, this.angleConv(angle), this.tmp);
|
|
59
|
+
value: function rotate(angle, axis) {
|
|
60
|
+
vec3.set.apply(vec3, [this.tmp].concat(_toConsumableArray(axis)));
|
|
61
|
+
vec3.normalize(this.tmp, this.tmp);
|
|
62
|
+
mat4.rotate(this.matrix, this.matrix, this.angleConv(angle), this.tmp);
|
|
65
63
|
return this;
|
|
66
64
|
}
|
|
67
65
|
}, {
|
|
68
66
|
key: "rotateX",
|
|
69
|
-
value: function rotateX
|
|
70
|
-
rotateX(this.matrix, this.matrix, this.angleConv(angle));
|
|
67
|
+
value: function rotateX(angle) {
|
|
68
|
+
mat4.rotateX(this.matrix, this.matrix, this.angleConv(angle));
|
|
71
69
|
return this;
|
|
72
70
|
}
|
|
73
71
|
}, {
|
|
74
72
|
key: "rotateY",
|
|
75
|
-
value: function rotateY
|
|
76
|
-
rotateY(this.matrix, this.matrix, this.angleConv(angle));
|
|
73
|
+
value: function rotateY(angle) {
|
|
74
|
+
mat4.rotateY(this.matrix, this.matrix, this.angleConv(angle));
|
|
77
75
|
return this;
|
|
78
76
|
}
|
|
79
77
|
}, {
|
|
80
78
|
key: "rotateZ",
|
|
81
|
-
value: function rotateZ
|
|
82
|
-
rotateZ(this.matrix, this.matrix, this.angleConv(angle));
|
|
79
|
+
value: function rotateZ(angle) {
|
|
80
|
+
mat4.rotateZ(this.matrix, this.matrix, this.angleConv(angle));
|
|
83
81
|
return this;
|
|
84
82
|
}
|
|
85
83
|
}, {
|
|
86
84
|
key: "translate",
|
|
87
|
-
value: function translate
|
|
88
|
-
set(this.tmp, x, y, z);
|
|
89
|
-
translate(this.matrix, this.matrix, this.tmp);
|
|
85
|
+
value: function translate(x, y, z) {
|
|
86
|
+
vec3.set(this.tmp, x, y, z);
|
|
87
|
+
mat4.translate(this.matrix, this.matrix, this.tmp);
|
|
90
88
|
return this;
|
|
91
89
|
}
|
|
92
90
|
}, {
|
|
93
91
|
key: "scale",
|
|
94
|
-
value: function scale
|
|
95
|
-
set(this.tmp, sx, sy, sz);
|
|
96
|
-
scale(this.matrix, this.matrix, this.tmp);
|
|
92
|
+
value: function scale(sx, sy, sz) {
|
|
93
|
+
vec3.set(this.tmp, sx, sy, sz);
|
|
94
|
+
mat4.scale(this.matrix, this.matrix, this.tmp);
|
|
97
95
|
return this;
|
|
98
96
|
}
|
|
99
97
|
}, {
|
|
100
98
|
key: "multiply",
|
|
101
|
-
value: function multiply
|
|
102
|
-
multiply(this.matrix, this.matrix, mat4x4);
|
|
99
|
+
value: function multiply(mat4x4) {
|
|
100
|
+
mat4.multiply(this.matrix, this.matrix, mat4x4);
|
|
103
101
|
return this;
|
|
104
102
|
}
|
|
105
103
|
}, {
|
|
106
104
|
key: "identity",
|
|
107
|
-
value: function identity
|
|
108
|
-
identity(this.matrix);
|
|
105
|
+
value: function identity() {
|
|
106
|
+
mat4.identity(this.matrix);
|
|
109
107
|
return this;
|
|
110
108
|
} //-----------
|
|
111
109
|
|
|
@@ -123,8 +121,8 @@ var Transform = /*#__PURE__*/function () {
|
|
|
123
121
|
var size = nbIterations === -1 ? typedArray.length : offset + nbIterations * 3;
|
|
124
122
|
|
|
125
123
|
for (var i = offset; i < size; i += 3) {
|
|
126
|
-
set(this.tmp, typedArray[i], typedArray[i + 1], typedArray[i + 2]);
|
|
127
|
-
transformMat4(this.tmp, this.tmp, this.matrix);
|
|
124
|
+
vec3.set(this.tmp, typedArray[i], typedArray[i + 1], typedArray[i + 2]);
|
|
125
|
+
vec3.transformMat4(this.tmp, this.tmp, this.matrix);
|
|
128
126
|
typedArray[i] = this.tmp[0];
|
|
129
127
|
typedArray[i + 1] = this.tmp[1];
|
|
130
128
|
typedArray[i + 2] = this.tmp[2];
|
|
@@ -142,7 +140,7 @@ var Transform = /*#__PURE__*/function () {
|
|
|
142
140
|
key: "setMatrix",
|
|
143
141
|
value: function setMatrix(mat4x4) {
|
|
144
142
|
if (!!mat4x4 && mat4x4.length === 16) {
|
|
145
|
-
copy(this.matrix, mat4x4);
|
|
143
|
+
mat4.copy(this.matrix, mat4x4);
|
|
146
144
|
}
|
|
147
145
|
|
|
148
146
|
return this;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { vtkObject } from '@kitware/vtk.js/interfaces' ;
|
|
2
|
+
import { Bounds, Point } from '@kitware/vtk.js/types';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IBoxInitialValues {
|
|
6
|
+
bbox?: Bounds;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface vtkBox extends vtkObject {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Add the bounds for the box.
|
|
13
|
+
* @param {Bounds} bounds
|
|
14
|
+
*/
|
|
15
|
+
addBounds(bounds: Bounds): void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param other
|
|
20
|
+
*/
|
|
21
|
+
addBox(other: any): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param {Point} x The point coordinate.
|
|
26
|
+
*/
|
|
27
|
+
evaluateFunction(x: Point): number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param {Number} x The x coordinate.
|
|
32
|
+
* @param {Number} y The y coordinate.
|
|
33
|
+
* @param {Number} z The z coordinate.
|
|
34
|
+
*/
|
|
35
|
+
evaluateFunction(x: number, y: number, z: number ): number;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get the bounds for the box.
|
|
39
|
+
*/
|
|
40
|
+
getBounds(): Bounds;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Set the bounds for the box.
|
|
44
|
+
* @param {Bounds} bounds The bounds for the box.
|
|
45
|
+
*/
|
|
46
|
+
setBounds(bounds: Bounds): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Method used to decorate a given object (publicAPI+model) with vtkBox characteristics.
|
|
51
|
+
*
|
|
52
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
53
|
+
* @param model object on which data structure will be bounds (protected)
|
|
54
|
+
* @param {IBoxInitialValues} [initialValues] (default: {})
|
|
55
|
+
*/
|
|
56
|
+
export function extend(publicAPI: object, model: object, initialValues?: IBoxInitialValues): void;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Method used to create a new instance of vtkBox.
|
|
60
|
+
* @param {IBoxInitialValues} [initialValues] for pre-setting some of its content
|
|
61
|
+
*/
|
|
62
|
+
export function newInstance(initialValues?: IBoxInitialValues): vtkBox;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* vtkBox provides methods for creating a 1D cubic spline object from given
|
|
66
|
+
* parameters, and allows for the calculation of the spline value and derivative
|
|
67
|
+
* at any given point inside the spline intervals.
|
|
68
|
+
*/
|
|
69
|
+
export declare const vtkBox: {
|
|
70
|
+
newInstance: typeof newInstance,
|
|
71
|
+
extend: typeof extend
|
|
72
|
+
};
|
|
73
|
+
export default vtkBox;
|
|
@@ -5,9 +5,7 @@ import vtkBoundingBox from './BoundingBox.js';
|
|
|
5
5
|
import vtkDataSet from './DataSet.js';
|
|
6
6
|
import vtkStructuredData from './StructuredData.js';
|
|
7
7
|
import { StructuredType } from './StructuredData/Constants.js';
|
|
8
|
-
import {
|
|
9
|
-
import { s as set, t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
10
|
-
import { e as fromTranslation, s as scale, g as invert } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
8
|
+
import { mat3, vec3, mat4 } from 'gl-matrix';
|
|
11
9
|
|
|
12
10
|
var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
|
|
13
11
|
// vtkImageData methods
|
|
@@ -205,7 +203,7 @@ function vtkImageData(publicAPI, model) {
|
|
|
205
203
|
var bounds = [vout[0], vout[0], vout[1], vout[1], vout[2], vout[2]];
|
|
206
204
|
|
|
207
205
|
for (var i = 3; i < 24; i += 3) {
|
|
208
|
-
set(idx, corners[i], corners[i + 1], corners[i + 2]);
|
|
206
|
+
vec3.set(idx, corners[i], corners[i + 1], corners[i + 2]);
|
|
209
207
|
publicAPI.indexToWorld(idx, vout);
|
|
210
208
|
|
|
211
209
|
if (vout[0] < bounds[0]) {
|
|
@@ -238,7 +236,7 @@ function vtkImageData(publicAPI, model) {
|
|
|
238
236
|
|
|
239
237
|
|
|
240
238
|
publicAPI.computeTransforms = function () {
|
|
241
|
-
fromTranslation(model.indexToWorld, model.origin);
|
|
239
|
+
mat4.fromTranslation(model.indexToWorld, model.origin);
|
|
242
240
|
model.indexToWorld[0] = model.direction[0];
|
|
243
241
|
model.indexToWorld[1] = model.direction[1];
|
|
244
242
|
model.indexToWorld[2] = model.direction[2];
|
|
@@ -248,8 +246,8 @@ function vtkImageData(publicAPI, model) {
|
|
|
248
246
|
model.indexToWorld[8] = model.direction[6];
|
|
249
247
|
model.indexToWorld[9] = model.direction[7];
|
|
250
248
|
model.indexToWorld[10] = model.direction[8];
|
|
251
|
-
scale(model.indexToWorld, model.indexToWorld, model.spacing);
|
|
252
|
-
invert(model.worldToIndex, model.indexToWorld);
|
|
249
|
+
mat4.scale(model.indexToWorld, model.indexToWorld, model.spacing);
|
|
250
|
+
mat4.invert(model.worldToIndex, model.indexToWorld);
|
|
253
251
|
}; //
|
|
254
252
|
// The direction matrix is a 3x3 basis for the I, J, K axes
|
|
255
253
|
// of the image. The rows of the matrix correspond to the
|
|
@@ -303,7 +301,7 @@ function vtkImageData(publicAPI, model) {
|
|
|
303
301
|
|
|
304
302
|
publicAPI.indexToWorld = function (ain) {
|
|
305
303
|
var aout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
306
|
-
transformMat4(aout, ain, model.indexToWorld);
|
|
304
|
+
vec3.transformMat4(aout, ain, model.indexToWorld);
|
|
307
305
|
return aout;
|
|
308
306
|
};
|
|
309
307
|
|
|
@@ -311,7 +309,7 @@ function vtkImageData(publicAPI, model) {
|
|
|
311
309
|
|
|
312
310
|
publicAPI.worldToIndex = function (ain) {
|
|
313
311
|
var aout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
314
|
-
transformMat4(aout, ain, model.worldToIndex);
|
|
312
|
+
vec3.transformMat4(aout, ain, model.worldToIndex);
|
|
315
313
|
return aout;
|
|
316
314
|
};
|
|
317
315
|
|
|
@@ -324,8 +322,8 @@ function vtkImageData(publicAPI, model) {
|
|
|
324
322
|
vtkBoundingBox.computeCornerPoints(bin, in1, in2);
|
|
325
323
|
var out1 = [0, 0, 0];
|
|
326
324
|
var out2 = [0, 0, 0];
|
|
327
|
-
transformMat4(out1, in1, model.indexToWorld);
|
|
328
|
-
transformMat4(out2, in2, model.indexToWorld);
|
|
325
|
+
vec3.transformMat4(out1, in1, model.indexToWorld);
|
|
326
|
+
vec3.transformMat4(out2, in2, model.indexToWorld);
|
|
329
327
|
return computeBoundsFromPoints(out1, out2, bout);
|
|
330
328
|
};
|
|
331
329
|
|
|
@@ -336,8 +334,8 @@ function vtkImageData(publicAPI, model) {
|
|
|
336
334
|
vtkBoundingBox.computeCornerPoints(bin, in1, in2);
|
|
337
335
|
var out1 = [0, 0, 0];
|
|
338
336
|
var out2 = [0, 0, 0];
|
|
339
|
-
transformMat4(out1, in1, model.worldToIndex);
|
|
340
|
-
transformMat4(out2, in2, model.worldToIndex);
|
|
337
|
+
vec3.transformMat4(out1, in1, model.worldToIndex);
|
|
338
|
+
vec3.transformMat4(out2, in2, model.worldToIndex);
|
|
341
339
|
return computeBoundsFromPoints(out1, out2, bout);
|
|
342
340
|
}; // Make sure the transform is correct
|
|
343
341
|
|
|
@@ -513,7 +511,7 @@ function extend(publicAPI, model) {
|
|
|
513
511
|
vtkDataSet.extend(publicAPI, model, initialValues);
|
|
514
512
|
|
|
515
513
|
if (!model.direction) {
|
|
516
|
-
model.direction = identity(new Float64Array(9));
|
|
514
|
+
model.direction = mat3.identity(new Float64Array(9));
|
|
517
515
|
} else if (Array.isArray(model.direction)) {
|
|
518
516
|
model.direction = new Float64Array(model.direction.slice(0, 9));
|
|
519
517
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { mat4, mat3 } from 'gl-matrix';
|
|
2
3
|
import Constants from './LandmarkTransform/Constants.js';
|
|
3
4
|
import macro from '../../macros.js';
|
|
4
5
|
import { o as jacobiN, p as perpendiculars } from '../Core/Math/index.js';
|
|
5
|
-
import { i as identity } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
6
|
-
import { a as invert, m as multiply } from '../../vendor/gl-matrix/esm/mat3.js';
|
|
7
6
|
|
|
8
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9
8
|
|
|
@@ -30,7 +29,7 @@ function vtkLandmarkTransform(publicAPI, model) {
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
function update() {
|
|
33
|
-
identity(model.matrix);
|
|
32
|
+
mat4.identity(model.matrix);
|
|
34
33
|
var N_PTS = model.sourceLandmark.getNumberOfPoints();
|
|
35
34
|
|
|
36
35
|
if (model.targetLandmark.getNumberOfPoints() !== N_PTS || model.sourceLandmark === null || model.targetLandmark === null || N_PTS === 0) {
|
|
@@ -62,7 +61,7 @@ function vtkLandmarkTransform(publicAPI, model) {
|
|
|
62
61
|
targetCentroid[2] /= N_PTS; // -- if only one point, stop right here
|
|
63
62
|
|
|
64
63
|
if (N_PTS === 1) {
|
|
65
|
-
identity(model.matrix);
|
|
64
|
+
mat4.identity(model.matrix);
|
|
66
65
|
model.matrix.elem[12] = targetCentroid[0] - sourceCentroid[0];
|
|
67
66
|
model.matrix.elem[13] = targetCentroid[1] - sourceCentroid[1];
|
|
68
67
|
model.matrix.elem[14] = targetCentroid[2] - sourceCentroid[2];
|
|
@@ -109,9 +108,9 @@ function vtkLandmarkTransform(publicAPI, model) {
|
|
|
109
108
|
|
|
110
109
|
if (model.mode === Mode.AFFINE) {
|
|
111
110
|
// AAT = (a.a^t)^-1
|
|
112
|
-
invert(AAT, AAT); // M = (a.a^t)^-1 . a.b^t
|
|
111
|
+
mat3.invert(AAT, AAT); // M = (a.a^t)^-1 . a.b^t
|
|
113
112
|
|
|
114
|
-
multiply(M, AAT, M); // this->Matrix = M^t
|
|
113
|
+
mat3.multiply(M, AAT, M); // this->Matrix = M^t
|
|
115
114
|
|
|
116
115
|
for (var _i2 = 0; _i2 < 3; ++_i2) {
|
|
117
116
|
for (var j = 0; j < 3; ++j) {
|
|
@@ -276,7 +275,7 @@ function extend(publicAPI, model) {
|
|
|
276
275
|
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
277
276
|
macro.obj(publicAPI, model); // Internal objects initialization
|
|
278
277
|
|
|
279
|
-
model.matrix = identity(new Float64Array(16));
|
|
278
|
+
model.matrix = mat4.identity(new Float64Array(16));
|
|
280
279
|
macro.setGet(publicAPI, model, ['sourceLandmark', 'targetLandmark', 'mode']);
|
|
281
280
|
macro.get(publicAPI, model, ['matrix']);
|
|
282
281
|
vtkLandmarkTransform(publicAPI, model);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
-
import
|
|
3
|
+
import registerWebworker from 'webworker-promise/lib/register';
|
|
4
4
|
import { SlicingMode } from '../../../Rendering/Core/ImageMapper/Constants.js';
|
|
5
|
-
import {
|
|
5
|
+
import { vec3 } from 'gl-matrix';
|
|
6
6
|
|
|
7
7
|
var globals = {
|
|
8
8
|
// single-component labelmap
|
|
@@ -182,14 +182,14 @@ function handlePaintTriangles(_ref4) {
|
|
|
182
182
|
var point2 = triangleList.subarray(9 * i + 6, 9 * i + 9);
|
|
183
183
|
var v1 = [0, 0, 0];
|
|
184
184
|
var v2 = [0, 0, 0];
|
|
185
|
-
subtract(v1, point1, point0);
|
|
186
|
-
subtract(v2, point2, point0);
|
|
185
|
+
vec3.subtract(v1, point1, point0);
|
|
186
|
+
vec3.subtract(v2, point2, point0);
|
|
187
187
|
var step1 = [0, 0, 0];
|
|
188
188
|
var numStep1 = 2 * Math.max(Math.abs(v1[0]), Math.abs(v1[1]), Math.abs(v1[2]));
|
|
189
|
-
scale(step1, v1, 1 / numStep1);
|
|
189
|
+
vec3.scale(step1, v1, 1 / numStep1);
|
|
190
190
|
var step2 = [0, 0, 0];
|
|
191
191
|
var numStep2 = 2 * Math.max(Math.abs(v2[0]), Math.abs(v2[1]), Math.abs(v2[2]));
|
|
192
|
-
scale(step2, v2, 1 / numStep2);
|
|
192
|
+
vec3.scale(step2, v2, 1 / numStep2);
|
|
193
193
|
var jStride = globals.dimensions[0];
|
|
194
194
|
var kStride = globals.dimensions[0] * globals.dimensions[1];
|
|
195
195
|
|
|
@@ -199,8 +199,8 @@ function handlePaintTriangles(_ref4) {
|
|
|
199
199
|
for (var v = 0; v <= maxV + 1; v++) {
|
|
200
200
|
var point = _toConsumableArray(point0);
|
|
201
201
|
|
|
202
|
-
scaleAndAdd(point, point, step1, u);
|
|
203
|
-
scaleAndAdd(point, point, step2, v);
|
|
202
|
+
vec3.scaleAndAdd(point, point, step1, u);
|
|
203
|
+
vec3.scaleAndAdd(point, point, step2, v);
|
|
204
204
|
point[0] = Math.round(point[0]);
|
|
205
205
|
point[1] = Math.round(point[1]);
|
|
206
206
|
point[2] = Math.round(point[2]);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import {
|
|
2
|
+
import { vec3 } from 'gl-matrix';
|
|
3
|
+
import WebworkerPromise from 'webworker-promise';
|
|
3
4
|
import macro from '../../macros.js';
|
|
4
5
|
import vtkImageData from '../../Common/DataModel/ImageData.js';
|
|
5
6
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
6
7
|
import vtkPolygon from '../../Common/DataModel/Polygon.js';
|
|
7
8
|
import { W as WorkerFactory } from '../../_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js';
|
|
8
|
-
import { t as transformMat4, a as subtract } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
9
9
|
|
|
10
10
|
var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
|
|
11
11
|
// vtkPaintFilter methods
|
|
@@ -41,7 +41,7 @@ function vtkPaintFilter(publicAPI, model) {
|
|
|
41
41
|
if (model.labelMap) {
|
|
42
42
|
if (!workerPromise) {
|
|
43
43
|
worker = new WorkerFactory();
|
|
44
|
-
workerPromise = new
|
|
44
|
+
workerPromise = new WebworkerPromise(worker);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
workerPromise.exec('start', {
|
|
@@ -123,7 +123,7 @@ function vtkPaintFilter(publicAPI, model) {
|
|
|
123
123
|
if (workerPromise) {
|
|
124
124
|
var worldPt = [point[0], point[1], point[2]];
|
|
125
125
|
var indexPt = [0, 0, 0];
|
|
126
|
-
transformMat4(indexPt, worldPt, model.maskWorldToIndex);
|
|
126
|
+
vec3.transformMat4(indexPt, worldPt, model.maskWorldToIndex);
|
|
127
127
|
indexPt[0] = Math.round(indexPt[0]);
|
|
128
128
|
indexPt[1] = Math.round(indexPt[1]);
|
|
129
129
|
indexPt[2] = Math.round(indexPt[2]);
|
|
@@ -143,8 +143,8 @@ function vtkPaintFilter(publicAPI, model) {
|
|
|
143
143
|
if (workerPromise) {
|
|
144
144
|
var index1 = [0, 0, 0];
|
|
145
145
|
var index2 = [0, 0, 0];
|
|
146
|
-
transformMat4(index1, point1, model.maskWorldToIndex);
|
|
147
|
-
transformMat4(index2, point2, model.maskWorldToIndex);
|
|
146
|
+
vec3.transformMat4(index1, point1, model.maskWorldToIndex);
|
|
147
|
+
vec3.transformMat4(index2, point2, model.maskWorldToIndex);
|
|
148
148
|
index1[0] = Math.round(index1[0]);
|
|
149
149
|
index1[1] = Math.round(index1[1]);
|
|
150
150
|
index1[2] = Math.round(index1[2]);
|
|
@@ -164,10 +164,10 @@ function vtkPaintFilter(publicAPI, model) {
|
|
|
164
164
|
var realCenter = [0, 0, 0];
|
|
165
165
|
var origin = [0, 0, 0];
|
|
166
166
|
var realScale3 = [0, 0, 0];
|
|
167
|
-
transformMat4(realCenter, center, model.maskWorldToIndex);
|
|
168
|
-
transformMat4(origin, origin, model.maskWorldToIndex);
|
|
169
|
-
transformMat4(realScale3, scale3, model.maskWorldToIndex);
|
|
170
|
-
subtract(realScale3, realScale3, origin);
|
|
167
|
+
vec3.transformMat4(realCenter, center, model.maskWorldToIndex);
|
|
168
|
+
vec3.transformMat4(origin, origin, model.maskWorldToIndex);
|
|
169
|
+
vec3.transformMat4(realScale3, scale3, model.maskWorldToIndex);
|
|
170
|
+
vec3.subtract(realScale3, realScale3, origin);
|
|
171
171
|
realScale3 = realScale3.map(function (s) {
|
|
172
172
|
return s === 0 ? 0.25 : Math.abs(s);
|
|
173
173
|
});
|
|
@@ -206,7 +206,7 @@ function vtkPaintFilter(publicAPI, model) {
|
|
|
206
206
|
for (var _i3 = 0; _i3 < numPoints; _i3++) {
|
|
207
207
|
var point = points.slice(3 * _i3, 3 * _i3 + 3);
|
|
208
208
|
var voxel = triangleList.subarray(3 * _i3, 3 * _i3 + 3);
|
|
209
|
-
transformMat4(voxel, point, model.maskWorldToIndex);
|
|
209
|
+
vec3.transformMat4(voxel, point, model.maskWorldToIndex);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
workerPromise.exec('paintTriangles', {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { vtkAlgorithm, vtkObject } from '@kitware/vtk.js/interfaces';
|
|
2
|
+
import { Bounds, Point } from '@kitware/vtk.js/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
*
|
|
@@ -7,7 +8,7 @@ export interface ICircleSourceInitialValues {
|
|
|
7
8
|
xLength?: number;
|
|
8
9
|
yLength?: number;
|
|
9
10
|
zLength?: number;
|
|
10
|
-
center?:
|
|
11
|
+
center?: Point;
|
|
11
12
|
rotations?: number[];
|
|
12
13
|
pointType?: string;
|
|
13
14
|
generate3DTextureCoordinates?: boolean;
|
|
@@ -27,12 +28,12 @@ export interface vtkCubeSource extends vtkCubeSourceBase {
|
|
|
27
28
|
* Get the center of the cube.
|
|
28
29
|
* @default [0.0, 0.0, 0.0]
|
|
29
30
|
*/
|
|
30
|
-
getCenter():
|
|
31
|
+
getCenter(): Point;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* Get the center of the cube.
|
|
34
35
|
*/
|
|
35
|
-
getCenterByReference():
|
|
36
|
+
getCenterByReference(): Point;
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
*
|
|
@@ -90,9 +91,9 @@ export interface vtkCubeSource extends vtkCubeSourceBase {
|
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* Convenience methods allows creation of cube by specifying bounding box.
|
|
93
|
-
* @param bounds
|
|
94
|
+
* @param {Bounds} bounds The bounds for the cube.
|
|
94
95
|
*/
|
|
95
|
-
setBounds(bounds:
|
|
96
|
+
setBounds(bounds: Bounds): boolean;
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
99
|
* Set the center of the cube.
|
|
@@ -108,7 +109,7 @@ export interface vtkCubeSource extends vtkCubeSourceBase {
|
|
|
108
109
|
* @param center
|
|
109
110
|
* @default [0, 0, 0]
|
|
110
111
|
*/
|
|
111
|
-
setCenterFrom(center:
|
|
112
|
+
setCenterFrom(center: Point): boolean;
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
115
|
*
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
2
3
|
import macro from '../../macros.js';
|
|
3
4
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
4
5
|
import { g as subtract, l as normalize, d as dot, j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
5
6
|
import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
|
|
6
7
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
7
|
-
import { i as identity, t as translate, r as rotate } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
8
|
-
import { f as negate, t as transformMat4, g as exactEquals } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
9
8
|
|
|
10
9
|
var vtkWarningMacro = macro.vtkWarningMacro;
|
|
11
10
|
var EPSILON = 1e-6; // ----------------------------------------------------------------------------
|
|
@@ -141,15 +140,15 @@ function vtkPlaneSource(publicAPI, model) {
|
|
|
141
140
|
} // Create rotation matrix
|
|
142
141
|
|
|
143
142
|
|
|
144
|
-
var transform = identity(new Float64Array(16));
|
|
143
|
+
var transform = mat4.identity(new Float64Array(16));
|
|
145
144
|
var negCenter = [];
|
|
146
|
-
negate(negCenter, model.center);
|
|
147
|
-
translate(transform, transform, model.center);
|
|
148
|
-
rotate(transform, transform, angle, rotationAxis);
|
|
149
|
-
translate(transform, transform, negCenter);
|
|
150
|
-
transformMat4(model.origin, model.origin, transform);
|
|
151
|
-
transformMat4(model.point1, model.point1, transform);
|
|
152
|
-
transformMat4(model.point2, model.point2, transform);
|
|
145
|
+
vec3.negate(negCenter, model.center);
|
|
146
|
+
mat4.translate(transform, transform, model.center);
|
|
147
|
+
mat4.rotate(transform, transform, angle, rotationAxis);
|
|
148
|
+
mat4.translate(transform, transform, negCenter);
|
|
149
|
+
vec3.transformMat4(model.origin, model.origin, transform);
|
|
150
|
+
vec3.transformMat4(model.point1, model.point1, transform);
|
|
151
|
+
vec3.transformMat4(model.point2, model.point2, transform);
|
|
153
152
|
vtkMatrixBuilder.buildFromRadian().rotate(angle, rotationAxis).apply(model.normal);
|
|
154
153
|
publicAPI.modified();
|
|
155
154
|
};
|
|
@@ -163,7 +162,7 @@ function vtkPlaneSource(publicAPI, model) {
|
|
|
163
162
|
c = [arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]];
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
if (!exactEquals(c, model.center)) {
|
|
165
|
+
if (!vec3.exactEquals(c, model.center)) {
|
|
167
166
|
var v1 = [];
|
|
168
167
|
subtract(model.point1, model.origin, v1);
|
|
169
168
|
var v2 = [];
|
|
@@ -189,7 +188,7 @@ function vtkPlaneSource(publicAPI, model) {
|
|
|
189
188
|
point1 = [arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]];
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
if (!exactEquals(point1, model.point1)) {
|
|
191
|
+
if (!vec3.exactEquals(point1, model.point1)) {
|
|
193
192
|
var v1 = [];
|
|
194
193
|
var v2 = [];
|
|
195
194
|
model.point1 = _toConsumableArray(point1);
|
|
@@ -210,7 +209,7 @@ function vtkPlaneSource(publicAPI, model) {
|
|
|
210
209
|
point2 = [arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]];
|
|
211
210
|
}
|
|
212
211
|
|
|
213
|
-
if (!exactEquals(point2, model.point2)) {
|
|
212
|
+
if (!vec3.exactEquals(point2, model.point2)) {
|
|
214
213
|
var v1 = [];
|
|
215
214
|
var v2 = [];
|
|
216
215
|
model.point2 = _toConsumableArray(point2);
|
package/IO/Core/BinaryHelper.js
CHANGED
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
* expect proper Unicode or any other encoding.
|
|
6
6
|
*/
|
|
7
7
|
function arrayBufferToString(arrayBuffer) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return decoder.decode(arrayBuffer);
|
|
11
|
-
} // fallback on platforms w/o TextDecoder
|
|
8
|
+
var decoder = new TextDecoder('latin1');
|
|
9
|
+
return decoder.decode(arrayBuffer);
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Extracts binary data out of a file ArrayBuffer given a prefix/suffix.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import
|
|
2
|
+
import pako from 'pako';
|
|
3
3
|
import macro from '../../../macros.js';
|
|
4
4
|
import Endian from '../../../Common/Core/Endian.js';
|
|
5
5
|
import { DataTypeByteSize } from '../../../Common/Core/DataArray/Constants.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
import pako from 'pako';
|
|
3
3
|
import macro from '../../../macros.js';
|
|
4
4
|
import Endian from '../../../Common/Core/Endian.js';
|
|
5
5
|
import { DataTypeByteSize } from '../../../Common/Core/DataArray/Constants.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
3
|
import DataAccessHelper from './DataAccessHelper.js';
|
|
4
4
|
import macro from '../../macros.js';
|
|
5
5
|
import './DataAccessHelper/HttpDataAccessHelper.js';
|