@kitware/vtk.js 28.7.0 → 28.8.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.
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/DataModel/PolyLine.d.ts +27 -2
- package/Common/DataModel/PolyLine.js +8 -5
- package/Rendering/Core/AbstractImageMapper.d.ts +56 -1
- package/Rendering/Core/AbstractImageMapper.js +6 -0
- package/Rendering/Core/AbstractMapper3D.js +2 -0
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/CubeAxesActor.js +1 -1
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/ImageArrayMapper.d.ts +2 -2
- package/Rendering/Core/ImageArrayMapper.js +1 -1
- package/Rendering/Core/ImageCPRMapper.d.ts +30 -1
- package/Rendering/Core/ImageCPRMapper.js +32 -1
- package/Rendering/Core/ImageMapper.d.ts +2 -2
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/ImageSlice.d.ts +5 -5
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/OpenGL/ImageCPRMapper.js +25 -2
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/Texture.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +4 -0
- package/package.json +1 -1
|
@@ -2370,4 +2370,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
|
|
|
2370
2370
|
'default': vtkMath
|
|
2371
2371
|
});
|
|
2372
2372
|
|
|
2373
|
-
export { factorial as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E,
|
|
2373
|
+
export { factorial as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, createUninitializedBounds as F, isInf as G, rgb2hsv as H, rgb2lab as I, lab2rgb as J, floor as K, round as L, normalize2D as M, nearestPowerOfTwo as N, multiply3x3_vect3 as O, areBoundsInitialized as P, isPowerOfTwo as Q, angleBetweenVectors as R, signedAngleBetweenVectors as S, createArray as T, Pi as U, ceil as V, min as W, max as X, arrayMin as Y, arrayMax as Z, ceilLog2 as _, areMatricesEqual as a, binomial as a0, beginCombination as a1, nextCombination as a2, randomSeed as a3, getSeed as a4, gaussian as a5, multiplyScalar2D as a6, multiplyAccumulate2D as a7, outer as a8, projectVector as a9, singularValueDecomposition3x3 as aA, luFactorLinearSystem as aB, luSolveLinearSystem as aC, invertMatrix as aD, estimateMatrixCondition as aE, solveHomogeneousLeastSquares as aF, solveLeastSquares as aG, hex2float as aH, lab2xyz as aI, xyz2lab as aJ, xyz2rgb as aK, rgb2xyz as aL, computeBoundsFromPoints as aM, clampAndNormalizeValue as aN, getScalarTypeFittingRange as aO, getAdjustedScalarRange as aP, extentIsWithinOtherExtent as aQ, boundsIsWithinOtherBounds as aR, pointIsWithinBounds as aS, solve3PointCircle as aT, inf as aU, negInf as aV, isFinite as aW, isNaN as aX, floatToHex2 as aY, floatRGB2HexCode as aZ, float2CssRGBA as a_, dot2D as aa, projectVector2D as ab, gaussianAmplitude as ac, gaussianWeight as ad, outer2D as ae, norm2D as af, rowsToMat4 as ag, columnsToMat4 as ah, columnsToMat3 as ai, LUFactor3x3 as aj, LUSolve3x3 as ak, linearSolve3x3 as al, multiply3x3_mat3 as am, multiplyMatrix as an, transpose3x3 as ao, invert3x3 as ap, identity3x3 as aq, identity as ar, isIdentity as as, isIdentity3x3 as at, quaternionToMatrix3x3 as au, roundNumber as av, matrix3x3ToQuaternion as aw, multiplyQuaternion as ax, orthogonalize3x3 as ay, diagonalize3x3 as az, roundVector as b, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
|
package/Common/Core/Math.js
CHANGED
|
@@ -3,4 +3,4 @@ import '@babel/runtime/helpers/toConsumableArray';
|
|
|
3
3
|
import 'seedrandom';
|
|
4
4
|
import '../../macros.js';
|
|
5
5
|
import './Math/Constants.js';
|
|
6
|
-
export { aj as LUFactor3x3, ak as LUSolve3x3, U as Pi, k as add, R as angleBetweenVectors, P as areBoundsInitialized, B as areEquals, a as areMatricesEqual, Z as arrayMax, Y as arrayMin, D as arrayRange, a1 as beginCombination, a0 as binomial, aR as boundsIsWithinOtherBounds, V as ceil, _ as ceilLog2, aN as clampAndNormalizeValue, C as clampValue, c as clampVector, ai as columnsToMat3, ah as columnsToMat4, aM as computeBoundsFromPoints, T as createArray,
|
|
6
|
+
export { aj as LUFactor3x3, ak as LUSolve3x3, U as Pi, k as add, R as angleBetweenVectors, P as areBoundsInitialized, B as areEquals, a as areMatricesEqual, Z as arrayMax, Y as arrayMin, D as arrayRange, a1 as beginCombination, a0 as binomial, aR as boundsIsWithinOtherBounds, V as ceil, _ as ceilLog2, aN as clampAndNormalizeValue, C as clampValue, c as clampVector, ai as columnsToMat3, ah as columnsToMat4, aM as computeBoundsFromPoints, T as createArray, F as createUninitializedBounds, j as cross, f as default, A as degreesFromRadians, o as determinant2x2, y as determinant3x3, az as diagonalize3x3, e as distance2BetweenPoints, d as dot, aa as dot2D, aE as estimateMatrixCondition, aQ as extentIsWithinOtherExtent, $ as factorial, a_ as float2CssRGBA, aZ as floatRGB2HexCode, aY as floatToHex2, K as floor, a5 as gaussian, ac as gaussianAmplitude, ad as gaussianWeight, aP as getAdjustedScalarRange, E as getMajorAxisIndex, aO as getScalarTypeFittingRange, a4 as getSeed, aH as hex2float, h as hsv2rgb, ar as identity, aq as identity3x3, aU as inf, ap as invert3x3, aD as invertMatrix, aW as isFinite, as as isIdentity, at as isIdentity3x3, G as isInf, aX as isNaN, i as isNan, Q as isPowerOfTwo, t as jacobi, p as jacobiN, J as lab2rgb, aI as lab2xyz, al as linearSolve3x3, aB as luFactorLinearSystem, aC as luSolveLinearSystem, aw as matrix3x3ToQuaternion, X as max, W as min, am as multiply3x3_mat3, O as multiply3x3_vect3, m as multiplyAccumulate, a7 as multiplyAccumulate2D, an as multiplyMatrix, ax as multiplyQuaternion, w as multiplyScalar, a6 as multiplyScalar2D, N as nearestPowerOfTwo, aV as negInf, a2 as nextCombination, n as norm, af as norm2D, l as normalize, M as normalize2D, ay as orthogonalize3x3, a8 as outer, ae as outer2D, q as perpendiculars, aS as pointIsWithinBounds, a9 as projectVector, ab as projectVector2D, au as quaternionToMatrix3x3, r as radiansFromDegrees, x as random, a3 as randomSeed, H as rgb2hsv, I as rgb2lab, aL as rgb2xyz, L as round, av as roundNumber, b as roundVector, z as rowsToMat3, ag as rowsToMat4, S as signedAngleBetweenVectors, aA as singularValueDecomposition3x3, aT as solve3PointCircle, aF as solveHomogeneousLeastSquares, aG as solveLeastSquares, g as solveLinearSystem, s as subtract, ao as transpose3x3, u as uninitializeBounds, aJ as xyz2lab, aK as xyz2rgb } from './Math/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { quat } from 'gl-matrix';
|
|
2
|
-
import { Vector2, Vector3 } from './../../types';
|
|
1
|
+
import { quat, vec3 } from 'gl-matrix';
|
|
2
|
+
import { Nullable, Vector2, Vector3 } from './../../types';
|
|
3
3
|
import vtkCell, { ICellInitialValues } from './Cell';
|
|
4
4
|
import { IIntersectWithLine } from './Line';
|
|
5
5
|
|
|
@@ -67,6 +67,31 @@ export interface vtkPolyLine extends vtkCell {
|
|
|
67
67
|
* @param distance The distance from the first point of the polyline
|
|
68
68
|
*/
|
|
69
69
|
findPointIdAtDistanceFromFirstPoint(distance: number): number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* An array of quaternions used to orient the polyline at each of its point
|
|
73
|
+
* The length of the array has to be the same size as the number of points
|
|
74
|
+
* Defaults to null.
|
|
75
|
+
*/
|
|
76
|
+
getOrientations(): Nullable<quat[]>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @see getOrientations
|
|
80
|
+
* @param orientations
|
|
81
|
+
*/
|
|
82
|
+
setOrientations(orientations: Nullable<quat[]>): boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The function used in getDistancesToFirstPoint and in findPointIdAtDistanceFromFirstPoint
|
|
86
|
+
* Defaults to vec3.dist of gl-matrix
|
|
87
|
+
*/
|
|
88
|
+
getDistanceFunction(): (a: vec3, b: vec3) => number;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @see getDistanceFunction
|
|
92
|
+
* @param f
|
|
93
|
+
*/
|
|
94
|
+
setDistanceFunction(f: (a: vec3, b: vec3) => number): boolean;
|
|
70
95
|
}
|
|
71
96
|
|
|
72
97
|
/**
|
|
@@ -58,7 +58,9 @@ function vtkPolyLine(publicAPI, model) {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
publicAPI.getDistancesToFirstPoint = function () {
|
|
61
|
-
|
|
61
|
+
var dTime = model.distancesTime.getMTime();
|
|
62
|
+
|
|
63
|
+
if (dTime < model.points.getMTime() || dTime < publicAPI.getMTime()) {
|
|
62
64
|
var numPoints = publicAPI.getNumberOfPoints();
|
|
63
65
|
|
|
64
66
|
if (!model.distances) {
|
|
@@ -76,7 +78,7 @@ function vtkPolyLine(publicAPI, model) {
|
|
|
76
78
|
|
|
77
79
|
for (var i = 1; i < numPoints; ++i) {
|
|
78
80
|
model.points.getPoint(i, currentPoint);
|
|
79
|
-
totalDistance +=
|
|
81
|
+
totalDistance += model.distanceFunction(previousPoint, currentPoint);
|
|
80
82
|
model.distances[i] = totalDistance;
|
|
81
83
|
vec3.copy(previousPoint, currentPoint);
|
|
82
84
|
}
|
|
@@ -121,15 +123,16 @@ function vtkPolyLine(publicAPI, model) {
|
|
|
121
123
|
|
|
122
124
|
|
|
123
125
|
var DEFAULT_VALUES = {
|
|
124
|
-
orientations: null
|
|
125
|
-
|
|
126
|
+
orientations: null,
|
|
127
|
+
// an array of quat or null
|
|
128
|
+
distanceFunction: vec3.dist
|
|
126
129
|
}; // ----------------------------------------------------------------------------
|
|
127
130
|
|
|
128
131
|
function extend(publicAPI, model) {
|
|
129
132
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
130
133
|
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
131
134
|
vtkCell.extend(publicAPI, model, initialValues);
|
|
132
|
-
macro.setGet(publicAPI, model, ['orientations']);
|
|
135
|
+
macro.setGet(publicAPI, model, ['orientations', 'distanceFunction']);
|
|
133
136
|
model.distancesTime = {};
|
|
134
137
|
macro.obj(model.distancesTime, {
|
|
135
138
|
mtime: 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import vtkAbstractMapper3D, { IAbstractMapper3DInitialValues } from './AbstractMapper3D';
|
|
2
2
|
import vtkImageData from './../../Common/DataModel/ImageData';
|
|
3
|
-
import { Nullable } from './../../types';
|
|
3
|
+
import { Bounds, Extent, Nullable, RGBAColor } from './../../types';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export interface IAbstractImageMapperInitialValues extends IAbstractMapper3DInitialValues {
|
|
@@ -32,6 +32,45 @@ export interface vtkAbstractImageMapper extends vtkAbstractMapper3D {
|
|
|
32
32
|
*/
|
|
33
33
|
setSlice(slice: number): boolean;
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Get bounds for a specified slice.
|
|
37
|
+
* To be implemented by derived classes.
|
|
38
|
+
* @param {Number} slice The slice index. If undefined, the current slice is considered.
|
|
39
|
+
* @param {Number} thickness The slice thickness. If undefined, 0 is considered.
|
|
40
|
+
*/
|
|
41
|
+
getBoundsForSlice(slice?: number, thickness?: number): Bounds;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Return the currently set background color.
|
|
45
|
+
*/
|
|
46
|
+
getBackgroundColor(): RGBAColor;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Return the currently set background color.
|
|
50
|
+
*/
|
|
51
|
+
getBackgroundColorByReference(): RGBAColor;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param r red component of background color
|
|
55
|
+
* @param g green component of background color
|
|
56
|
+
* @param b blue component of background color
|
|
57
|
+
* @param a opacity component of background color
|
|
58
|
+
*/
|
|
59
|
+
setBackgroundColor(r: number, g: number, b: number, a: number): boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param color specify background color as an array of 4 values.
|
|
64
|
+
*/
|
|
65
|
+
setBackgroundColor(color: RGBAColor): boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param {RGBAColor} color specify the background color to use
|
|
70
|
+
* in RGBA format as an array of 4 values. Values are copied.
|
|
71
|
+
*/
|
|
72
|
+
setBackgroundColorFrom(color: RGBAColor): boolean;
|
|
73
|
+
|
|
35
74
|
/**
|
|
36
75
|
*
|
|
37
76
|
*/
|
|
@@ -43,6 +82,16 @@ export interface vtkAbstractImageMapper extends vtkAbstractMapper3D {
|
|
|
43
82
|
*/
|
|
44
83
|
setUseCustomExtents(useCustomExtents: boolean): boolean;
|
|
45
84
|
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
getCustomDisplayExtent(): Extent;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
getCustomDisplayExtentByReference(): Extent;
|
|
94
|
+
|
|
46
95
|
/**
|
|
47
96
|
*
|
|
48
97
|
* @param {Number} x1 The x coordinate of the first point.
|
|
@@ -54,6 +103,12 @@ export interface vtkAbstractImageMapper extends vtkAbstractMapper3D {
|
|
|
54
103
|
*/
|
|
55
104
|
setCustomDisplayExtent(x1: number, x2: number, y1: number, y2: number, z1: number, z2: number): boolean;
|
|
56
105
|
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* @param extents specify extents as an array of 6 values [minx, maxx, ...]
|
|
109
|
+
*/
|
|
110
|
+
setCustomDisplayExtent(customDisplayExtent: Extent): boolean;
|
|
111
|
+
|
|
57
112
|
/**
|
|
58
113
|
*
|
|
59
114
|
* @param customDisplayExtent
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
2
|
import vtkAbstractMapper3D from './AbstractMapper3D.js';
|
|
3
|
+
import { F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
3
4
|
|
|
4
5
|
// vtkAbstractImageMapper methods
|
|
5
6
|
// ----------------------------------------------------------------------------
|
|
@@ -14,6 +15,11 @@ function vtkAbstractImageMapper(publicAPI, model) {
|
|
|
14
15
|
publicAPI.getCurrentImage = function () {
|
|
15
16
|
return null;
|
|
16
17
|
};
|
|
18
|
+
|
|
19
|
+
publicAPI.getBoundsForSlice = function () {
|
|
20
|
+
macro.vtkErrorMacro('vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED');
|
|
21
|
+
return createUninitializedBounds();
|
|
22
|
+
};
|
|
17
23
|
} // ----------------------------------------------------------------------------
|
|
18
24
|
// Object factory
|
|
19
25
|
// ----------------------------------------------------------------------------
|
|
@@ -3,6 +3,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
4
|
import vtkAbstractMapper from './AbstractMapper.js';
|
|
5
5
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
6
|
+
import { F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
6
7
|
|
|
7
8
|
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; }
|
|
8
9
|
|
|
@@ -13,6 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
14
|
function vtkAbstractMapper3D(publicAPI, model) {
|
|
14
15
|
publicAPI.getBounds = function () {
|
|
15
16
|
macro.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED");
|
|
17
|
+
return createUninitializedBounds();
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
publicAPI.getCenter = function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import { h as hsv2rgb, i as isNan,
|
|
3
|
+
import { h as hsv2rgb, i as isNan, G as isInf, H as rgb2hsv, I as rgb2lab, J as lab2rgb, K as floor } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkScalarsToColors from '../../Common/Core/ScalarsToColors.js';
|
|
5
5
|
import Constants from './ColorTransferFunction/Constants.js';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
import Constants from './Coordinate/Constants.js';
|
|
4
|
-
import {
|
|
4
|
+
import { L as round, K as floor } from '../../Common/Core/Math/index.js';
|
|
5
5
|
|
|
6
6
|
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; }
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import { vec3, mat4 } from 'gl-matrix';
|
|
4
4
|
import * as d3 from 'd3-scale';
|
|
5
|
-
import {
|
|
5
|
+
import { M as normalize2D, N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import macro from '../../macros.js';
|
|
7
7
|
import vtkActor from './Actor.js';
|
|
8
8
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
@@ -4,7 +4,7 @@ import { mat4, vec3, mat3 } from 'gl-matrix';
|
|
|
4
4
|
import Constants from './Glyph3DMapper/Constants.js';
|
|
5
5
|
import macro from '../../macros.js';
|
|
6
6
|
import vtkMapper from './Mapper.js';
|
|
7
|
-
import {
|
|
7
|
+
import { F as createUninitializedBounds, n as norm } from '../../Common/Core/Math/index.js';
|
|
8
8
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
9
9
|
|
|
10
10
|
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; }
|
|
@@ -52,9 +52,9 @@ export interface vtkImageArrayMapper extends vtkAbstractImageMapper {
|
|
|
52
52
|
* @param {Number} [slice] The slice index. If undefined, the current slice is considered.
|
|
53
53
|
* @param {Number} [halfThickness] Half the slice thickness in index space (unit voxel
|
|
54
54
|
* spacing). If undefined, 0 is considered.
|
|
55
|
-
* @return {
|
|
55
|
+
* @return {Bounds} The bounds for a given slice.
|
|
56
56
|
*/
|
|
57
|
-
getBoundsForSlice(slice?: number, halfThickness?: number):
|
|
57
|
+
getBoundsForSlice(slice?: number, halfThickness?: number): Bounds;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Get the closest IJK axis
|
|
@@ -2,7 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
import vtkAbstractImageMapper from './AbstractImageMapper.js';
|
|
4
4
|
import vtkImageMapper from './ImageMapper.js';
|
|
5
|
-
import {
|
|
5
|
+
import { F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
|
|
7
7
|
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
8
8
|
|
|
@@ -62,6 +62,21 @@ export interface vtkImageCPRMapper extends vtkAbstractMapper3D {
|
|
|
62
62
|
*/
|
|
63
63
|
setUseUniformOrientation(useUniformOrientation: boolean): boolean;
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* A point used to offset each line of pixel in the rendering
|
|
67
|
+
* The line of pixel is offseted such as the center of the line is as close as possible to the center point
|
|
68
|
+
* This can be used in combination with @see getUseUniformOrientation and a custom distance function for @see getOrientedCenterline to visualize a CPR in projected mode or stretched mode
|
|
69
|
+
* Defaults to null.
|
|
70
|
+
* @returns the center point
|
|
71
|
+
*/
|
|
72
|
+
getCenterPoint(): Nullable<vec3>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @see getCenterPoint
|
|
76
|
+
* @param point
|
|
77
|
+
*/
|
|
78
|
+
setCenterPoint(point: Nullable<vec3>): boolean;
|
|
79
|
+
|
|
65
80
|
/**
|
|
66
81
|
* This flag indicates wether the GPU should use half float or not
|
|
67
82
|
* When true, will use half float
|
|
@@ -191,6 +206,17 @@ export interface vtkImageCPRMapper extends vtkAbstractMapper3D {
|
|
|
191
206
|
*/
|
|
192
207
|
preRenderCheck(): boolean;
|
|
193
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Configure the mapper and the centerline to be in straightened CPR mode
|
|
211
|
+
*/
|
|
212
|
+
useStraightenedMode(): void;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Configure the mapper and the centerline to be in strectched CPR mode
|
|
216
|
+
* @param centerPoint The center point, optional, default to the first point of the centerline or [0, 0, 0]
|
|
217
|
+
*/
|
|
218
|
+
useStretchedMode(centerPoint?: Nullable<vec3>): void;
|
|
219
|
+
|
|
194
220
|
/**
|
|
195
221
|
* Set the polydata used as a centerline
|
|
196
222
|
* You can also use `publicAPI.setInputData(centerlineData, 1);`
|
|
@@ -346,7 +372,10 @@ export function newInstance(initialValues?: IImageCPRMapperInitialValues): vtkIm
|
|
|
346
372
|
|
|
347
373
|
/**
|
|
348
374
|
* CPR in vtkImageCPRMapper stands for Curved Planar Reformation. This mapper
|
|
349
|
-
* can be used to visualize tubular structures such as blood vessels.
|
|
375
|
+
* can be used to visualize tubular structures such as blood vessels. It can be
|
|
376
|
+
* used in projected mode, stretched mode or straightened mode depending on the
|
|
377
|
+
* settings @see getUseUniformOrientation , @see getCenterPoint and the distance
|
|
378
|
+
* function of @see getOrientedCenterline .
|
|
350
379
|
*
|
|
351
380
|
* This specialised mapper takes as input a vtkImageData representing a volume
|
|
352
381
|
* ( @see setImageData ) and a vtkPolyData representing a centerline
|
|
@@ -293,6 +293,36 @@ function vtkImageCPRMapper(publicAPI, model) {
|
|
|
293
293
|
return true;
|
|
294
294
|
};
|
|
295
295
|
|
|
296
|
+
publicAPI.useStraightenedMode = function () {
|
|
297
|
+
publicAPI.setCenterPoint(null);
|
|
298
|
+
publicAPI.setUseUniformOrientation(false);
|
|
299
|
+
publicAPI.getOrientedCenterline().setDistanceFunction(vec3.dist);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
publicAPI.useStretchedMode = function (centerPoint) {
|
|
303
|
+
var centerline = publicAPI.getOrientedCenterline(); // Set center point
|
|
304
|
+
|
|
305
|
+
if (!centerPoint) {
|
|
306
|
+
// Get the first point of the centerline if there is one
|
|
307
|
+
var centerlinePoints = centerline.getPoints();
|
|
308
|
+
var newCenterPoint = centerlinePoints.getNumberOfTuples() > 0 ? centerlinePoints.getPoint(0) : [0, 0, 0];
|
|
309
|
+
publicAPI.setCenterPoint(newCenterPoint);
|
|
310
|
+
} else {
|
|
311
|
+
publicAPI.setCenterPoint(centerPoint);
|
|
312
|
+
} // Enable uniform orientation
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
publicAPI.setUseUniformOrientation(true); // Change distance function
|
|
316
|
+
|
|
317
|
+
centerline.setDistanceFunction(function (a, b) {
|
|
318
|
+
var direction = publicAPI.getUniformDirection();
|
|
319
|
+
var vec = vec3.subtract([], a, b);
|
|
320
|
+
var d2 = vec3.squaredLength(vec);
|
|
321
|
+
var x = vec3.dot(direction, vec);
|
|
322
|
+
return Math.sqrt(d2 - x * x);
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
|
|
296
326
|
publicAPI.setCenterlineData = function (centerlineData) {
|
|
297
327
|
return publicAPI.setInputData(centerlineData, 1);
|
|
298
328
|
};
|
|
@@ -326,6 +356,7 @@ var DEFAULT_VALUES = {
|
|
|
326
356
|
width: 10,
|
|
327
357
|
uniformOrientation: [0, 0, 0, 1],
|
|
328
358
|
useUniformOrientation: false,
|
|
359
|
+
centerPoint: null,
|
|
329
360
|
preferSizeOverAccuracy: false,
|
|
330
361
|
orientationArrayName: null,
|
|
331
362
|
tangentDirection: [1, 0, 0],
|
|
@@ -345,7 +376,7 @@ function extend(publicAPI, model) {
|
|
|
345
376
|
mtime: 0
|
|
346
377
|
}); // Setters and getters
|
|
347
378
|
|
|
348
|
-
macro.setGet(publicAPI, model, ['width', 'uniformOrientation', 'useUniformOrientation', 'preferSizeOverAccuracy', 'orientationArrayName', 'tangentDirection', 'bitangentDirection', 'normalDirection']);
|
|
379
|
+
macro.setGet(publicAPI, model, ['width', 'uniformOrientation', 'useUniformOrientation', 'centerPoint', 'preferSizeOverAccuracy', 'orientationArrayName', 'tangentDirection', 'bitangentDirection', 'normalDirection']);
|
|
349
380
|
CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model); // Object methods
|
|
350
381
|
|
|
351
382
|
vtkImageCPRMapper(publicAPI, model);
|
|
@@ -46,9 +46,9 @@ export interface vtkImageMapper extends vtkAbstractImageMapper {
|
|
|
46
46
|
* @param {Number} [slice] The slice index. If undefined, the current slice is considered.
|
|
47
47
|
* @param {Number} [halfThickness] Half the slice thickness in index space (unit voxel
|
|
48
48
|
* spacing). If undefined, 0 is considered.
|
|
49
|
-
* @return {
|
|
49
|
+
* @return {Bounds} The bounds for a given slice.
|
|
50
50
|
*/
|
|
51
|
-
getBoundsForSlice(slice?: number, halfThickness?: number):
|
|
51
|
+
getBoundsForSlice(slice?: number, halfThickness?: number): Bounds;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
*
|
|
@@ -3,7 +3,7 @@ import Constants from './ImageMapper/Constants.js';
|
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
4
|
import vtkAbstractImageMapper from './AbstractImageMapper.js';
|
|
5
5
|
import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
|
|
6
|
-
import { C as clampValue, O as multiply3x3_vect3,
|
|
6
|
+
import { C as clampValue, O as multiply3x3_vect3, F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
7
7
|
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
8
8
|
|
|
9
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; }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Bounds } from './../../types';
|
|
2
2
|
import vtkImageProperty, { IImagePropertyInitialValues } from './ImageProperty';
|
|
3
|
-
import
|
|
3
|
+
import vtkAbstractImageMapper from './AbstractImageMapper';
|
|
4
4
|
import vtkProp3D, { IProp3DInitialValues } from './Prop3D';
|
|
5
5
|
|
|
6
6
|
export interface IImageSliceInitialValues extends IProp3DInitialValues{
|
|
7
|
-
mapper?:
|
|
7
|
+
mapper?: vtkAbstractImageMapper;
|
|
8
8
|
property?: vtkImageProperty;
|
|
9
9
|
bounds?: Bounds;
|
|
10
10
|
}
|
|
@@ -55,7 +55,7 @@ export interface vtkImageSlice extends vtkProp3D {
|
|
|
55
55
|
/**
|
|
56
56
|
*
|
|
57
57
|
*/
|
|
58
|
-
getMapper():
|
|
58
|
+
getMapper(): vtkAbstractImageMapper;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Get the minimum X bound
|
|
@@ -126,9 +126,9 @@ export interface vtkImageSlice extends vtkProp3D {
|
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
*
|
|
129
|
-
* @param {
|
|
129
|
+
* @param {vtkAbstractImageMapper} mapper An instance that derives from vtkAbstractImageMapper.
|
|
130
130
|
*/
|
|
131
|
-
setMapper(mapper:
|
|
131
|
+
setMapper(mapper: vtkAbstractImageMapper): boolean;
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
*
|
package/Rendering/Core/Mapper.js
CHANGED
|
@@ -4,7 +4,7 @@ import vtkAbstractMapper3D from './AbstractMapper3D.js';
|
|
|
4
4
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
5
5
|
import vtkImageData from '../../Common/DataModel/ImageData.js';
|
|
6
6
|
import vtkLookupTable from '../../Common/Core/LookupTable.js';
|
|
7
|
-
import {
|
|
7
|
+
import { F as createUninitializedBounds, i as isNan } from '../../Common/Core/Math/index.js';
|
|
8
8
|
import vtkScalarsToColors from '../../Common/Core/ScalarsToColors/Constants.js';
|
|
9
9
|
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
10
10
|
import Constants from './Mapper/Constants.js';
|
|
@@ -2,7 +2,7 @@ import { mat4, vec3 } from 'gl-matrix';
|
|
|
2
2
|
import { newInstance as newInstance$1, get, setGet, getArray, setGetArray, moveToProtected, vtkDebugMacro as vtkDebugMacro$1, vtkErrorMacro as vtkErrorMacro$1, vtkWarningMacro as vtkWarningMacro$1 } from '../../macros.js';
|
|
3
3
|
import vtkCamera from './Camera.js';
|
|
4
4
|
import vtkLight from './Light.js';
|
|
5
|
-
import { P as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot,
|
|
5
|
+
import { P as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkViewport from './Viewport.js';
|
|
7
7
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import * as d3 from 'd3-scale';
|
|
4
|
-
import {
|
|
4
|
+
import { N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import macro from '../../macros.js';
|
|
6
6
|
import vtkActor from './Actor.js';
|
|
7
7
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import {
|
|
3
|
+
import { F as createUninitializedBounds, C as clampValue, K as floor } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import Constants from './VolumeMapper/Constants.js';
|
|
5
5
|
import vtkAbstractMapper from './AbstractMapper.js';
|
|
6
6
|
import vtkPiecewiseFunction from '../../Common/DataModel/PiecewiseFunction.js';
|
|
@@ -449,14 +449,20 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
|
|
|
449
449
|
publicAPI.getNeedToRebuildShaders = function (cellBO, ren, actor) {
|
|
450
450
|
// has something changed that would require us to recreate the shader?
|
|
451
451
|
// candidates are
|
|
452
|
+
// presence of centerPoint
|
|
453
|
+
// value of useUniformOrientation
|
|
452
454
|
// property modified (representation interpolation and lighting)
|
|
453
455
|
// input modified
|
|
454
456
|
// light complexity changed
|
|
455
457
|
// render pass shader replacement changed
|
|
456
458
|
var tNumComp = model.volumeTexture.getComponents();
|
|
457
459
|
var iComp = actor.getProperty().getIndependentComponents();
|
|
460
|
+
var useCenterPoint = !!model.renderable.getCenterPoint();
|
|
461
|
+
var useUniformOrientation = model.renderable.getUseUniformOrientation();
|
|
458
462
|
|
|
459
|
-
if (model.
|
|
463
|
+
if (cellBO.getProgram() === 0 || model.lastUseCenterPoint !== useCenterPoint || model.lastUseUniformOrientation !== useUniformOrientation || model.lastHaveSeenDepthRequest !== model.haveSeenDepthRequest || model.lastTextureComponents !== tNumComp || model.lastIndependentComponents !== iComp) {
|
|
464
|
+
model.lastUseCenterPoint = useCenterPoint;
|
|
465
|
+
model.lastUseUniformOrientation = useUniformOrientation;
|
|
460
466
|
model.lastHaveSeenDepthRequest = model.haveSeenDepthRequest;
|
|
461
467
|
model.lastTextureComponents = tNumComp;
|
|
462
468
|
model.lastIndependentComponents = iComp;
|
|
@@ -521,6 +527,12 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
|
|
|
521
527
|
tcoordFSDec.push('in vec3 centerlineTopDirVSOutput;', 'in vec3 centerlineBotDirVSOutput;', 'in float centerlineAngleVSOutput;');
|
|
522
528
|
}
|
|
523
529
|
|
|
530
|
+
var centerPoint = model.renderable.getCenterPoint();
|
|
531
|
+
|
|
532
|
+
if (centerPoint) {
|
|
533
|
+
tcoordFSDec.push('uniform vec3 globalCenterPoint;');
|
|
534
|
+
}
|
|
535
|
+
|
|
524
536
|
if (iComps) {
|
|
525
537
|
for (var comp = 1; comp < tNumComp; comp++) {
|
|
526
538
|
tcoordFSDec = tcoordFSDec.concat([// color shift and scale
|
|
@@ -566,7 +578,13 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
|
|
|
566
578
|
tcoordFSImpl.push('vec3 interpolatedCenterlineDir;', 'if (centerlineAngleVSOutput < 0.0) {', ' // Lerp', ' interpolatedCenterlineDir = quadOffsetVSOutput.y * centerlineTopDirVSOutput + (1.0 - quadOffsetVSOutput.y) * centerlineBotDirVSOutput;', '} else {', ' // Slerp', ' float topInterpolationAngle = quadOffsetVSOutput.y * centerlineAngleVSOutput;', ' float botInterpolationAngle = centerlineAngleVSOutput - topInterpolationAngle;', ' interpolatedCenterlineDir = sin(topInterpolationAngle) * centerlineTopDirVSOutput + sin(botInterpolationAngle) * centerlineBotDirVSOutput;', '}', '// Slerp should give a normalized vector but when sin(angle) is small, rounding error occurs', '// Normalize for both lerp and slerp', 'interpolatedCenterlineDir = normalize(interpolatedCenterlineDir);');
|
|
567
579
|
}
|
|
568
580
|
|
|
569
|
-
|
|
581
|
+
if (centerPoint) {
|
|
582
|
+
tcoordFSImpl.push('float baseOffset = dot(interpolatedCenterlineDir, globalCenterPoint - centerlinePosVSOutput);', 'float horizontalOffset = quadOffsetVSOutput.x + baseOffset;');
|
|
583
|
+
} else {
|
|
584
|
+
tcoordFSImpl.push('float horizontalOffset = quadOffsetVSOutput.x;');
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
tcoordFSImpl.push('vec3 volumePosMC = centerlinePosVSOutput + horizontalOffset * interpolatedCenterlineDir;', 'vec3 volumePosTC = (MCTCMatrix * vec4(volumePosMC, 1.0)).xyz;', 'if (any(lessThan(volumePosTC, vec3(0.0))) || any(greaterThan(volumePosTC, vec3(1.0))))', '{', ' // set the background color and exit', ' gl_FragData[0] = backgroundColor;', ' return;', '}', 'vec4 tvalue = texture(volumeTexture, volumePosTC);');
|
|
570
588
|
|
|
571
589
|
if (iComps) {
|
|
572
590
|
var rgba = ['r', 'g', 'b', 'a'];
|
|
@@ -685,6 +703,11 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
|
|
|
685
703
|
if (cellBO.getProgram().isUniformUsed('centerlineDirection')) {
|
|
686
704
|
var uniformDirection = model.renderable.getUniformDirection();
|
|
687
705
|
cellBO.getProgram().setUniform3fArray('centerlineDirection', uniformDirection);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (cellBO.getProgram().isUniformUsed('globalCenterPoint')) {
|
|
709
|
+
var centerPoint = model.renderable.getCenterPoint();
|
|
710
|
+
cellBO.getProgram().setUniform3fArray('globalCenterPoint', centerPoint);
|
|
688
711
|
} // Model coordinates to image space
|
|
689
712
|
// getWorldToIndex is badly named and is in fact modelToIndex
|
|
690
713
|
// MCIC -> Model coordinates to index coordinates
|
|
@@ -8,7 +8,7 @@ import { v as vtkPolyData2DVS } from './glsl/vtkPolyData2DVS.glsl.js';
|
|
|
8
8
|
import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
|
|
9
9
|
import vtkShaderProgram from './ShaderProgram.js';
|
|
10
10
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
11
|
-
import {
|
|
11
|
+
import { L as round } from '../../Common/Core/Math/index.js';
|
|
12
12
|
import { DisplayLocation } from '../Core/Property2D/Constants.js';
|
|
13
13
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
14
14
|
|
|
@@ -4,7 +4,7 @@ import Constants from './Texture/Constants.js';
|
|
|
4
4
|
import HalfFloat from '../../Common/Core/HalfFloat.js';
|
|
5
5
|
import { newInstance as newInstance$1, obj, set, setGet, get, moveToProtected, newTypedArray, vtkDebugMacro as vtkDebugMacro$1, vtkErrorMacro as vtkErrorMacro$1, vtkWarningMacro as vtkWarningMacro$1 } from '../../macros.js';
|
|
6
6
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
7
|
-
import { Q as isPowerOfTwo,
|
|
7
|
+
import { Q as isPowerOfTwo, N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
8
8
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
9
9
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
10
10
|
|
|
@@ -365,6 +365,10 @@ function widgetBehavior(publicAPI, model) {
|
|
|
365
365
|
var _manipulator$handleEv3 = manipulator.handleEvent(calldata, model._apiSpecificRenderWindow),
|
|
366
366
|
worldCoords = _manipulator$handleEv3.worldCoords;
|
|
367
367
|
|
|
368
|
+
if (!worldCoords || !worldCoords.length) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
368
372
|
var center = model.widgetState.getCenter();
|
|
369
373
|
var currentVectorToOrigin = [0, 0, 0];
|
|
370
374
|
subtract(worldCoords, center, currentVectorToOrigin);
|