@kitware/vtk.js 26.3.1 → 26.4.0
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/DataModel/Collection.d.ts +118 -0
- package/Common/DataModel/Collection.js +113 -0
- package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
- package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
- package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
- package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
- package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
- package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
- package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
- package/Interaction/Style/InteractorStyleManipulator.d.ts +333 -0
- package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
- package/Proxy/Core/LookupTableProxy.d.ts +45 -0
- package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
- package/Proxy/Core/ProxyManager.d.ts +81 -0
- package/Proxy/Core/SourceProxy.d.ts +22 -0
- package/Proxy/Core/View2DProxy.d.ts +7 -0
- package/Proxy/Core/ViewProxy.d.ts +86 -0
- package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
- package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
- package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
- package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
- package/Rendering/Core/AbstractImageMapper.js +42 -0
- package/Rendering/Core/CellPicker.js +1 -1
- package/Rendering/Core/ImageArrayMapper.d.ts +252 -0
- package/Rendering/Core/ImageArrayMapper.js +242 -0
- package/Rendering/Core/ImageMapper.d.ts +5 -35
- package/Rendering/Core/ImageMapper.js +16 -108
- package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
- package/Rendering/Core/InteractorStyle.d.ts +229 -0
- package/Rendering/Core/PointPicker.js +1 -1
- package/Rendering/OpenGL/CellArrayBufferObject.js +1 -1
- package/Rendering/OpenGL/ImageMapper.js +13 -7
- package/Rendering/OpenGL/PolyDataMapper.js +8 -7
- package/Rendering/OpenGL/RenderWindow.d.ts +8 -1
- package/Rendering/OpenGL/RenderWindow.js +3 -2
- package/Rendering/OpenGL/Texture.js +13 -12
- package/Widgets/Core/StateBuilder.d.ts +29 -0
- package/index.d.ts +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { EventHandler, vtkSubscription } from './../../interfaces';
|
|
2
|
+
import vtkInteractorObserver from './InteractorObserver';
|
|
3
|
+
|
|
4
|
+
export interface vtkInteractorStyle extends vtkInteractorObserver {
|
|
5
|
+
/**
|
|
6
|
+
* Start a Rotate event.
|
|
7
|
+
*/
|
|
8
|
+
startRotate(): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Invoke a StartRotate event.
|
|
12
|
+
*/
|
|
13
|
+
invokeStartRotateEvent(...args: unknown[]): void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Registers a callback on a StartRotate event.
|
|
17
|
+
*/
|
|
18
|
+
onStartRotateEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Ends a Rotate event.
|
|
22
|
+
*/
|
|
23
|
+
endRotate(): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Invoke an EndRotate event.
|
|
27
|
+
*/
|
|
28
|
+
invokeEndRotateEvent(...args: unknown[]): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Registers a callback on an EndRotate event.
|
|
32
|
+
*/
|
|
33
|
+
onEndRotateEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
34
|
+
/**
|
|
35
|
+
* Start a Pan event.
|
|
36
|
+
*/
|
|
37
|
+
startPan(): void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Invoke a StartPan event.
|
|
41
|
+
*/
|
|
42
|
+
invokeStartPanEvent(...args: unknown[]): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Registers a callback on a StartPan event.
|
|
46
|
+
*/
|
|
47
|
+
onStartPanEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Ends a Pan event.
|
|
51
|
+
*/
|
|
52
|
+
endPan(): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Invoke an EndPan event.
|
|
56
|
+
*/
|
|
57
|
+
invokeEndPanEvent(...args: unknown[]): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Registers a callback on an EndPan event.
|
|
61
|
+
*/
|
|
62
|
+
onEndPanEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
63
|
+
/**
|
|
64
|
+
* Start a Spin event.
|
|
65
|
+
*/
|
|
66
|
+
startSpin(): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Invoke a StartSpin event.
|
|
70
|
+
*/
|
|
71
|
+
invokeStartSpinEvent(...args: unknown[]): void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Registers a callback on a StartSpin event.
|
|
75
|
+
*/
|
|
76
|
+
onStartSpinEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Ends a Spin event.
|
|
80
|
+
*/
|
|
81
|
+
endSpin(): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Invoke an EndSpin event.
|
|
85
|
+
*/
|
|
86
|
+
invokeEndSpinEvent(...args: unknown[]): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Registers a callback on an EndSpin event.
|
|
90
|
+
*/
|
|
91
|
+
onEndSpinEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
92
|
+
/**
|
|
93
|
+
* Start a Dolly event.
|
|
94
|
+
*/
|
|
95
|
+
startDolly(): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Invoke a StartDolly event.
|
|
99
|
+
*/
|
|
100
|
+
invokeStartDollyEvent(...args: unknown[]): void;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Registers a callback on a StartDolly event.
|
|
104
|
+
*/
|
|
105
|
+
onStartDollyEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Ends a Dolly event.
|
|
109
|
+
*/
|
|
110
|
+
endDolly(): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Invoke an EndDolly event.
|
|
114
|
+
*/
|
|
115
|
+
invokeEndDollyEvent(...args: unknown[]): void;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Registers a callback on an EndDolly event.
|
|
119
|
+
*/
|
|
120
|
+
onEndDollyEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
121
|
+
/**
|
|
122
|
+
* Start a CameraPose event.
|
|
123
|
+
*/
|
|
124
|
+
startCameraPose(): void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Invoke a StartCameraPose event.
|
|
128
|
+
*/
|
|
129
|
+
invokeStartCameraPoseEvent(...args: unknown[]): void;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Registers a callback on a StartCameraPose event.
|
|
133
|
+
*/
|
|
134
|
+
onStartCameraPoseEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Ends a CameraPose event.
|
|
138
|
+
*/
|
|
139
|
+
endCameraPose(): void;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Invoke an EndCameraPose event.
|
|
143
|
+
*/
|
|
144
|
+
invokeEndCameraPoseEvent(...args: unknown[]): void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Registers a callback on an EndCameraPose event.
|
|
148
|
+
*/
|
|
149
|
+
onEndCameraPoseEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
150
|
+
/**
|
|
151
|
+
* Start a WindowLevel event.
|
|
152
|
+
*/
|
|
153
|
+
startWindowLevel(): void;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Invoke a StartWindowLevel event.
|
|
157
|
+
*/
|
|
158
|
+
invokeStartWindowLevelEvent(...args: unknown[]): void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Registers a callback on a StartWindowLevel event.
|
|
162
|
+
*/
|
|
163
|
+
onStartWindowLevelEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Ends a WindowLevel event.
|
|
167
|
+
*/
|
|
168
|
+
endWindowLevel(): void;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Invoke an EndWindowLevel event.
|
|
172
|
+
*/
|
|
173
|
+
invokeEndWindowLevelEvent(...args: unknown[]): void;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Registers a callback on an EndWindowLevel event.
|
|
177
|
+
*/
|
|
178
|
+
onEndWindowLevelEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
179
|
+
/**
|
|
180
|
+
* Start a Slice event.
|
|
181
|
+
*/
|
|
182
|
+
startSlice(): void;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Invoke a StartSlice event.
|
|
186
|
+
*/
|
|
187
|
+
invokeStartSliceEvent(...args: unknown[]): void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Registers a callback on a StartSlice event.
|
|
191
|
+
*/
|
|
192
|
+
onStartSliceEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Ends a Slice event.
|
|
196
|
+
*/
|
|
197
|
+
endSlice(): void;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Invoke an EndSlice event.
|
|
201
|
+
*/
|
|
202
|
+
invokeEndSliceEvent(...args: unknown[]): void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Registers a callback on an EndSlice event.
|
|
206
|
+
*/
|
|
207
|
+
onEndSliceEvent(cb: EventHandler, priority?: number): vtkSubscription;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Handles a keypress.
|
|
211
|
+
*/
|
|
212
|
+
handleKeyPress(callData: unknown): void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface IInteractorStyleInitialValues {
|
|
216
|
+
autoAdjustCameraClippingRange?: boolean;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function extend(
|
|
220
|
+
publicAPI: object,
|
|
221
|
+
model: object,
|
|
222
|
+
initialValues?: IInteractorStyleInitialValues
|
|
223
|
+
): void;
|
|
224
|
+
|
|
225
|
+
export const vtkInteractorStyle: {
|
|
226
|
+
extend: typeof extend;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export default vtkInteractorStyle;
|
|
@@ -13,7 +13,7 @@ function vtkPointPicker(publicAPI, model) {
|
|
|
13
13
|
publicAPI.intersectWithLine = function (p1, p2, tol, mapper) {
|
|
14
14
|
var tMin = Number.MAX_VALUE;
|
|
15
15
|
|
|
16
|
-
if (mapper.isA('vtkImageMapper')) {
|
|
16
|
+
if (mapper.isA('vtkImageMapper') || mapper.isA('vtkImageArrayMapper')) {
|
|
17
17
|
var pickData = mapper.intersectWithLineForPointPicking(p1, p2);
|
|
18
18
|
|
|
19
19
|
if (pickData) {
|
|
@@ -288,7 +288,7 @@ function vtkOpenGLCellArrayBufferObject(publicAPI, model) {
|
|
|
288
288
|
// Keep track of original point and cell ids, for selection
|
|
289
289
|
if (selectionMaps) {
|
|
290
290
|
selectionMaps.points[pointCount] = i;
|
|
291
|
-
selectionMaps.cells[pointCount] = cellCount;
|
|
291
|
+
selectionMaps.cells[pointCount] = cellCount + options.cellOffset;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
++pointCount; // Vertices
|
|
@@ -55,7 +55,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
55
55
|
|
|
56
56
|
model.openGLCamera = model._openGLRenderer.getViewNodeFor(ren.getActiveCamera()); // is slice set by the camera
|
|
57
57
|
|
|
58
|
-
if (model.renderable.getSliceAtFocalPoint()) {
|
|
58
|
+
if (model.renderable.isA('vtkImageMapper') && model.renderable.getSliceAtFocalPoint()) {
|
|
59
59
|
model.renderable.setSliceFromCamera(ren.getActiveCamera());
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -495,7 +495,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
495
495
|
type: 'StartEvent'
|
|
496
496
|
});
|
|
497
497
|
model.renderable.update();
|
|
498
|
-
model.currentInput = model.renderable.
|
|
498
|
+
model.currentInput = model.renderable.getCurrentImage();
|
|
499
499
|
publicAPI.invokeEvent({
|
|
500
500
|
type: 'EndEvent'
|
|
501
501
|
});
|
|
@@ -548,6 +548,11 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
|
+
var dataType = imgScalars.getDataType();
|
|
552
|
+
var numComp = imgScalars.getNumberOfComponents(); // Re-allocate the texture because vtkOpenGLTexture uses texStorage2D
|
|
553
|
+
// which makes the texture immutable.
|
|
554
|
+
|
|
555
|
+
model.openGLTexture.releaseGraphicsResources(model._openGLRenderWindow);
|
|
551
556
|
var actorProperty = actor.getProperty(); // set interpolation on the texture based on property setting
|
|
552
557
|
|
|
553
558
|
var iType = actorProperty.getInterpolationType();
|
|
@@ -564,8 +569,6 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
564
569
|
model.pwfTexture.setMagnificationFilter(Filter.LINEAR);
|
|
565
570
|
}
|
|
566
571
|
|
|
567
|
-
var dataType = imgScalars.getDataType();
|
|
568
|
-
var numComp = imgScalars.getNumberOfComponents();
|
|
569
572
|
var iComps = actorProperty.getIndependentComponents();
|
|
570
573
|
var numIComps = iComps ? numComp : 1;
|
|
571
574
|
var textureHeight = iComps ? 2 * numIComps : 1;
|
|
@@ -672,9 +675,12 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
672
675
|
if (ijkMode !== model.renderable.getSlicingMode()) {
|
|
673
676
|
// If not IJK slicing, get the IJK slice from the XYZ position/slice
|
|
674
677
|
slice = model.renderable.getSliceAtPosition(slice);
|
|
675
|
-
}
|
|
678
|
+
} // Use sub-Slice number/offset if mapper being used is vtkImageArrayMapper,
|
|
679
|
+
// since this mapper uses a collection of vtkImageData (and not just a single vtkImageData).
|
|
680
|
+
|
|
676
681
|
|
|
677
|
-
var nSlice =
|
|
682
|
+
var nSlice = model.renderable.isA('vtkImageArrayMapper') ? model.renderable.getSubSlice() // get subSlice of the current (possibly multi-frame) image
|
|
683
|
+
: Math.round(slice); // Find sliceOffset
|
|
678
684
|
|
|
679
685
|
var ext = image.getExtent();
|
|
680
686
|
var sliceOffset;
|
|
@@ -889,6 +895,6 @@ var vtkImageMapper = {
|
|
|
889
895
|
extend: extend
|
|
890
896
|
}; // Register ourself to OpenGL backend if imported
|
|
891
897
|
|
|
892
|
-
registerOverride('
|
|
898
|
+
registerOverride('vtkAbstractImageMapper', newInstance);
|
|
893
899
|
|
|
894
900
|
export { vtkImageMapper as default, extend, newInstance };
|
|
@@ -1070,9 +1070,9 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
|
|
|
1070
1070
|
|
|
1071
1071
|
if (cabo.getElementCount()) {
|
|
1072
1072
|
// are we drawing edges
|
|
1073
|
-
model.drawingEdges = drawSurfaceWithEdges && (i === primTypes.TrisEdges || i === primTypes.TriStripsEdges);
|
|
1073
|
+
model.drawingEdges = drawSurfaceWithEdges && (i === primTypes.TrisEdges || i === primTypes.TriStripsEdges); // don't draw edges when rendering depth or rendering for picking
|
|
1074
1074
|
|
|
1075
|
-
if (!model.drawingEdges || !model.renderDepth) {
|
|
1075
|
+
if (!model.drawingEdges || !(model.renderDepth || model.lastSelectionState >= 0)) {
|
|
1076
1076
|
model.lastBoundBO = model.primitives[i];
|
|
1077
1077
|
model.primitiveIDOffset += model.primitives[i].drawArrays(ren, actor, representation, publicAPI);
|
|
1078
1078
|
model.vertexIDOffset += model.primitives[i].getCABO().getElementCount();
|
|
@@ -1274,8 +1274,7 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
|
|
|
1274
1274
|
inRep: 'strips',
|
|
1275
1275
|
cells: poly.getStrips()
|
|
1276
1276
|
}];
|
|
1277
|
-
var drawSurfaceWithEdges =
|
|
1278
|
-
actor.getProperty().getEdgeVisibility() && representation === Representation.SURFACE;
|
|
1277
|
+
var drawSurfaceWithEdges = actor.getProperty().getEdgeVisibility() && representation === Representation.SURFACE;
|
|
1279
1278
|
|
|
1280
1279
|
for (var i = primTypes.Start; i < primTypes.End; i++) {
|
|
1281
1280
|
if (i !== primTypes.TrisEdges && i !== primTypes.TriStripsEdges) {
|
|
@@ -1284,13 +1283,15 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
|
|
|
1284
1283
|
} else {
|
|
1285
1284
|
// if we have edge visibility build the edge VBOs
|
|
1286
1285
|
if (drawSurfaceWithEdges) {
|
|
1287
|
-
|
|
1286
|
+
// VBOs for edges in "surface with edges" are the last to be built,
|
|
1287
|
+
// they are not used when picking with a hardware selector so they
|
|
1288
|
+
// don't need selectionWebGLIdsToVTKIds and don't update cellOffset and vertexOffset
|
|
1289
|
+
model.primitives[i].getCABO().createVBO(primitives[i].cells, primitives[i].inRep, Representation.WIREFRAME, _objectSpread(_objectSpread({}, options), {}, {
|
|
1288
1290
|
tcoords: null,
|
|
1289
1291
|
colors: null,
|
|
1290
1292
|
haveCellScalars: false,
|
|
1291
1293
|
haveCellNormals: false
|
|
1292
|
-
})
|
|
1293
|
-
options.vertexOffset += model.primitives[i].getCABO().getElementCount();
|
|
1294
|
+
}));
|
|
1294
1295
|
} else {
|
|
1295
1296
|
// otherwise free them
|
|
1296
1297
|
model.primitives[i].releaseGraphicsResources();
|
|
@@ -96,6 +96,11 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
|
|
|
96
96
|
*/
|
|
97
97
|
getFramebufferSize(): Vector2;
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Get the webgl canvas.
|
|
101
|
+
*/
|
|
102
|
+
getCanvas(): Nullable<HTMLCanvasElement>;
|
|
103
|
+
|
|
99
104
|
/**
|
|
100
105
|
* Check if a point is in the viewport.
|
|
101
106
|
* @param {Number} x The x coordinate.
|
|
@@ -269,8 +274,10 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
|
|
|
269
274
|
* @param {VtkDataTypes} vtktype
|
|
270
275
|
* @param {Number} numComps
|
|
271
276
|
* @param {Boolean} useFloat
|
|
277
|
+
* @param {unknown} oglNorm16Ext The WebGL EXT_texture_norm16 extension context
|
|
278
|
+
* @param {Boolean} useHalfFloat
|
|
272
279
|
*/
|
|
273
|
-
getDefaultTextureInternalFormat(vtktype: VtkDataTypes, numComps: number, oglNorm16Ext?: unknown): void;
|
|
280
|
+
getDefaultTextureInternalFormat(vtktype: VtkDataTypes, numComps: number, oglNorm16Ext?: unknown, useHalfFloat?: boolean): void;
|
|
274
281
|
|
|
275
282
|
/**
|
|
276
283
|
*
|
|
@@ -541,6 +541,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
541
541
|
|
|
542
542
|
publicAPI.getDefaultTextureInternalFormat = function (vtktype, numComps) {
|
|
543
543
|
var oglNorm16Ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
544
|
+
var useHalfFloat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
544
545
|
|
|
545
546
|
if (model.webgl2) {
|
|
546
547
|
switch (vtktype) {
|
|
@@ -560,7 +561,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
560
561
|
return model.context.RGBA8;
|
|
561
562
|
}
|
|
562
563
|
|
|
563
|
-
case oglNorm16Ext && VtkDataTypes.UNSIGNED_SHORT:
|
|
564
|
+
case oglNorm16Ext && !useHalfFloat && VtkDataTypes.UNSIGNED_SHORT:
|
|
564
565
|
switch (numComps) {
|
|
565
566
|
case 1:
|
|
566
567
|
return oglNorm16Ext.R16_EXT;
|
|
@@ -578,7 +579,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
578
579
|
|
|
579
580
|
// prioritize norm16 over float
|
|
580
581
|
|
|
581
|
-
case oglNorm16Ext && VtkDataTypes.SHORT:
|
|
582
|
+
case oglNorm16Ext && !useHalfFloat && VtkDataTypes.SHORT:
|
|
582
583
|
switch (numComps) {
|
|
583
584
|
case 1:
|
|
584
585
|
return oglNorm16Ext.R16_SNORM_EXT;
|
|
@@ -311,7 +311,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
311
311
|
publicAPI.getDefaultInternalFormat = function (vtktype, numComps) {
|
|
312
312
|
var result = 0; // try default next
|
|
313
313
|
|
|
314
|
-
result = model._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps, model.oglNorm16Ext);
|
|
314
|
+
result = model._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps, model.oglNorm16Ext, model.useHalfFloat);
|
|
315
315
|
|
|
316
316
|
if (result) {
|
|
317
317
|
return result;
|
|
@@ -401,10 +401,10 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
401
401
|
// prefer norm16 since that is accurate compared to
|
|
402
402
|
// half float which is not
|
|
403
403
|
|
|
404
|
-
case model.oglNorm16Ext && VtkDataTypes.SHORT:
|
|
404
|
+
case model.oglNorm16Ext && !model.useHalfFloat && VtkDataTypes.SHORT:
|
|
405
405
|
return model.context.SHORT;
|
|
406
406
|
|
|
407
|
-
case model.oglNorm16Ext && VtkDataTypes.UNSIGNED_SHORT:
|
|
407
|
+
case model.oglNorm16Ext && !model.useHalfFloat && VtkDataTypes.UNSIGNED_SHORT:
|
|
408
408
|
return model.context.UNSIGNED_SHORT;
|
|
409
409
|
// use half float type
|
|
410
410
|
|
|
@@ -728,7 +728,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
728
728
|
publicAPI.create2DFromRaw = function (width, height, numComps, dataType, data) {
|
|
729
729
|
var flip = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
730
730
|
// Now determine the texture parameters using the arguments.
|
|
731
|
-
publicAPI.getOpenGLDataType(dataType);
|
|
731
|
+
publicAPI.getOpenGLDataType(dataType, true);
|
|
732
732
|
publicAPI.getInternalFormat(dataType, numComps);
|
|
733
733
|
publicAPI.getFormat(dataType, numComps);
|
|
734
734
|
|
|
@@ -1148,9 +1148,10 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1148
1148
|
computedScale = _computeScaleOffsets.scale;
|
|
1149
1149
|
|
|
1150
1150
|
model.volumeInfo.dataComputedScale = computedScale;
|
|
1151
|
-
model.volumeInfo.dataComputedOffset = computedOffset; //
|
|
1151
|
+
model.volumeInfo.dataComputedOffset = computedOffset; // preferSizeOverAccuracy will override norm16 due to bug with norm16 implementation
|
|
1152
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1408247
|
|
1152
1153
|
|
|
1153
|
-
model.useHalfFloat =
|
|
1154
|
+
model.useHalfFloat = checkUseHalfFloat(dataType, computedOffset, computedScale, preferSizeOverAccuracy); // since our default is to use half float, in case that we can't use it
|
|
1154
1155
|
// we need to use another type
|
|
1155
1156
|
|
|
1156
1157
|
if (!model.useHalfFloat) {
|
|
@@ -1159,11 +1160,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1159
1160
|
|
|
1160
1161
|
|
|
1161
1162
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1162
|
-
if (
|
|
1163
|
-
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
if (model.oglNorm16Ext && dataType === VtkDataTypes.SHORT) {
|
|
1163
|
+
if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.SHORT) {
|
|
1167
1164
|
for (var _c3 = 0; _c3 < numComps; ++_c3) {
|
|
1168
1165
|
model.volumeInfo.scale[_c3] = 32767.0;
|
|
1169
1166
|
}
|
|
@@ -1171,7 +1168,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1171
1168
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1172
1169
|
}
|
|
1173
1170
|
|
|
1174
|
-
if (model.oglNorm16Ext && dataType === VtkDataTypes.UNSIGNED_SHORT) {
|
|
1171
|
+
if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.UNSIGNED_SHORT) {
|
|
1175
1172
|
for (var _c4 = 0; _c4 < numComps; ++_c4) {
|
|
1176
1173
|
model.volumeInfo.scale[_c4] = 65535.0;
|
|
1177
1174
|
}
|
|
@@ -1179,6 +1176,10 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1179
1176
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1180
1177
|
}
|
|
1181
1178
|
|
|
1179
|
+
if (dataType === VtkDataTypes.FLOAT || model.useHalfFloat && (dataType === VtkDataTypes.SHORT || dataType === VtkDataTypes.UNSIGNED_SHORT)) {
|
|
1180
|
+
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1182
1183
|
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1183
1184
|
for (var _c5 = 0; _c5 < numComps; ++_c5) {
|
|
1184
1185
|
model.volumeInfo.scale[_c5] = 255.0;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import vtkWidgetState from './WidgetState';
|
|
2
|
+
|
|
3
|
+
export interface StateBuilder {
|
|
4
|
+
addDynamicMixinState(buildInfo: {
|
|
5
|
+
labels: string[];
|
|
6
|
+
mixins: string[];
|
|
7
|
+
name: string;
|
|
8
|
+
initialValues?: object;
|
|
9
|
+
}): StateBuilder;
|
|
10
|
+
addStateFromMixin(buildInfo: {
|
|
11
|
+
labels: string[];
|
|
12
|
+
mixins: string[];
|
|
13
|
+
name: string;
|
|
14
|
+
initialValues?: object;
|
|
15
|
+
}): StateBuilder;
|
|
16
|
+
addStateFromInstance(stateInfo: {
|
|
17
|
+
labels: string[];
|
|
18
|
+
name: string;
|
|
19
|
+
instance: vtkWidgetState;
|
|
20
|
+
});
|
|
21
|
+
addField(field: { name: string; initialValue: any });
|
|
22
|
+
build(...mixins: string[]): vtkWidgetState;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function createBuilder(): StateBuilder;
|
|
26
|
+
|
|
27
|
+
export declare const vtkStateBuilder: {
|
|
28
|
+
createBuilder: typeof createBuilder;
|
|
29
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
/// <reference path="./Common/DataModel/Box.d.ts" />
|
|
21
21
|
/// <reference path="./Common/DataModel/CardinalSpline1D.d.ts" />
|
|
22
22
|
/// <reference path="./Common/DataModel/Cell.d.ts" />
|
|
23
|
+
/// <reference path="./Common/DataModel/Collection.d.ts" />
|
|
23
24
|
/// <reference path="./Common/DataModel/Cone.d.ts" />
|
|
24
25
|
/// <reference path="./Common/DataModel/Cylinder.d.ts" />
|
|
25
26
|
/// <reference path="./Common/DataModel/DataSet/Constants.d.ts" />
|
|
@@ -100,8 +101,33 @@
|
|
|
100
101
|
/// <reference path="./IO/XML/XMLImageDataReader.d.ts" />
|
|
101
102
|
/// <reference path="./IO/XML/XMLPolyDataReader.d.ts" />
|
|
102
103
|
/// <reference path="./IO/XML/XMLReader.d.ts" />
|
|
104
|
+
/// <reference path="./Interaction/Manipulators/CompositeCameraManipulator.d.ts" />
|
|
105
|
+
/// <reference path="./Interaction/Manipulators/CompositeGestureManipulator.d.ts" />
|
|
106
|
+
/// <reference path="./Interaction/Manipulators/CompositeKeyboardManipulator.d.ts" />
|
|
107
|
+
/// <reference path="./Interaction/Manipulators/CompositeMouseManipulator.d.ts" />
|
|
108
|
+
/// <reference path="./Interaction/Manipulators/CompositeVRManipulator.d.ts" />
|
|
109
|
+
/// <reference path="./Interaction/Manipulators/GestureCameraManipulator.d.ts" />
|
|
110
|
+
/// <reference path="./Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts" />
|
|
111
|
+
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts" />
|
|
112
|
+
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts" />
|
|
113
|
+
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts" />
|
|
114
|
+
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts" />
|
|
115
|
+
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts" />
|
|
116
|
+
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts" />
|
|
117
|
+
/// <reference path="./Interaction/Manipulators/MouseRangeManipulator.d.ts" />
|
|
118
|
+
/// <reference path="./Interaction/Style/InteractorStyleManipulator.d.ts" />
|
|
103
119
|
/// <reference path="./Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts" />
|
|
104
120
|
/// <reference path="./Interaction/Widgets/OrientationMarkerWidget.d.ts" />
|
|
121
|
+
/// <reference path="./Proxy/Core/AbstractRepresentationProxy.d.ts" />
|
|
122
|
+
/// <reference path="./Proxy/Core/LookupTableProxy.d.ts" />
|
|
123
|
+
/// <reference path="./Proxy/Core/PiecewiseFunctionProxy.d.ts" />
|
|
124
|
+
/// <reference path="./Proxy/Core/ProxyManager.d.ts" />
|
|
125
|
+
/// <reference path="./Proxy/Core/SourceProxy.d.ts" />
|
|
126
|
+
/// <reference path="./Proxy/Core/View2DProxy.d.ts" />
|
|
127
|
+
/// <reference path="./Proxy/Core/ViewProxy.d.ts" />
|
|
128
|
+
/// <reference path="./Proxy/Representations/SliceRepresentationProxy.d.ts" />
|
|
129
|
+
/// <reference path="./Proxy/Representations/VolumeRepresentationProxy.d.ts" />
|
|
130
|
+
/// <reference path="./Rendering/Core/AbstractImageMapper.d.ts" />
|
|
105
131
|
/// <reference path="./Rendering/Core/AbstractMapper.d.ts" />
|
|
106
132
|
/// <reference path="./Rendering/Core/AbstractMapper3D.d.ts" />
|
|
107
133
|
/// <reference path="./Rendering/Core/AbstractPicker.d.ts" />
|
|
@@ -119,12 +145,15 @@
|
|
|
119
145
|
/// <reference path="./Rendering/Core/Follower.d.ts" />
|
|
120
146
|
/// <reference path="./Rendering/Core/Glyph3DMapper/Constants.d.ts" />
|
|
121
147
|
/// <reference path="./Rendering/Core/Glyph3DMapper.d.ts" />
|
|
148
|
+
/// <reference path="./Rendering/Core/ImageArrayMapper.d.ts" />
|
|
122
149
|
/// <reference path="./Rendering/Core/ImageMapper/Constants.d.ts" />
|
|
123
150
|
/// <reference path="./Rendering/Core/ImageMapper.d.ts" />
|
|
124
151
|
/// <reference path="./Rendering/Core/ImageProperty/Constants.d.ts" />
|
|
125
152
|
/// <reference path="./Rendering/Core/ImageProperty.d.ts" />
|
|
126
153
|
/// <reference path="./Rendering/Core/ImageSlice.d.ts" />
|
|
127
154
|
/// <reference path="./Rendering/Core/InteractorObserver.d.ts" />
|
|
155
|
+
/// <reference path="./Rendering/Core/InteractorStyle/Constants.d.ts" />
|
|
156
|
+
/// <reference path="./Rendering/Core/InteractorStyle.d.ts" />
|
|
128
157
|
/// <reference path="./Rendering/Core/Light.d.ts" />
|
|
129
158
|
/// <reference path="./Rendering/Core/Mapper/Constants.d.ts" />
|
|
130
159
|
/// <reference path="./Rendering/Core/Mapper.d.ts" />
|
|
@@ -168,6 +197,7 @@
|
|
|
168
197
|
/// <reference path="./Rendering/SceneGraph/ViewNodeFactory.d.ts" />
|
|
169
198
|
/// <reference path="./Widgets/Core/AbstractWidget.d.ts" />
|
|
170
199
|
/// <reference path="./Widgets/Core/AbstractWidgetFactory.d.ts" />
|
|
200
|
+
/// <reference path="./Widgets/Core/StateBuilder.d.ts" />
|
|
171
201
|
/// <reference path="./Widgets/Core/WidgetManager/Constants.d.ts" />
|
|
172
202
|
/// <reference path="./Widgets/Core/WidgetManager.d.ts" />
|
|
173
203
|
/// <reference path="./Widgets/Core/WidgetState.d.ts" />
|