@kitware/vtk.js 23.4.1 → 24.0.0-beta.2
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/BREAKING_CHANGES.md +33 -0
- package/Common/Core/DataArray.js +4 -0
- package/Common/Core/Math/index.js +2 -2
- package/Common/Core/Math.js +1 -1
- package/Common/DataModel/DataSetAttributes/FieldData.js +9 -5
- package/Common/DataModel/ImageData.d.ts +23 -6
- package/Common/DataModel/ImageData.js +8 -1
- package/Common/DataModel/PolyData.d.ts +8 -1
- package/Common/DataModel/PolyData.js +5 -3
- package/Common/DataModel/Triangle.js +217 -2
- package/Common/Transform/LandmarkTransform.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1249 -0
- package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
- package/Filters/General.js +2 -0
- package/Filters/Sources/CircleSource.js +1 -1
- package/Filters/Sources/PointSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/IO/Core/DataAccessHelper.d.ts +6 -0
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleImage.js +3 -3
- package/Interaction/Style/InteractorStyleMPRSlice.js +12 -6
- package/Interaction/Style/InteractorStyleManipulator.js +42 -28
- package/Interaction/Style/InteractorStyleRemoteMouse.js +32 -14
- package/Interaction/Style/InteractorStyleTrackballCamera.js +7 -7
- package/Interaction/Widgets/OrientationMarkerWidget.js +18 -13
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
- package/Interaction/Widgets.js +1 -35
- package/Proxy/Core/View2DProxy.js +1 -1
- 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/ImageMapper.js +1 -1
- package/Rendering/Core/InteractorObserver.js +11 -10
- package/Rendering/Core/InteractorStyle.js +9 -4
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Prop.js +6 -4
- package/Rendering/Core/Prop3D.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +24 -17
- package/Rendering/Core/Renderer.js +24 -19
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/Viewport.js +1 -1
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/OpenGL/Actor.js +2 -2
- package/Rendering/OpenGL/Actor2D.js +2 -2
- package/Rendering/OpenGL/BufferObject.js +6 -5
- package/Rendering/OpenGL/Camera.js +3 -3
- package/Rendering/OpenGL/CellArrayBufferObject.js +1 -1
- package/Rendering/OpenGL/Framebuffer.js +13 -12
- package/Rendering/OpenGL/Glyph3DMapper.js +10 -8
- package/Rendering/OpenGL/HardwareSelector.js +35 -25
- package/Rendering/OpenGL/ImageMapper.js +51 -45
- package/Rendering/OpenGL/ImageSlice.js +2 -2
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +4 -2
- package/Rendering/OpenGL/PolyDataMapper.js +14 -11
- package/Rendering/OpenGL/PolyDataMapper2D.js +7 -6
- package/Rendering/OpenGL/Renderer.js +11 -7
- package/Rendering/OpenGL/ReplacementShaderMapper.js +1 -1
- package/Rendering/OpenGL/ScalarBarActor.js +2 -2
- package/Rendering/OpenGL/ShaderCache.js +7 -5
- package/Rendering/OpenGL/Skybox.js +11 -9
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +2 -2
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +13 -12
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +11 -9
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +19 -12
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +9 -6
- package/Rendering/OpenGL/Texture.js +44 -31
- package/Rendering/OpenGL/VertexArrayObject.js +7 -7
- package/Rendering/OpenGL/Volume.js +3 -2
- package/Rendering/OpenGL/VolumeMapper.js +30 -26
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/SceneGraph/ViewNode.js +8 -7
- package/Rendering/WebGPU/Renderer.js +18 -10
- package/Widgets/Core/AbstractWidget.js +5 -4
- package/Widgets/Core/AbstractWidgetFactory.js +2 -1
- package/Widgets/Core/WidgetManager.js +66 -49
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Representations/CircleContextRepresentation.js +1 -1
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +5 -5
- package/Widgets/Representations/PolyLineRepresentation.js +1 -1
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +7 -7
- package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +2 -2
- package/Widgets/SVG/SVGLandmarkRepresentation.js +21 -8
- package/Widgets/SVG/SVGRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget/behavior.js +14 -6
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +14 -6
- package/Widgets/Widgets3D/EllipseWidget.js +0 -1
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +6 -2
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +4 -2
- package/Widgets/Widgets3D/LabelWidget/behavior.js +138 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +79 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +18 -9
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +0 -1
- package/Widgets/Widgets3D/PaintWidget/behavior.js +5 -3
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +18 -8
- package/Widgets/Widgets3D/RectangleWidget.js +0 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +18 -11
- package/Widgets/Widgets3D/SplineWidget/behavior.js +33 -21
- package/interfaces.d.ts +11 -0
- package/macros.d.ts +26 -1
- package/macros.js +51 -19
- package/package.json +1 -1
- package/types.d.ts +1 -0
- package/Interaction/Widgets/AbstractWidget.js +0 -104
- package/Interaction/Widgets/DistanceRepresentation.js +0 -116
- package/Interaction/Widgets/DistanceWidget.js +0 -77
- package/Interaction/Widgets/HandleRepresentation/Constants.js +0 -12
- package/Interaction/Widgets/HandleRepresentation.js +0 -100
- package/Interaction/Widgets/HandleWidget/Constants.js +0 -9
- package/Interaction/Widgets/HandleWidget.js +0 -194
- package/Interaction/Widgets/ImageCroppingRegionsRepresentation.js +0 -233
- package/Interaction/Widgets/ImageCroppingRegionsWidget/Constants.js +0 -16
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +0 -573
- package/Interaction/Widgets/LabelRepresentation/Constants.js +0 -17
- package/Interaction/Widgets/LabelRepresentation.js +0 -325
- package/Interaction/Widgets/LabelWidget.js +0 -65
- package/Interaction/Widgets/LineRepresentation/Constants.js +0 -21
- package/Interaction/Widgets/LineRepresentation.js +0 -498
- package/Interaction/Widgets/LineWidget/Constants.js +0 -11
- package/Interaction/Widgets/LineWidget.js +0 -296
- package/Interaction/Widgets/PointPlacer.js +0 -51
- package/Interaction/Widgets/ResliceCursor/ResliceCursor/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +0 -269
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +0 -146
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +0 -332
- package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +0 -134
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation/Constants.js +0 -16
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +0 -371
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +0 -157
- package/Interaction/Widgets/SphereHandleRepresentation.js +0 -370
- package/Interaction/Widgets/WidgetRepresentation.js +0 -121
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import HandleRepConstants from './HandleRepresentation/Constants.js';
|
|
3
|
-
import macro from '../../macros.js';
|
|
4
|
-
import vtkAbstractWidget from './AbstractWidget.js';
|
|
5
|
-
import vtkHandleWidget from './HandleWidget.js';
|
|
6
|
-
import vtkLineRepresentation from './LineRepresentation.js';
|
|
7
|
-
import { State } from './LineRepresentation/Constants.js';
|
|
8
|
-
import Constants from './LineWidget/Constants.js';
|
|
9
|
-
|
|
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; }
|
|
11
|
-
|
|
12
|
-
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; }
|
|
13
|
-
var WidgetState = Constants.WidgetState;
|
|
14
|
-
var InteractionState = HandleRepConstants.InteractionState; // ----------------------------------------------------------------------------
|
|
15
|
-
// vtkHandleWidget methods
|
|
16
|
-
// ----------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
function vtkLineWidget(publicAPI, model) {
|
|
19
|
-
// Set our className
|
|
20
|
-
model.classHierarchy.push('vtkLineWidget');
|
|
21
|
-
|
|
22
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
23
|
-
|
|
24
|
-
publicAPI.setCursor = function (state) {
|
|
25
|
-
switch (state) {
|
|
26
|
-
case State.OUTSIDE:
|
|
27
|
-
{
|
|
28
|
-
model.interactor.getView().setCursor('default');
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
default:
|
|
33
|
-
{
|
|
34
|
-
model.interactor.getView().setCursor('pointer');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
publicAPI.setCurrentHandle = function (value) {
|
|
40
|
-
model.currentHandle = value;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
publicAPI.setInteractor = function (i) {
|
|
44
|
-
superClass.setInteractor(i);
|
|
45
|
-
model.point1Widget.setInteractor(model.interactor);
|
|
46
|
-
model.point2Widget.setInteractor(model.interactor);
|
|
47
|
-
publicAPI.modified();
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
publicAPI.setEnabled = function (enabling) {
|
|
51
|
-
superClass.setEnabled(enabling);
|
|
52
|
-
|
|
53
|
-
if (!model.widgetRep) {
|
|
54
|
-
return;
|
|
55
|
-
} // Use the representations from the line widget
|
|
56
|
-
// for the point widgets to avoid creating
|
|
57
|
-
// default representations when setting the
|
|
58
|
-
// interactor below
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
model.point1Widget.setWidgetRep(model.widgetRep.getPoint1Representation());
|
|
62
|
-
model.point2Widget.setWidgetRep(model.widgetRep.getPoint2Representation());
|
|
63
|
-
|
|
64
|
-
if (model.widgetState === WidgetState.START) {
|
|
65
|
-
model.point1Widget.setEnabled(0);
|
|
66
|
-
model.point2Widget.setEnabled(0);
|
|
67
|
-
model.widgetRep.setLineVisibility(0);
|
|
68
|
-
model.widgetRep.setPoint1Visibility(1);
|
|
69
|
-
model.widgetRep.setPoint2Visibility(0);
|
|
70
|
-
} else {
|
|
71
|
-
model.point1Widget.setEnabled(enabling);
|
|
72
|
-
model.point2Widget.setEnabled(enabling);
|
|
73
|
-
model.widgetRep.setLineVisibility(1);
|
|
74
|
-
model.widgetRep.setPoint1Visibility(1);
|
|
75
|
-
model.widgetRep.setPoint2Visibility(1);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
publicAPI.setProcessEvents = function (processEvents) {
|
|
80
|
-
superClass.setProcessEvents(processEvents);
|
|
81
|
-
model.point1Widget.setProcessEvents(processEvents);
|
|
82
|
-
model.point2Widget.setProcessEvents(processEvents);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
publicAPI.setWidgetStateToStart = function () {
|
|
86
|
-
model.widgetState = WidgetState.START;
|
|
87
|
-
publicAPI.setCurrentHandle(0);
|
|
88
|
-
publicAPI.setEnabled(model.enabled);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
publicAPI.setWidgetStateToManipulate = function () {
|
|
92
|
-
model.widgetState = WidgetState.MANIPULATE;
|
|
93
|
-
publicAPI.setCurrentHandle(-1);
|
|
94
|
-
publicAPI.setEnabled(model.enabled);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
publicAPI.handleMouseMove = function (callData) {
|
|
98
|
-
return publicAPI.moveAction(callData);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
publicAPI.handleLeftButtonPress = function (callData) {
|
|
102
|
-
return publicAPI.selectAction(callData);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
publicAPI.handleLeftButtonRelease = function (callData) {
|
|
106
|
-
return publicAPI.endSelectAction(callData);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
publicAPI.handleMiddleButtonPress = function (callData) {
|
|
110
|
-
return publicAPI.translateAction(callData);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
publicAPI.handleMiddleButtonRelease = function (callData) {
|
|
114
|
-
return publicAPI.endSelectAction(callData);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
publicAPI.handleRightButtonPress = function (callData) {
|
|
118
|
-
return publicAPI.scaleAction(callData);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
publicAPI.handleRightButtonRelease = function (callData) {
|
|
122
|
-
return publicAPI.endSelectAction(callData);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
publicAPI.selectAction = function (callData) {
|
|
126
|
-
var position = [callData.position.x, callData.position.y];
|
|
127
|
-
|
|
128
|
-
if (model.widgetState === WidgetState.START) {
|
|
129
|
-
var pos3D = model.point1Widget.getWidgetRep().displayToWorld(position, 0); // The first time we click, the method is called twice
|
|
130
|
-
|
|
131
|
-
if (model.currentHandle < 1) {
|
|
132
|
-
model.widgetRep.setLineVisibility(1);
|
|
133
|
-
model.widgetRep.setPoint1WorldPosition(pos3D); // Trick to avoid a line with a zero length
|
|
134
|
-
// If the line has a zero length, it appears with bad extremities
|
|
135
|
-
|
|
136
|
-
pos3D[0] += 0.000000001;
|
|
137
|
-
model.widgetRep.setPoint2WorldPosition(pos3D);
|
|
138
|
-
publicAPI.setCurrentHandle(model.currentHandle + 1);
|
|
139
|
-
} else {
|
|
140
|
-
model.widgetRep.setPoint2Visibility(1);
|
|
141
|
-
model.widgetRep.setPoint2WorldPosition(pos3D); // When two points are placed, we go back to the native
|
|
142
|
-
|
|
143
|
-
model.widgetState = WidgetState.MANIPULATE;
|
|
144
|
-
publicAPI.setCurrentHandle(-1);
|
|
145
|
-
}
|
|
146
|
-
} else {
|
|
147
|
-
var state = model.widgetRep.computeInteractionState(position);
|
|
148
|
-
|
|
149
|
-
if (state === InteractionState.OUTSIDE) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
model.widgetState = WidgetState.ACTIVE;
|
|
154
|
-
publicAPI.updateHandleWidgets(state);
|
|
155
|
-
publicAPI.invokeStartInteractionEvent();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
model.widgetRep.startComplexWidgetInteraction(position);
|
|
159
|
-
publicAPI.render();
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
publicAPI.translateAction = function (callData) {
|
|
163
|
-
var position = [callData.position.x, callData.position.y];
|
|
164
|
-
var state = model.widgetRep.computeInteractionState(position);
|
|
165
|
-
|
|
166
|
-
if (state === InteractionState.OUTSIDE) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
model.widgetState = WidgetState.ACTIVE;
|
|
171
|
-
model.widgetRep.startComplexWidgetInteraction(position);
|
|
172
|
-
publicAPI.invokeStartInteractionEvent();
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
publicAPI.scaleAction = function (callData) {
|
|
176
|
-
var position = [callData.position.x, callData.position.y];
|
|
177
|
-
var state = model.widgetRep.computeInteractionState(position);
|
|
178
|
-
|
|
179
|
-
if (state === InteractionState.OUTSIDE) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
model.widgetState = WidgetState.ACTIVE;
|
|
184
|
-
model.widgetRep.startComplexWidgetInteraction(position);
|
|
185
|
-
publicAPI.invokeStartInteractionEvent();
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
publicAPI.moveAction = function (callData) {
|
|
189
|
-
var position = [callData.position.x, callData.position.y];
|
|
190
|
-
var modified = false;
|
|
191
|
-
|
|
192
|
-
if (model.widgetState === WidgetState.MANIPULATE) {
|
|
193
|
-
// In MANIPULATE, we are hovering above the widget
|
|
194
|
-
// Check if above a sphere and enable/disable if needed
|
|
195
|
-
var state = model.widgetRep.computeInteractionState(position);
|
|
196
|
-
modified = publicAPI.updateHandleWidgets(state);
|
|
197
|
-
} else if (model.widgetState === WidgetState.START) {
|
|
198
|
-
// In START, we are placing the sphere widgets.
|
|
199
|
-
// Move current handle along the mouse position.
|
|
200
|
-
model.widgetRep.complexWidgetInteraction(position);
|
|
201
|
-
var pos3D = model.point1Widget.getWidgetRep().displayToWorld(position, 0);
|
|
202
|
-
|
|
203
|
-
if (model.currentHandle === 0) {
|
|
204
|
-
model.widgetRep.setPoint1WorldPosition(pos3D);
|
|
205
|
-
} else {
|
|
206
|
-
model.widgetRep.setPoint2WorldPosition(pos3D);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
modified = true;
|
|
210
|
-
} else if (model.widgetState === WidgetState.ACTIVE) {
|
|
211
|
-
// In ACTIVE, we are moving a sphere widget.
|
|
212
|
-
// Update the line extremities to follow the spheres.
|
|
213
|
-
model.widgetRep.setPoint1WorldPosition(model.point1Widget.getWidgetRep().getWorldPosition());
|
|
214
|
-
model.widgetRep.setPoint2WorldPosition(model.point2Widget.getWidgetRep().getWorldPosition());
|
|
215
|
-
modified = true;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (modified) {
|
|
219
|
-
publicAPI.invokeInteractionEvent();
|
|
220
|
-
publicAPI.render();
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
publicAPI.endSelectAction = function (callData) {
|
|
225
|
-
if (model.widgetState === WidgetState.START) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
var position = [callData.position.x, callData.position.y];
|
|
230
|
-
model.widgetRep.complexWidgetInteraction(position);
|
|
231
|
-
model.widgetRep.setPoint1WorldPosition(model.point1Widget.getWidgetRep().getWorldPosition());
|
|
232
|
-
model.widgetRep.setPoint2WorldPosition(model.point2Widget.getWidgetRep().getWorldPosition());
|
|
233
|
-
model.widgetState = WidgetState.MANIPULATE;
|
|
234
|
-
publicAPI.invokeEndInteractionEvent();
|
|
235
|
-
publicAPI.render();
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
publicAPI.createDefaultRepresentation = function () {
|
|
239
|
-
if (!model.widgetRep) {
|
|
240
|
-
model.widgetRep = vtkLineRepresentation.newInstance();
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
publicAPI.updateHandleWidgets = function (state) {
|
|
245
|
-
var modified = false;
|
|
246
|
-
publicAPI.setCursor(state);
|
|
247
|
-
var enablePoint1Widget = state === State.ONP1;
|
|
248
|
-
var enablePoint2Widget = state === State.ONP2;
|
|
249
|
-
|
|
250
|
-
if (enablePoint1Widget !== model.point1Widget.getEnabled()) {
|
|
251
|
-
model.point1Widget.setEnabled(enablePoint1Widget);
|
|
252
|
-
modified = true;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (enablePoint2Widget !== model.point2Widget.getEnabled()) {
|
|
256
|
-
model.point2Widget.setEnabled(enablePoint2Widget);
|
|
257
|
-
modified = true;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return modified;
|
|
261
|
-
};
|
|
262
|
-
} // ----------------------------------------------------------------------------
|
|
263
|
-
// Object factory
|
|
264
|
-
// ----------------------------------------------------------------------------
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var DEFAULT_VALUES = {
|
|
268
|
-
widgetState: WidgetState.START,
|
|
269
|
-
currentHandle: 0,
|
|
270
|
-
point1Widget: null,
|
|
271
|
-
point2Widget: null
|
|
272
|
-
}; // ----------------------------------------------------------------------------
|
|
273
|
-
|
|
274
|
-
function extend(publicAPI, model) {
|
|
275
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
276
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
277
|
-
|
|
278
|
-
vtkAbstractWidget.extend(publicAPI, model, initialValues);
|
|
279
|
-
model.point1Widget = vtkHandleWidget.newInstance();
|
|
280
|
-
model.point1Widget.setParent(publicAPI);
|
|
281
|
-
model.point1Widget.createDefaultRepresentation();
|
|
282
|
-
model.point2Widget = vtkHandleWidget.newInstance();
|
|
283
|
-
model.point2Widget.setParent(publicAPI);
|
|
284
|
-
model.point2Widget.createDefaultRepresentation(); // Object methods
|
|
285
|
-
|
|
286
|
-
vtkLineWidget(publicAPI, model);
|
|
287
|
-
} // ----------------------------------------------------------------------------
|
|
288
|
-
|
|
289
|
-
var newInstance = macro.newInstance(extend, 'vtkLineWidget'); // ----------------------------------------------------------------------------
|
|
290
|
-
|
|
291
|
-
var vtkLineWidget$1 = {
|
|
292
|
-
newInstance: newInstance,
|
|
293
|
-
extend: extend
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
export { vtkLineWidget$1 as default, extend, newInstance };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import macro from '../../macros.js';
|
|
2
|
-
import vtkCoordinate from '../../Rendering/Core/Coordinate.js';
|
|
3
|
-
|
|
4
|
-
// vtkPointPlacer methods
|
|
5
|
-
// ----------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
function vtkPointPlacer(publicAPI, model) {
|
|
8
|
-
// Set our className
|
|
9
|
-
model.classHierarchy.push('vtkPointPlacer');
|
|
10
|
-
|
|
11
|
-
publicAPI.computeWorldPosition = function (renderer, displayPos, worldPos) {
|
|
12
|
-
if (renderer) {
|
|
13
|
-
var dPos = vtkCoordinate.newInstance();
|
|
14
|
-
dPos.setCoordinateSystemToDisplay();
|
|
15
|
-
dPos.setValue(displayPos[0], displayPos[1]);
|
|
16
|
-
worldPos[0] = dPos.getComputedWorldValue(renderer)[0];
|
|
17
|
-
worldPos[1] = dPos.getComputedWorldValue(renderer)[1];
|
|
18
|
-
worldPos[2] = dPos.getComputedWorldValue(renderer)[2];
|
|
19
|
-
return 1;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return 0;
|
|
23
|
-
};
|
|
24
|
-
} // ----------------------------------------------------------------------------
|
|
25
|
-
// Object factory
|
|
26
|
-
// ----------------------------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var DEFAULT_VALUES = {
|
|
30
|
-
pixelTolerance: 5,
|
|
31
|
-
worldTolerance: 0.001
|
|
32
|
-
}; // ----------------------------------------------------------------------------
|
|
33
|
-
|
|
34
|
-
function extend(publicAPI, model) {
|
|
35
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
36
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
37
|
-
|
|
38
|
-
macro.obj(publicAPI, model);
|
|
39
|
-
macro.setGet(publicAPI, model, ['pixelTolerance', 'worldTolerance']); // Object methods
|
|
40
|
-
|
|
41
|
-
vtkPointPlacer(publicAPI, model);
|
|
42
|
-
} // ----------------------------------------------------------------------------
|
|
43
|
-
|
|
44
|
-
var newInstance = macro.newInstance(extend, 'vtkPointPlacer'); // ----------------------------------------------------------------------------
|
|
45
|
-
|
|
46
|
-
var vtkPointPlacer$1 = {
|
|
47
|
-
newInstance: newInstance,
|
|
48
|
-
extend: extend
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export { vtkPointPlacer$1 as default, extend, newInstance };
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import macro from '../../../macros.js';
|
|
4
|
-
import { j as cross, l as normalize, A as clampValue } from '../../../Common/Core/Math/index.js';
|
|
5
|
-
import vtkPolyData from '../../../Common/DataModel/PolyData.js';
|
|
6
|
-
import vtkPlane from '../../../Common/DataModel/Plane.js';
|
|
7
|
-
import vtkCellArray from '../../../Common/Core/CellArray.js';
|
|
8
|
-
import { CenterProjectionType } from './ResliceCursor/Constants.js';
|
|
9
|
-
|
|
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; }
|
|
11
|
-
|
|
12
|
-
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; }
|
|
13
|
-
var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
|
|
14
|
-
// vtkResliceCursor methods
|
|
15
|
-
// ----------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
function vtkResliceCursor(publicAPI, model) {
|
|
18
|
-
// Set our className
|
|
19
|
-
model.classHierarchy.push('vtkResliceCursor');
|
|
20
|
-
|
|
21
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
22
|
-
|
|
23
|
-
function projectCenterToFitBounds(center, bounds) {
|
|
24
|
-
if (center[0] >= bounds[0] && center[0] <= bounds[1] && center[1] >= bounds[2] && center[1] <= bounds[3] && center[2] >= bounds[4] && center[2] <= bounds[5]) {
|
|
25
|
-
return center;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
center[0] = clampValue(center[0], bounds[0], bounds[1]);
|
|
29
|
-
center[1] = clampValue(center[1], bounds[2], bounds[3]);
|
|
30
|
-
center[2] = clampValue(center[2], bounds[4], bounds[5]);
|
|
31
|
-
return center;
|
|
32
|
-
} //----------------------------------------------------------------------------
|
|
33
|
-
// Public API methods
|
|
34
|
-
//----------------------------------------------------------------------------
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
publicAPI.buildCursorTopology = function () {
|
|
38
|
-
for (var i = 0; i < 3; ++i) {
|
|
39
|
-
// Set number of points
|
|
40
|
-
model.centerlinesAxis[i].getPoints().setNumberOfPoints(2); // Define polys
|
|
41
|
-
|
|
42
|
-
var cellsData = new Float32Array(3);
|
|
43
|
-
var cells = vtkCellArray.newInstance({
|
|
44
|
-
values: cellsData
|
|
45
|
-
});
|
|
46
|
-
cellsData[0] = 2;
|
|
47
|
-
cellsData[1] = 0;
|
|
48
|
-
cellsData[2] = 1;
|
|
49
|
-
model.centerlinesAxis[i].setLines(cells);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
publicAPI.buildCursorGeometry = function () {
|
|
54
|
-
publicAPI.computeAxes();
|
|
55
|
-
var bounds = model.image.getBounds(); // Length of the principal diagonal.
|
|
56
|
-
|
|
57
|
-
var pdLength = 20 * 0.5 * Math.sqrt((bounds[1] - bounds[0]) * (bounds[1] - bounds[0]) + (bounds[3] - bounds[2]) * (bounds[3] - bounds[2]) + (bounds[5] - bounds[4]) * (bounds[5] - bounds[4])); // Precompute prior to use within the loop.
|
|
58
|
-
|
|
59
|
-
var pts = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
|
60
|
-
|
|
61
|
-
for (var i = 0; i < 3; i++) {
|
|
62
|
-
pts[0][i] = model.center[i] - pdLength * model.xAxis[i];
|
|
63
|
-
pts[1][i] = model.center[i] + pdLength * model.xAxis[i];
|
|
64
|
-
pts[2][i] = model.center[i] - pdLength * model.yAxis[i];
|
|
65
|
-
pts[3][i] = model.center[i] + pdLength * model.yAxis[i];
|
|
66
|
-
pts[4][i] = model.center[i] - pdLength * model.zAxis[i];
|
|
67
|
-
pts[5][i] = model.center[i] + pdLength * model.zAxis[i];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
for (var j = 0; j < 3; j++) {
|
|
71
|
-
var points = model.centerlinesAxis[j].getPoints();
|
|
72
|
-
var pointsData = points.getData();
|
|
73
|
-
pointsData[0] = pts[2 * j][0];
|
|
74
|
-
pointsData[1] = pts[2 * j][1];
|
|
75
|
-
pointsData[2] = pts[2 * j][2];
|
|
76
|
-
pointsData[3] = pts[2 * j + 1][0];
|
|
77
|
-
pointsData[4] = pts[2 * j + 1][1];
|
|
78
|
-
pointsData[5] = pts[2 * j + 1][2];
|
|
79
|
-
model.centerlinesAxis[j].modified();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
model.polyDataBuildTime.modified();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
publicAPI.computeAxes = function () {
|
|
86
|
-
var normals = [];
|
|
87
|
-
|
|
88
|
-
for (var i = 0; i < 3; ++i) {
|
|
89
|
-
normals[i] = publicAPI.getPlane(i).getNormal();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
cross(normals[0], normals[1], model.zAxis);
|
|
93
|
-
cross(normals[1], normals[2], model.xAxis);
|
|
94
|
-
cross(normals[2], normals[0], model.yAxis);
|
|
95
|
-
normalize(model.xAxis);
|
|
96
|
-
normalize(model.yAxis);
|
|
97
|
-
normalize(model.zAxis);
|
|
98
|
-
}; // Reset cursor to its initial position
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
publicAPI.reset = function () {
|
|
102
|
-
model.xAxis = [1, 0, 0];
|
|
103
|
-
model.yAxis = [0, 1, 0];
|
|
104
|
-
model.zAxis = [0, 0, 1];
|
|
105
|
-
model.xViewUp = [0, 0, 1];
|
|
106
|
-
model.yViewUp = [0, 0, 1];
|
|
107
|
-
model.zViewUp = [0, -1, 0];
|
|
108
|
-
|
|
109
|
-
if (publicAPI.getImage()) {
|
|
110
|
-
model.center = publicAPI.getImage().getCenter();
|
|
111
|
-
} else {
|
|
112
|
-
model.center = [0, 0, 0];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for (var i = 0; i < 3; ++i) {
|
|
116
|
-
publicAPI.getPlane(i).setOrigin(model.center);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
model.reslicePlanes[0].setNormal([1, 0, 0]);
|
|
120
|
-
model.reslicePlanes[1].setNormal([0, -1, 0]);
|
|
121
|
-
model.reslicePlanes[2].setNormal([0, 0, 1]);
|
|
122
|
-
publicAPI.buildCursorTopology();
|
|
123
|
-
publicAPI.buildCursorGeometry();
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
publicAPI.getPlane = function (i) {
|
|
127
|
-
return model.reslicePlanes[i];
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
publicAPI.update = function () {
|
|
131
|
-
if (!publicAPI.getImage()) {
|
|
132
|
-
vtkErrorMacro('Image not set! ');
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (publicAPI.getMTime() > model.polyDataBuildTime.getMTime()) {
|
|
137
|
-
publicAPI.buildCursorTopology();
|
|
138
|
-
publicAPI.buildCursorGeometry();
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
publicAPI.getPolyData = function () {
|
|
143
|
-
publicAPI.update();
|
|
144
|
-
return model.polyData;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
publicAPI.setCenter = function (center) {
|
|
148
|
-
var centerProjectionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CenterProjectionType.INSIDE_BOUNDS;
|
|
149
|
-
|
|
150
|
-
if (model.center[0] === center[0] && model.center[1] === center[1] && model.center[2] === center[2]) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (model.image) {
|
|
155
|
-
var bounds = model.image.getBounds();
|
|
156
|
-
|
|
157
|
-
var newCenter = _toConsumableArray(center);
|
|
158
|
-
|
|
159
|
-
if (centerProjectionType === CenterProjectionType.INSIDE_BOUNDS && (newCenter[0] < bounds[0] || newCenter[0] > bounds[1] || newCenter[1] < bounds[2] || newCenter[1] > bounds[3] || newCenter[2] < bounds[4] || newCenter[2] > bounds[5])) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (centerProjectionType === CenterProjectionType.FIT_BOUNDS) {
|
|
164
|
-
newCenter = projectCenterToFitBounds(newCenter, bounds);
|
|
165
|
-
|
|
166
|
-
if (newCenter.length !== 3) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
model.center = newCenter;
|
|
172
|
-
publicAPI.getPlane(0).setOrigin(model.center);
|
|
173
|
-
publicAPI.getPlane(1).setOrigin(model.center);
|
|
174
|
-
publicAPI.getPlane(2).setOrigin(model.center);
|
|
175
|
-
publicAPI.modified();
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
publicAPI.getCenterlineAxisPolyData = function (axis) {
|
|
180
|
-
publicAPI.update();
|
|
181
|
-
return model.centerlinesAxis[axis];
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
publicAPI.getAxis = function (i) {
|
|
185
|
-
if (i === 0) {
|
|
186
|
-
return model.xAxis;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (i === 1) {
|
|
190
|
-
return model.yAxis;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return model.zAxis;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
publicAPI.getViewUp = function (i) {
|
|
197
|
-
if (i === 0) {
|
|
198
|
-
return model.xViewUp;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (i === 1) {
|
|
202
|
-
return model.yViewUp;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return model.zViewUp;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
publicAPI.getMTime = function () {
|
|
209
|
-
var mTime = superClass.getMTime();
|
|
210
|
-
|
|
211
|
-
for (var i = 0; i < 3; ++i) {
|
|
212
|
-
var planeMTime = publicAPI.getPlane(i).getMTime();
|
|
213
|
-
|
|
214
|
-
if (planeMTime > mTime) {
|
|
215
|
-
mTime = planeMTime;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return mTime;
|
|
220
|
-
};
|
|
221
|
-
} // ----------------------------------------------------------------------------
|
|
222
|
-
// Object factory
|
|
223
|
-
// ----------------------------------------------------------------------------
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
var DEFAULT_VALUES = {
|
|
227
|
-
image: null,
|
|
228
|
-
center: [0, 0, 0],
|
|
229
|
-
xAxis: [1, 0, 0],
|
|
230
|
-
yAxis: [0, 1, 0],
|
|
231
|
-
zAxis: [0, 0, 1],
|
|
232
|
-
xViewUp: [0, 0, 1],
|
|
233
|
-
yViewUp: [0, 0, 1],
|
|
234
|
-
zViewUp: [0, -1, 0]
|
|
235
|
-
}; // ----------------------------------------------------------------------------
|
|
236
|
-
|
|
237
|
-
function extend(publicAPI, model) {
|
|
238
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
239
|
-
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
240
|
-
macro.obj(publicAPI, model);
|
|
241
|
-
macro.setGet(publicAPI, model, ['image']);
|
|
242
|
-
macro.setGetArray(publicAPI, model, ['xAxis', 'yAxis', 'zAxis', 'xViewUp', 'yViewUp', 'zViewUp'], 3);
|
|
243
|
-
macro.getArray(publicAPI, model, ['center'], 3);
|
|
244
|
-
model.reslicePlanes = [];
|
|
245
|
-
model.centerlinesAxis = [];
|
|
246
|
-
model.polyDataBuildTime = {};
|
|
247
|
-
macro.obj(model.polyDataBuildTime); // Object methods
|
|
248
|
-
|
|
249
|
-
vtkResliceCursor(publicAPI, model);
|
|
250
|
-
|
|
251
|
-
for (var i = 0; i < 3; ++i) {
|
|
252
|
-
model.reslicePlanes.push(vtkPlane.newInstance());
|
|
253
|
-
model.centerlinesAxis.push(vtkPolyData.newInstance());
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
model.reslicePlanes[0].setNormal([1, 0, 0]);
|
|
257
|
-
model.reslicePlanes[1].setNormal([0, -1, 0]);
|
|
258
|
-
model.reslicePlanes[2].setNormal([0, 0, -1]);
|
|
259
|
-
publicAPI.buildCursorTopology();
|
|
260
|
-
} // ----------------------------------------------------------------------------
|
|
261
|
-
|
|
262
|
-
var newInstance = macro.newInstance(extend, 'vtkResliceCursor'); // ----------------------------------------------------------------------------
|
|
263
|
-
|
|
264
|
-
var vtkResliceCursor$1 = {
|
|
265
|
-
newInstance: newInstance,
|
|
266
|
-
extend: extend
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export { vtkResliceCursor$1 as default, extend, newInstance };
|