@kitware/vtk.js 26.9.14 → 27.1.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/Interaction/Style/InteractorStyleImage.js +21 -2
- package/Rendering/Core/AbstractImageMapper.d.ts +3 -3
- package/Rendering/Core/AbstractImageMapper.js +5 -3
- package/Rendering/Core/AbstractMapper3D.js +9 -1
- package/Rendering/Core/ImageProperty/Constants.js +2 -2
- package/Rendering/Core/ImageProperty.js +2 -2
- package/Rendering/Core/ImageResliceMapper/Constants.d.ts +11 -0
- package/Rendering/Core/ImageResliceMapper/Constants.js +11 -0
- package/Rendering/Core/ImageResliceMapper.d.ts +245 -0
- package/Rendering/Core/ImageResliceMapper.js +70 -0
- package/Rendering/Core/Mapper.js +1 -7
- package/Rendering/Core.js +2 -0
- package/Rendering/OpenGL/ImageMapper.js +1 -11
- package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
- package/Rendering/OpenGL/PolyDataMapper.js +4 -81
- package/Rendering/OpenGL/PolyDataMapper2D.js +4 -75
- package/Rendering/OpenGL/Profiles/All.js +1 -0
- package/Rendering/OpenGL/Profiles/Volume.js +1 -0
- package/Rendering/OpenGL/ReplacementShaderMapper.js +80 -1
- package/Rendering/OpenGL/ShaderProgram.js +1 -1
- package/Rendering/OpenGL/Texture.js +2 -2
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
- package/Rendering/OpenGL.js +3 -1
- package/Rendering/Profiles/All.js +1 -0
- package/Rendering/Profiles/Volume.js +1 -0
- package/index.d.ts +2 -0
- package/package.json +3 -3
|
@@ -55,8 +55,13 @@ function vtkInteractorStyleImage(publicAPI, model) {
|
|
|
55
55
|
|
|
56
56
|
publicAPI.startWindowLevel();
|
|
57
57
|
} else if (model.interactionMode === 'IMAGE3D' && callData.shiftKey) {
|
|
58
|
-
// If shift is held down,
|
|
59
|
-
|
|
58
|
+
// If ctrl+shift or alt+shift is held down, dolly the camera
|
|
59
|
+
if (callData.controlKey || callData.altKey) {
|
|
60
|
+
publicAPI.startDolly();
|
|
61
|
+
} else {
|
|
62
|
+
// If shift is held down, rotate
|
|
63
|
+
publicAPI.startRotate();
|
|
64
|
+
}
|
|
60
65
|
} else if (model.interactionMode === 'IMAGE_SLICING' && callData.controlKey) {
|
|
61
66
|
// If ctrl is held down in slicing mode, slice the image
|
|
62
67
|
model.lastSlicePosition = pos.y;
|
|
@@ -113,6 +118,20 @@ function vtkInteractorStyleImage(publicAPI, model) {
|
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
camera.setDistance(distance);
|
|
121
|
+
var props = callData.pokedRenderer.getViewProps().filter(function (prop) {
|
|
122
|
+
return prop.isA('vtkImageSlice');
|
|
123
|
+
});
|
|
124
|
+
props.forEach(function (prop) {
|
|
125
|
+
if (prop.getMapper().isA('vtkImageResliceMapper')) {
|
|
126
|
+
var p = prop.getMapper().getSlicePlane();
|
|
127
|
+
|
|
128
|
+
if (p) {
|
|
129
|
+
p.push(callData.spinY);
|
|
130
|
+
p.modified();
|
|
131
|
+
prop.getMapper().modified();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
116
135
|
}; //----------------------------------------------------------------------------
|
|
117
136
|
|
|
118
137
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import vtkAbstractMapper3D, { IAbstractMapper3DInitialValues } from './AbstractMapper3D';
|
|
2
2
|
import vtkImageData from './../../Common/DataModel/ImageData';
|
|
3
3
|
import { Nullable } from './../../types';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
export interface IAbstractImageMapperInitialValues extends
|
|
6
|
+
export interface IAbstractImageMapperInitialValues extends IAbstractMapper3DInitialValues {
|
|
7
7
|
customDisplayExtent?: number[];
|
|
8
8
|
useCustomExtents?: boolean;
|
|
9
9
|
slice?: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export interface vtkAbstractImageMapper extends
|
|
12
|
+
export interface vtkAbstractImageMapper extends vtkAbstractMapper3D {
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
|
-
import
|
|
2
|
+
import vtkAbstractMapper3D from './AbstractMapper3D.js';
|
|
3
3
|
|
|
4
4
|
// vtkAbstractImageMapper methods
|
|
5
5
|
// ----------------------------------------------------------------------------
|
|
@@ -22,16 +22,18 @@ function vtkAbstractImageMapper(publicAPI, model) {
|
|
|
22
22
|
var DEFAULT_VALUES = {
|
|
23
23
|
slice: 0,
|
|
24
24
|
customDisplayExtent: [0, 0, 0, 0, 0, 0],
|
|
25
|
-
useCustomExtents: false
|
|
25
|
+
useCustomExtents: false,
|
|
26
|
+
backgroundColor: [0, 0, 0, 1]
|
|
26
27
|
}; // ----------------------------------------------------------------------------
|
|
27
28
|
|
|
28
29
|
function extend(publicAPI, model) {
|
|
29
30
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
30
31
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
|
|
33
34
|
macro.setGet(publicAPI, model, ['slice', 'useCustomExtents']);
|
|
34
35
|
macro.setGetArray(publicAPI, model, ['customDisplayExtent'], 6);
|
|
36
|
+
macro.setGetArray(publicAPI, model, ['backgroundColor'], 4);
|
|
35
37
|
vtkAbstractImageMapper(publicAPI, model);
|
|
36
38
|
} // ----------------------------------------------------------------------------
|
|
37
39
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import macro from '../../macros.js';
|
|
1
2
|
import vtkAbstractMapper from './AbstractMapper.js';
|
|
2
3
|
import { u as uninitializeBounds } from '../../Common/Core/Math/index.js';
|
|
3
4
|
|
|
@@ -46,7 +47,8 @@ function vtkAbstractMapper3D(publicAPI, model) {
|
|
|
46
47
|
|
|
47
48
|
var DEFAULT_VALUES = {
|
|
48
49
|
bounds: [1, -1, 1, -1, 1, -1],
|
|
49
|
-
center: [0, 0, 0]
|
|
50
|
+
center: [0, 0, 0],
|
|
51
|
+
viewSpecificProperties: null
|
|
50
52
|
}; // ----------------------------------------------------------------------------
|
|
51
53
|
|
|
52
54
|
function extend(publicAPI, model) {
|
|
@@ -63,6 +65,12 @@ function extend(publicAPI, model) {
|
|
|
63
65
|
model.center = [0.0, 0.0, 0.0];
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
macro.setGet(publicAPI, model, ['viewSpecificProperties']);
|
|
69
|
+
|
|
70
|
+
if (!model.viewSpecificProperties) {
|
|
71
|
+
model.viewSpecificProperties = {};
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
vtkAbstractMapper3D(publicAPI, model);
|
|
67
75
|
} // ----------------------------------------------------------------------------
|
|
68
76
|
|
|
@@ -2,8 +2,8 @@ var InterpolationType = {
|
|
|
2
2
|
NEAREST: 0,
|
|
3
3
|
LINEAR: 1
|
|
4
4
|
};
|
|
5
|
-
var
|
|
5
|
+
var InterpolationType$1 = {
|
|
6
6
|
InterpolationType: InterpolationType
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export { InterpolationType,
|
|
9
|
+
export { InterpolationType, InterpolationType$1 as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
|
-
import
|
|
2
|
+
import InterpolationType$1 from './ImageProperty/Constants.js';
|
|
3
3
|
|
|
4
|
-
var InterpolationType =
|
|
4
|
+
var InterpolationType = InterpolationType$1.InterpolationType;
|
|
5
5
|
var vtkErrorMacro = macro.vtkErrorMacro;
|
|
6
6
|
var VTK_MAX_VRCOMP = 4; // ----------------------------------------------------------------------------
|
|
7
7
|
// vtkImageProperty methods
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import vtkAbstractImageMapper, { IAbstractImageMapperInitialValues } from './AbstractImageMapper';
|
|
2
|
+
import vtkImageData from './../../Common/DataModel/ImageData';
|
|
3
|
+
import vtkPlane from './../../Common/DataModel/Plane';
|
|
4
|
+
import vtkPolyData from './../../Common/DataModel/PolyData';
|
|
5
|
+
import { Bounds, Nullable, Vector3 } from './../../types';
|
|
6
|
+
import { SlabTypes } from './ImageResliceMapper/Constants';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
interface ICoincidentTopology {
|
|
10
|
+
factor: number;
|
|
11
|
+
offset: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IImageResliceMapperInitialValues extends IAbstractImageMapperInitialValues {
|
|
15
|
+
slabThickness?: number;
|
|
16
|
+
slabTrapezoidIntegration?: number;
|
|
17
|
+
slabType?: SlabTypes;
|
|
18
|
+
slicePlane?: vtkPlane;
|
|
19
|
+
slicePolyData?: vtkPolyData;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface vtkImageResliceMapper extends vtkAbstractImageMapper {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
|
|
26
|
+
* @return {Bounds} The bounds for the mapper.
|
|
27
|
+
*/
|
|
28
|
+
getBounds(): Bounds;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
getIsOpaque(): boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
getResolveCoincidentTopology(): ICoincidentTopology
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
getResolveCoincidentTopologyAsString(): ICoincidentTopology
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
getResolveCoincidentTopologyLineOffsetParameters(): ICoincidentTopology
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
getResolveCoincidentTopologyPointOffsetParameters(): ICoincidentTopology
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
getResolveCoincidentTopologyPolygonOffsetFaces(): ICoincidentTopology
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
getResolveCoincidentTopologyPolygonOffsetParameters(): ICoincidentTopology;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* Get the slab thickness in world space (mm).
|
|
68
|
+
*/
|
|
69
|
+
getSlabThickness(): number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* Get whether slab trapezoid integration is enabled.
|
|
74
|
+
*/
|
|
75
|
+
getSlabTrapezoidIntegration(): number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* Get the slab composite function.
|
|
80
|
+
*/
|
|
81
|
+
getSlabType(): boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* Get the implicit plane used to slice the volume with.
|
|
86
|
+
*/
|
|
87
|
+
getSlicePlane(): vtkPlane;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* Get the custom polydata used to slice the volume with.
|
|
92
|
+
*/
|
|
93
|
+
getSlicePolyData(): vtkPolyData;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param {Number} factor
|
|
98
|
+
* @param {Number} offset
|
|
99
|
+
*/
|
|
100
|
+
setRelativeCoincidentTopologyLineOffsetParameters(factor: number, offset: number): boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @param {Number} factor
|
|
105
|
+
* @param {Number} offset
|
|
106
|
+
*/
|
|
107
|
+
setRelativeCoincidentTopologyPointOffsetParameters(factor: number, offset: number): boolean;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param {Number} factor
|
|
112
|
+
* @param {Number} offset
|
|
113
|
+
*/
|
|
114
|
+
setRelativeCoincidentTopologyPolygonOffsetParameters(factor: number, offset: number): boolean;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @param resolveCoincidentTopology
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
setResolveCoincidentTopology(resolveCoincidentTopology: boolean): boolean;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @param {Number} factor
|
|
126
|
+
* @param {Number} offset
|
|
127
|
+
*/
|
|
128
|
+
setResolveCoincidentTopologyLineOffsetParameters(factor: number, offset: number): boolean;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @param {Number} factor
|
|
133
|
+
* @param {Number} offset
|
|
134
|
+
*/
|
|
135
|
+
setResolveCoincidentTopologyPointOffsetParameters(factor: number, offset: number): boolean;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param value
|
|
140
|
+
*/
|
|
141
|
+
setResolveCoincidentTopologyPolygonOffsetFaces(value: number): boolean;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param {Number} factor
|
|
146
|
+
* @param {Number} offset
|
|
147
|
+
*/
|
|
148
|
+
setResolveCoincidentTopologyPolygonOffsetParameters(factor: number, offset: number): boolean;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
setResolveCoincidentTopologyToDefault(): boolean;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
*/
|
|
158
|
+
setResolveCoincidentTopologyToOff(): boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
*
|
|
162
|
+
*/
|
|
163
|
+
setResolveCoincidentTopologyToPolygonOffset(): boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
*
|
|
167
|
+
* Enable slab slicing mode and set the slab thickness in world space (mm).
|
|
168
|
+
* @param {Boolean} slabThickness The slab thickness in world space (mm). Default: 0.
|
|
169
|
+
*/
|
|
170
|
+
setSlabThickness(slabThickness: number): number;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
* When a slab thickness larger than 0 is provided, the mapper will composite multile slices
|
|
175
|
+
* together using different composite functions based on the slabType. When
|
|
176
|
+
* slabTrapezoidIntegration is enabled, the first and the last slices in the slab are weighted at
|
|
177
|
+
* half their original intensity for sum and mean slab types.
|
|
178
|
+
* @param {Number} slabTrapezoidIntegration Enable/disable trapezoid integration for slab slicing.
|
|
179
|
+
* Default: 0
|
|
180
|
+
*/
|
|
181
|
+
setSlabTrapezoidIntegration(slabTrapezoidIntegration: number): number;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* When a slab thickness larger than 0 is provided, the mapper will composite multile slices
|
|
186
|
+
* together using different composite functions based on the slabType. Available options are max,
|
|
187
|
+
* min, mean and sum.
|
|
188
|
+
* @param {SlabTypes} slabType The blend function used to composite slab slices.
|
|
189
|
+
* Default: SlabTypes.MEAN
|
|
190
|
+
*/
|
|
191
|
+
setSlabType(slabType: SlabTypes): boolean;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
*
|
|
195
|
+
* The vtkImageResliceMapper provides flexibility in how the reslice source is provided. The user
|
|
196
|
+
* can either provide an implicit vtkPlane (defined with its origin and normal), or a custom
|
|
197
|
+
* vtkPolyData. When both sources are provided, the mapper chooses the custom polydata over the
|
|
198
|
+
* implicit plane. When providing custom polydata as the source, it is required that the polydata
|
|
199
|
+
* has point normals for slab slicing. When neither sources are provided, the mapper creates a
|
|
200
|
+
* default implicit plane with normal (0, 0, 1) and origin at the mid-point of the volume's Z
|
|
201
|
+
* bounds.
|
|
202
|
+
* @param {vtkPlane} slicePlane The implicit plane to slice the volume with. Default: null
|
|
203
|
+
*/
|
|
204
|
+
setSlicePlane(slicePlane: vtkPlane): vtkPlane;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
*
|
|
208
|
+
* The vtkImageResliceMapper provides flexibility in how the reslice source is provided. The user
|
|
209
|
+
* can either provide an implicit vtkPlane (defined with its origin and normal), or a custom
|
|
210
|
+
* vtkPolyData. When both sources are provided, the mapper chooses the custom polydata over the
|
|
211
|
+
* implicit plane. When providing custom polydata as the source, it is required that the polydata
|
|
212
|
+
* has point normals for slab slicing. When neither sources are provided, the mapper creates a
|
|
213
|
+
* default implicit plane with normal (0, 0, 1) and origin at the mid-point of the volume's Z
|
|
214
|
+
* bounds.
|
|
215
|
+
* @param {vtkPolyData} slicePolyData The polydata to slice the volume with. Default: null
|
|
216
|
+
*/
|
|
217
|
+
setSlicePolyData(slicePolyData: vtkPolyData): vtkPolyData;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Method use to decorate a given object (publicAPI+model) with vtkImageResliceMapper characteristics.
|
|
222
|
+
*
|
|
223
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
224
|
+
* @param model object on which data structure will be bounds (protected)
|
|
225
|
+
* @param {IImageResliceMapperInitialValues} [initialValues] (default: {})
|
|
226
|
+
*/
|
|
227
|
+
export function extend(publicAPI: object, model: object, initialValues?: IImageResliceMapperInitialValues): void;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Method use to create a new instance of vtkImageResliceMapper
|
|
231
|
+
* @param {IImageResliceMapperInitialValues} [initialValues] for pre-setting some of its content
|
|
232
|
+
*/
|
|
233
|
+
export function newInstance(initialValues?: IImageResliceMapperInitialValues): vtkImageResliceMapper;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* vtkImageResliceMapper provides hardware accelerated slicing of 3D image data / volumes.
|
|
237
|
+
* It can be associated with a vtkImageSlice prop and placed within a Renderer.
|
|
238
|
+
*
|
|
239
|
+
* This class resolves coincident topology with the same methods as vtkMapper.
|
|
240
|
+
*/
|
|
241
|
+
export declare const vtkImageResliceMapper: {
|
|
242
|
+
newInstance: typeof newInstance;
|
|
243
|
+
extend: typeof extend;
|
|
244
|
+
}
|
|
245
|
+
export default vtkImageResliceMapper;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
4
|
+
import Constants from './ImageResliceMapper/Constants.js';
|
|
5
|
+
import macro from '../../macros.js';
|
|
6
|
+
import vtkAbstractImageMapper from './AbstractImageMapper.js';
|
|
7
|
+
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
8
|
+
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
var SlabTypes = Constants.SlabTypes;
|
|
13
|
+
var staticOffsetAPI = CoincidentTopologyHelper.staticOffsetAPI,
|
|
14
|
+
otherStaticMethods = CoincidentTopologyHelper.otherStaticMethods; // ----------------------------------------------------------------------------
|
|
15
|
+
// vtkImageResliceMapper methods
|
|
16
|
+
// ----------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
function vtkImageResliceMapper(publicAPI, model) {
|
|
19
|
+
// Set our className
|
|
20
|
+
model.classHierarchy.push('vtkImageResliceMapper');
|
|
21
|
+
|
|
22
|
+
publicAPI.getBounds = function () {
|
|
23
|
+
var bds = _toConsumableArray(vtkBoundingBox.INIT_BOUNDS);
|
|
24
|
+
|
|
25
|
+
var image = publicAPI.getInputData();
|
|
26
|
+
|
|
27
|
+
if (publicAPI.getSlicePolyData()) {
|
|
28
|
+
bds = publicAPI.getSlicePolyData().getBounds();
|
|
29
|
+
} else if (image) {
|
|
30
|
+
bds = image.getBounds();
|
|
31
|
+
|
|
32
|
+
if (publicAPI.getSlicePlane()) {
|
|
33
|
+
vtkBoundingBox.cutWithPlane(bds, publicAPI.getSlicePlane().getOrigin(), publicAPI.getSlicePlane().getNormal());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return bds;
|
|
38
|
+
};
|
|
39
|
+
} // ----------------------------------------------------------------------------
|
|
40
|
+
// Object factory
|
|
41
|
+
// ----------------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var DEFAULT_VALUES = {
|
|
45
|
+
slabThickness: 0.0,
|
|
46
|
+
slabTrapezoidIntegration: 0,
|
|
47
|
+
slabType: SlabTypes.MEAN,
|
|
48
|
+
slicePlane: null,
|
|
49
|
+
slicePolyData: null
|
|
50
|
+
}; // ----------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
function extend(publicAPI, model) {
|
|
53
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
54
|
+
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
55
|
+
|
|
56
|
+
vtkAbstractImageMapper.extend(publicAPI, model, initialValues);
|
|
57
|
+
macro.setGet(publicAPI, model, ['slabThickness', 'slabTrapezoidIntegration', 'slabType', 'slicePlane', 'slicePolyData']);
|
|
58
|
+
CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model); // Object methods
|
|
59
|
+
|
|
60
|
+
vtkImageResliceMapper(publicAPI, model);
|
|
61
|
+
} // ----------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
var newInstance = macro.newInstance(extend, 'vtkImageResliceMapper'); // ----------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
var vtkImageResliceMapper$1 = _objectSpread(_objectSpread({
|
|
66
|
+
newInstance: newInstance,
|
|
67
|
+
extend: extend
|
|
68
|
+
}, staticOffsetAPI), otherStaticMethods);
|
|
69
|
+
|
|
70
|
+
export { vtkImageResliceMapper$1 as default, extend, newInstance };
|
package/Rendering/Core/Mapper.js
CHANGED
|
@@ -553,7 +553,6 @@ var DEFAULT_VALUES = {
|
|
|
553
553
|
forceCompileOnly: 0,
|
|
554
554
|
useInvertibleColors: false,
|
|
555
555
|
invertibleScalars: null,
|
|
556
|
-
viewSpecificProperties: null,
|
|
557
556
|
customShaderAttributes: []
|
|
558
557
|
}; // ----------------------------------------------------------------------------
|
|
559
558
|
|
|
@@ -563,14 +562,9 @@ function extend(publicAPI, model) {
|
|
|
563
562
|
|
|
564
563
|
vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
|
|
565
564
|
macro.get(publicAPI, model, ['colorCoordinates', 'colorMapColors', 'colorTextureMap']);
|
|
566
|
-
macro.setGet(publicAPI, model, ['colorByArrayName', 'arrayAccessMode', 'colorMode', 'fieldDataTupleId', 'interpolateScalarsBeforeMapping', 'lookupTable', 'populateSelectionSettings', 'renderTime', 'scalarMode', 'scalarVisibility', 'selectionWebGLIdsToVTKIds', 'static', 'useLookupTableScalarRange', '
|
|
565
|
+
macro.setGet(publicAPI, model, ['colorByArrayName', 'arrayAccessMode', 'colorMode', 'fieldDataTupleId', 'interpolateScalarsBeforeMapping', 'lookupTable', 'populateSelectionSettings', 'renderTime', 'scalarMode', 'scalarVisibility', 'selectionWebGLIdsToVTKIds', 'static', 'useLookupTableScalarRange', 'customShaderAttributes' // point data array names that will be transferred to the VBO
|
|
567
566
|
]);
|
|
568
567
|
macro.setGetArray(publicAPI, model, ['scalarRange'], 2);
|
|
569
|
-
|
|
570
|
-
if (!model.viewSpecificProperties) {
|
|
571
|
-
model.viewSpecificProperties = {};
|
|
572
|
-
}
|
|
573
|
-
|
|
574
568
|
CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model); // Object methods
|
|
575
569
|
|
|
576
570
|
vtkMapper(publicAPI, model);
|
package/Rendering/Core.js
CHANGED
|
@@ -17,6 +17,7 @@ import vtkGlyph3DMapper from './Core/Glyph3DMapper.js';
|
|
|
17
17
|
import vtkHardwareSelector from './Core/HardwareSelector.js';
|
|
18
18
|
import vtkImageMapper from './Core/ImageMapper.js';
|
|
19
19
|
import vtkImageProperty from './Core/ImageProperty.js';
|
|
20
|
+
import vtkImageResliceMapper from './Core/ImageResliceMapper.js';
|
|
20
21
|
import vtkImageSlice from './Core/ImageSlice.js';
|
|
21
22
|
import vtkInteractorObserver from './Core/InteractorObserver.js';
|
|
22
23
|
import vtkInteractorStyle from './Core/InteractorStyle.js';
|
|
@@ -66,6 +67,7 @@ var Core = {
|
|
|
66
67
|
vtkHardwareSelector: vtkHardwareSelector,
|
|
67
68
|
vtkImageMapper: vtkImageMapper,
|
|
68
69
|
vtkImageProperty: vtkImageProperty,
|
|
70
|
+
vtkImageResliceMapper: vtkImageResliceMapper,
|
|
69
71
|
vtkImageSlice: vtkImageSlice,
|
|
70
72
|
vtkInteractorObserver: vtkInteractorObserver,
|
|
71
73
|
vtkInteractorStyle: vtkInteractorStyle,
|
|
@@ -104,17 +104,6 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
104
104
|
publicAPI.renderPiece(ren, actor);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
publicAPI.buildShaders = function (shaders, ren, actor) {
|
|
108
|
-
publicAPI.getShaderTemplate(shaders, ren, actor);
|
|
109
|
-
model.lastRenderPassShaderReplacement = model.currentRenderPass ? model.currentRenderPass.getShaderReplacement() : null; // apply any renderPassReplacements
|
|
110
|
-
|
|
111
|
-
if (model.lastRenderPassShaderReplacement) {
|
|
112
|
-
model.lastRenderPassShaderReplacement(shaders);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
publicAPI.replaceShaderValues(shaders, ren, actor);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
107
|
publicAPI.getShaderTemplate = function (shaders, ren, actor) {
|
|
119
108
|
shaders.Vertex = vtkPolyDataVS;
|
|
120
109
|
shaders.Fragment = vtkPolyDataFS;
|
|
@@ -875,6 +864,7 @@ function extend(publicAPI, model) {
|
|
|
875
864
|
|
|
876
865
|
vtkViewNode.extend(publicAPI, model, initialValues);
|
|
877
866
|
vtkReplacementShaderMapper.implementReplaceShaderCoincidentOffset(publicAPI, model, initialValues);
|
|
867
|
+
vtkReplacementShaderMapper.implementBuildShadersWithReplacements(publicAPI, model, initialValues);
|
|
878
868
|
model.tris = vtkHelper.newInstance();
|
|
879
869
|
model.openGLTexture = vtkOpenGLTexture.newInstance({
|
|
880
870
|
resizable: true
|