@cornerstonejs/core 0.36.3 → 0.36.4
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/dist/cjs/utilities/getSliceRange.js +2 -1
- package/dist/cjs/utilities/getSliceRange.js.map +1 -1
- package/dist/esm/utilities/getSliceRange.js +2 -1
- package/dist/esm/utilities/getSliceRange.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -3
- package/src/RenderingEngine/BaseVolumeViewport.ts +847 -0
- package/src/RenderingEngine/RenderingEngine.ts +1364 -0
- package/src/RenderingEngine/StackViewport.ts +2690 -0
- package/src/RenderingEngine/Viewport.ts +1244 -0
- package/src/RenderingEngine/VolumeViewport.ts +420 -0
- package/src/RenderingEngine/VolumeViewport3D.ts +42 -0
- package/src/RenderingEngine/getRenderingEngine.ts +34 -0
- package/src/RenderingEngine/helpers/addVolumesToViewports.ts +52 -0
- package/src/RenderingEngine/helpers/cpuFallback/colors/colormap.ts +343 -0
- package/src/RenderingEngine/helpers/cpuFallback/colors/index.ts +4 -0
- package/src/RenderingEngine/helpers/cpuFallback/colors/lookupTable.ts +469 -0
- package/src/RenderingEngine/helpers/cpuFallback/drawImageSync.ts +58 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/calculateTransform.ts +136 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/canvasToPixel.ts +25 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/computeAutoVoi.ts +47 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/correctShift.ts +38 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/createViewport.ts +64 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/doesImageNeedToBeRendered.ts +36 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/fitToWindow.ts +22 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/generateColorLUT.ts +60 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/generateLut.ts +83 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getDefaultViewport.ts +88 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getImageFitScale.ts +52 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getImageSize.ts +55 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getLut.ts +53 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getModalityLut.ts +55 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getTransform.ts +17 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/getVOILut.ts +74 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/initializeRenderCanvas.ts +37 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/lutMatches.ts +21 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/now.ts +13 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/pixelToCanvas.ts +22 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/renderColorImage.ts +193 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/renderGrayscaleImage.ts +166 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/renderPseudoColorImage.ts +203 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/resetCamera.ts +32 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/resize.ts +109 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/saveLastRendered.ts +36 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/setDefaultViewport.ts +17 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/setToPixelCoordinateSystem.ts +32 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedColorPixelDataToCanvasImageData.ts +58 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedPixelDataToCanvasImageData.ts +76 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedPixelDataToCanvasImageDataColorLUT.ts +60 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedPixelDataToCanvasImageDataPET.ts +50 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedPixelDataToCanvasImageDataPseudocolorLUT.ts +66 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedPixelDataToCanvasImageDataPseudocolorLUTPET.ts +68 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedPixelDataToCanvasImageDataRGBA.ts +81 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/storedRGBAPixelDataToCanvasImageData.ts +56 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/transform.ts +126 -0
- package/src/RenderingEngine/helpers/cpuFallback/rendering/validator.ts +31 -0
- package/src/RenderingEngine/helpers/createVolumeActor.ts +103 -0
- package/src/RenderingEngine/helpers/createVolumeMapper.ts +37 -0
- package/src/RenderingEngine/helpers/getOrCreateCanvas.ts +58 -0
- package/src/RenderingEngine/helpers/index.ts +15 -0
- package/src/RenderingEngine/helpers/isRgbaSourceRgbDest.ts +1 -0
- package/src/RenderingEngine/helpers/setDefaultVolumeVOI.ts +227 -0
- package/src/RenderingEngine/helpers/setVolumesForViewports.ts +52 -0
- package/src/RenderingEngine/helpers/viewportTypeToViewportClass.ts +14 -0
- package/src/RenderingEngine/helpers/viewportTypeUsesCustomRenderingPipeline.ts +7 -0
- package/src/RenderingEngine/helpers/volumeNewImageEventDispatcher.ts +75 -0
- package/src/RenderingEngine/index.ts +23 -0
- package/src/RenderingEngine/renderingEngineCache.ts +43 -0
- package/src/RenderingEngine/vtkClasses/index.js +11 -0
- package/src/RenderingEngine/vtkClasses/vtkOffscreenMultiRenderWindow.js +149 -0
- package/src/RenderingEngine/vtkClasses/vtkSharedVolumeMapper.js +52 -0
- package/src/RenderingEngine/vtkClasses/vtkSlabCamera.d.ts +781 -0
- package/src/RenderingEngine/vtkClasses/vtkSlabCamera.js +155 -0
- package/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLRenderWindow.js +47 -0
- package/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLTexture.js +272 -0
- package/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLViewNodeFactory.js +159 -0
- package/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js +319 -0
- package/src/Settings.ts +294 -0
- package/src/cache/cache.ts +854 -0
- package/src/cache/classes/Contour.ts +70 -0
- package/src/cache/classes/ContourSet.ts +151 -0
- package/src/cache/classes/ImageVolume.ts +155 -0
- package/src/cache/index.ts +5 -0
- package/src/constants/cpuColormaps.ts +1537 -0
- package/src/constants/epsilon.ts +3 -0
- package/src/constants/index.ts +13 -0
- package/src/constants/mprCameraValues.ts +20 -0
- package/src/constants/rendering.ts +8 -0
- package/src/constants/viewportPresets.ts +357 -0
- package/src/enums/BlendModes.ts +23 -0
- package/src/enums/ContourType.ts +6 -0
- package/src/enums/Events.ts +196 -0
- package/src/enums/GeometryType.ts +5 -0
- package/src/enums/InterpolationType.ts +13 -0
- package/src/enums/OrientationAxis.ts +8 -0
- package/src/enums/RequestType.ts +13 -0
- package/src/enums/SharedArrayBufferModes.ts +11 -0
- package/src/enums/VOILUTFunctionType.ts +10 -0
- package/src/enums/ViewportType.ts +21 -0
- package/src/enums/index.ts +23 -0
- package/src/eventTarget.ts +67 -0
- package/src/getEnabledElement.ts +105 -0
- package/src/global.ts +8 -0
- package/src/index.ts +123 -0
- package/src/init.ts +247 -0
- package/src/loaders/geometryLoader.ts +108 -0
- package/src/loaders/imageLoader.ts +298 -0
- package/src/loaders/volumeLoader.ts +477 -0
- package/src/metaData.ts +84 -0
- package/src/requestPool/imageLoadPoolManager.ts +43 -0
- package/src/requestPool/imageRetrievalPoolManager.ts +25 -0
- package/src/requestPool/requestPoolManager.ts +329 -0
- package/src/types/ActorSliceRange.ts +17 -0
- package/src/types/CPUFallbackColormap.ts +23 -0
- package/src/types/CPUFallbackColormapData.ts +12 -0
- package/src/types/CPUFallbackColormapsData.ts +7 -0
- package/src/types/CPUFallbackEnabledElement.ts +71 -0
- package/src/types/CPUFallbackLUT.ts +5 -0
- package/src/types/CPUFallbackLookupTable.ts +17 -0
- package/src/types/CPUFallbackRenderingTools.ts +25 -0
- package/src/types/CPUFallbackTransform.ts +16 -0
- package/src/types/CPUFallbackViewport.ts +29 -0
- package/src/types/CPUFallbackViewportDisplayedArea.ts +15 -0
- package/src/types/CPUIImageData.ts +47 -0
- package/src/types/ContourData.ts +19 -0
- package/src/types/Cornerstone3DConfig.ts +31 -0
- package/src/types/CustomEventType.ts +14 -0
- package/src/types/EventTypes.ts +403 -0
- package/src/types/FlipDirection.ts +9 -0
- package/src/types/IActor.ts +23 -0
- package/src/types/ICache.ts +28 -0
- package/src/types/ICachedGeometry.ts +13 -0
- package/src/types/ICachedImage.ts +13 -0
- package/src/types/ICachedVolume.ts +12 -0
- package/src/types/ICamera.ts +36 -0
- package/src/types/IContour.ts +18 -0
- package/src/types/IContourSet.ts +56 -0
- package/src/types/IDynamicImageVolume.ts +18 -0
- package/src/types/IEnabledElement.ts +21 -0
- package/src/types/IGeometry.ts +12 -0
- package/src/types/IImage.ts +113 -0
- package/src/types/IImageData.ts +45 -0
- package/src/types/IImageVolume.ts +78 -0
- package/src/types/ILoadObject.ts +36 -0
- package/src/types/IRegisterImageLoader.ts +10 -0
- package/src/types/IRenderingEngine.ts +28 -0
- package/src/types/IStackViewport.ts +138 -0
- package/src/types/IStreamingImageVolume.ts +13 -0
- package/src/types/IStreamingVolumeProperties.ts +14 -0
- package/src/types/IViewport.ts +149 -0
- package/src/types/IViewportId.ts +9 -0
- package/src/types/IVolume.ts +45 -0
- package/src/types/IVolumeInput.ts +36 -0
- package/src/types/IVolumeViewport.ts +141 -0
- package/src/types/ImageLoaderFn.ts +16 -0
- package/src/types/ImageSliceData.ts +6 -0
- package/src/types/Mat3.ts +16 -0
- package/src/types/Metadata.ts +39 -0
- package/src/types/OrientationVectors.ts +36 -0
- package/src/types/Plane.ts +6 -0
- package/src/types/Point2.ts +6 -0
- package/src/types/Point3.ts +6 -0
- package/src/types/Point4.ts +6 -0
- package/src/types/ScalingParameters.ts +27 -0
- package/src/types/StackViewportProperties.ts +25 -0
- package/src/types/TransformMatrix2D.ts +4 -0
- package/src/types/ViewportInputOptions.ts +21 -0
- package/src/types/ViewportPreset.ts +14 -0
- package/src/types/VolumeLoaderFn.ts +18 -0
- package/src/types/VolumeViewportProperties.ts +14 -0
- package/src/types/index.ts +157 -0
- package/src/types/voi.ts +15 -0
- package/src/utilities/actorCheck.ts +24 -0
- package/src/utilities/applyPreset.ts +132 -0
- package/src/utilities/calculateViewportsSpatialRegistration.ts +74 -0
- package/src/utilities/calibratedPixelSpacingMetadataProvider.ts +38 -0
- package/src/utilities/createFloat32SharedArray.ts +45 -0
- package/src/utilities/createInt16SharedArray.ts +43 -0
- package/src/utilities/createLinearRGBTransferFunction.ts +22 -0
- package/src/utilities/createSigmoidRGBTransferFunction.ts +63 -0
- package/src/utilities/createUInt16SharedArray.ts +43 -0
- package/src/utilities/createUint8SharedArray.ts +45 -0
- package/src/utilities/deepFreeze.ts +19 -0
- package/src/utilities/deepMerge.ts +81 -0
- package/src/utilities/getClosestImageId.ts +80 -0
- package/src/utilities/getClosestStackImageIndexForPoint.ts +116 -0
- package/src/utilities/getImageSliceDataForVolumeViewport.ts +61 -0
- package/src/utilities/getMinMax.ts +31 -0
- package/src/utilities/getRuntimeId.ts +54 -0
- package/src/utilities/getScalarDataType.ts +31 -0
- package/src/utilities/getScalingParameters.ts +35 -0
- package/src/utilities/getSliceRange.ts +86 -0
- package/src/utilities/getSpacingInNormalDirection.ts +44 -0
- package/src/utilities/getTargetVolumeAndSpacingInNormalDir.ts +126 -0
- package/src/utilities/getViewportImageCornersInWorld.ts +102 -0
- package/src/utilities/getViewportsWithImageURI.ts +46 -0
- package/src/utilities/getViewportsWithVolumeId.ts +38 -0
- package/src/utilities/getVoiFromSigmoidRGBTransferFunction.ts +23 -0
- package/src/utilities/getVolumeActorCorners.ts +24 -0
- package/src/utilities/getVolumeSliceRangeInfo.ts +52 -0
- package/src/utilities/getVolumeViewportScrollInfo.ts +32 -0
- package/src/utilities/getVolumeViewportsContainingSameVolumes.ts +58 -0
- package/src/utilities/hasNaNValues.ts +12 -0
- package/src/utilities/imageIdToURI.ts +10 -0
- package/src/utilities/imageToWorldCoords.ts +54 -0
- package/src/utilities/index.ts +100 -0
- package/src/utilities/indexWithinDimensions.ts +27 -0
- package/src/utilities/invertRgbTransferFunction.ts +36 -0
- package/src/utilities/isEqual.ts +27 -0
- package/src/utilities/isOpposite.ts +23 -0
- package/src/utilities/isTypedArray.ts +20 -0
- package/src/utilities/loadImageToCanvas.ts +80 -0
- package/src/utilities/planar.ts +91 -0
- package/src/utilities/renderToCanvas.ts +32 -0
- package/src/utilities/scaleRgbTransferFunction.ts +37 -0
- package/src/utilities/snapFocalPointToSlice.ts +78 -0
- package/src/utilities/spatialRegistrationMetadataProvider.ts +50 -0
- package/src/utilities/transformWorldToIndex.ts +16 -0
- package/src/utilities/triggerEvent.ts +38 -0
- package/src/utilities/uuidv4.ts +13 -0
- package/src/utilities/windowLevel.ts +39 -0
- package/src/utilities/worldToImageCoords.ts +64 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import macro from '@kitware/vtk.js/macros';
|
|
2
|
+
import vtkCamera from '@kitware/vtk.js/Rendering/Core/Camera';
|
|
3
|
+
import { vec3, mat4 } from 'gl-matrix';
|
|
4
|
+
import vtkMath from '@kitware/vtk.js/Common/Core/Math';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* vtkSlabCamera - A derived class of the core vtkCamera class
|
|
8
|
+
*
|
|
9
|
+
* This customization is necesssary because when we do coordinate transformations
|
|
10
|
+
* we need to set the cRange between [d, d + 0.1],
|
|
11
|
+
* where d is distance between the camera position and the focal point.
|
|
12
|
+
* While when we render we set to the clippingRange [0.01, d * 2],
|
|
13
|
+
* where d is the calculated from the bounds of all the actors.
|
|
14
|
+
*
|
|
15
|
+
* @param {*} publicAPI The public API to extend
|
|
16
|
+
* @param {*} model The private model to extend.
|
|
17
|
+
*/
|
|
18
|
+
function vtkSlabCamera(publicAPI, model) {
|
|
19
|
+
model.classHierarchy.push('vtkSlabCamera');
|
|
20
|
+
|
|
21
|
+
// Set up private variables and methods
|
|
22
|
+
const tmpMatrix = mat4.identity(new Float64Array(16));
|
|
23
|
+
const tmpvec1 = new Float64Array(3);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* getProjectionMatrix - A fork of vtkCamera's getProjectionMatrix method.
|
|
27
|
+
* This fork performs most of the same actions, but define crange around
|
|
28
|
+
* model.distance when doing coordinate transformations.
|
|
29
|
+
*/
|
|
30
|
+
publicAPI.getProjectionMatrix = (aspect, nearz, farz) => {
|
|
31
|
+
const result = mat4.create();
|
|
32
|
+
|
|
33
|
+
if (model.projectionMatrix) {
|
|
34
|
+
const scale = 1 / model.physicalScale;
|
|
35
|
+
vec3.set(tmpvec1, scale, scale, scale);
|
|
36
|
+
|
|
37
|
+
mat4.copy(result, model.projectionMatrix);
|
|
38
|
+
mat4.scale(result, result, tmpvec1);
|
|
39
|
+
mat4.transpose(result, result);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
mat4.identity(tmpMatrix);
|
|
44
|
+
|
|
45
|
+
let cRange0 = model.clippingRange[0];
|
|
46
|
+
let cRange1 = model.clippingRange[1];
|
|
47
|
+
if (model.isPerformingCoordinateTransformation) {
|
|
48
|
+
/**
|
|
49
|
+
* NOTE: this is necessary because we want the coordinate transformation
|
|
50
|
+
* respect to the view plane (plane orthogonal to the camera and passing to
|
|
51
|
+
* the focal point).
|
|
52
|
+
*
|
|
53
|
+
* When vtk.js computes the coordinate transformations, it simply uses the
|
|
54
|
+
* camera matrix (no ray casting).
|
|
55
|
+
*
|
|
56
|
+
* However for the volume viewport the clipping range is set to be
|
|
57
|
+
* (-RENDERING_DEFAULTS.MAXIMUM_RAY_DISTANCE, RENDERING_DEFAULTS.MAXIMUM_RAY_DISTANCE).
|
|
58
|
+
* The clipping range is used in the camera method getProjectionMatrix().
|
|
59
|
+
* The projection matrix is used then for viewToWorld/worldToView methods of
|
|
60
|
+
* the renderer. This means that vkt.js will not return the coordinates of
|
|
61
|
+
* the point on the view plane (i.e. the depth coordinate will corresponded
|
|
62
|
+
* to the focal point).
|
|
63
|
+
*
|
|
64
|
+
* Therefore the clipping range has to be set to (distance, distance + 0.01),
|
|
65
|
+
* where now distance is the distance between the camera position and focal
|
|
66
|
+
* point. This is done internally, in our camera customization when the flag
|
|
67
|
+
* isPerformingCoordinateTransformation is set to true.
|
|
68
|
+
*/
|
|
69
|
+
cRange0 = model.distance;
|
|
70
|
+
cRange1 = model.distance + 0.1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const cWidth = cRange1 - cRange0;
|
|
74
|
+
const cRange = [
|
|
75
|
+
cRange0 + ((nearz + 1) * cWidth) / 2.0,
|
|
76
|
+
cRange0 + ((farz + 1) * cWidth) / 2.0,
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
if (model.parallelProjection) {
|
|
80
|
+
// set up a rectangular parallelipiped
|
|
81
|
+
const width = model.parallelScale * aspect;
|
|
82
|
+
const height = model.parallelScale;
|
|
83
|
+
|
|
84
|
+
const xmin = (model.windowCenter[0] - 1.0) * width;
|
|
85
|
+
const xmax = (model.windowCenter[0] + 1.0) * width;
|
|
86
|
+
const ymin = (model.windowCenter[1] - 1.0) * height;
|
|
87
|
+
const ymax = (model.windowCenter[1] + 1.0) * height;
|
|
88
|
+
|
|
89
|
+
mat4.ortho(tmpMatrix, xmin, xmax, ymin, ymax, cRange[0], cRange[1]);
|
|
90
|
+
mat4.transpose(tmpMatrix, tmpMatrix);
|
|
91
|
+
} else if (model.useOffAxisProjection) {
|
|
92
|
+
throw new Error('Off-Axis projection is not supported at this time');
|
|
93
|
+
} else {
|
|
94
|
+
const tmp = Math.tan(vtkMath.radiansFromDegrees(model.viewAngle) / 2.0);
|
|
95
|
+
let width;
|
|
96
|
+
let height;
|
|
97
|
+
if (model.useHorizontalViewAngle === true) {
|
|
98
|
+
width = cRange0 * tmp;
|
|
99
|
+
height = (cRange0 * tmp) / aspect;
|
|
100
|
+
} else {
|
|
101
|
+
width = cRange0 * tmp * aspect;
|
|
102
|
+
height = cRange0 * tmp;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const xmin = (model.windowCenter[0] - 1.0) * width;
|
|
106
|
+
const xmax = (model.windowCenter[0] + 1.0) * width;
|
|
107
|
+
const ymin = (model.windowCenter[1] - 1.0) * height;
|
|
108
|
+
const ymax = (model.windowCenter[1] + 1.0) * height;
|
|
109
|
+
const znear = cRange[0];
|
|
110
|
+
const zfar = cRange[1];
|
|
111
|
+
|
|
112
|
+
tmpMatrix[0] = (2.0 * znear) / (xmax - xmin);
|
|
113
|
+
tmpMatrix[5] = (2.0 * znear) / (ymax - ymin);
|
|
114
|
+
tmpMatrix[2] = (xmin + xmax) / (xmax - xmin);
|
|
115
|
+
tmpMatrix[6] = (ymin + ymax) / (ymax - ymin);
|
|
116
|
+
tmpMatrix[10] = -(znear + zfar) / (zfar - znear);
|
|
117
|
+
tmpMatrix[14] = -1.0;
|
|
118
|
+
tmpMatrix[11] = (-2.0 * znear * zfar) / (zfar - znear);
|
|
119
|
+
tmpMatrix[15] = 0.0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
mat4.copy(result, tmpMatrix);
|
|
123
|
+
|
|
124
|
+
return result;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ----------------------------------------------------------------------------
|
|
129
|
+
// Object factory
|
|
130
|
+
// ----------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
// ----------------------------------------------------------------------------
|
|
133
|
+
|
|
134
|
+
const DEFAULT_VALUES = {
|
|
135
|
+
isPerformingCoordinateTransformation: false,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export function extend(publicAPI, model, initialValues = {}) {
|
|
139
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
140
|
+
|
|
141
|
+
vtkCamera.extend(publicAPI, model, initialValues);
|
|
142
|
+
|
|
143
|
+
macro.setGet(publicAPI, model, ['isPerformingCoordinateTransformation']);
|
|
144
|
+
|
|
145
|
+
// Object methods
|
|
146
|
+
vtkSlabCamera(publicAPI, model);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ----------------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
export const newInstance = macro.newInstance(extend, 'vtkSlabCamera');
|
|
152
|
+
|
|
153
|
+
// ----------------------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
export default { newInstance, extend };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import macro from '@kitware/vtk.js/macros';
|
|
2
|
+
import vtkOpenGLRenderWindow from '@kitware/vtk.js/Rendering/OpenGL/RenderWindow';
|
|
3
|
+
import vtkStreamingOpenGLViewNodeFactory from './vtkStreamingOpenGLViewNodeFactory';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* vtkStreamingOpenGLRenderWindow - A dervied class of the core vtkOpenGLRenderWindow class.
|
|
7
|
+
* The main purpose for this class extension is to add in our own node factory, so we can use
|
|
8
|
+
* our extended "streaming" classes for progressive texture loading.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @param {*} publicAPI The public API to extend
|
|
12
|
+
* @param {*} model The private model to extend.
|
|
13
|
+
*/
|
|
14
|
+
function vtkStreamingOpenGLRenderWindow(publicAPI, model) {
|
|
15
|
+
model.classHierarchy.push('vtkStreamingOpenGLRenderWindow');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ----------------------------------------------------------------------------
|
|
19
|
+
// Object factory
|
|
20
|
+
// ----------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
// ----------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
export function extend(publicAPI, model, initialValues = {}) {
|
|
25
|
+
Object.assign(model, initialValues);
|
|
26
|
+
|
|
27
|
+
vtkOpenGLRenderWindow.extend(publicAPI, model, initialValues);
|
|
28
|
+
|
|
29
|
+
model.myFactory = vtkStreamingOpenGLViewNodeFactory.newInstance();
|
|
30
|
+
/* eslint-disable no-use-before-define */
|
|
31
|
+
model.myFactory.registerOverride('vtkRenderWindow', newInstance);
|
|
32
|
+
/* eslint-enable no-use-before-define */
|
|
33
|
+
|
|
34
|
+
// Object methods
|
|
35
|
+
vtkStreamingOpenGLRenderWindow(publicAPI, model);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ----------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
export const newInstance = macro.newInstance(
|
|
41
|
+
extend,
|
|
42
|
+
'vtkStreamingOpenGLRenderWindow'
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// ----------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
export default { newInstance, extend };
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import macro from '@kitware/vtk.js/macros';
|
|
2
|
+
import vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture';
|
|
3
|
+
import HalfFloat from '@kitware/vtk.js/Common/Core/HalfFloat';
|
|
4
|
+
import { getConfiguration } from '../../init';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* vtkStreamingOpenGLTexture - A dervied class of the core vtkOpenGLTexture.
|
|
8
|
+
* This class has methods to update the texture memory on the GPU slice by slice
|
|
9
|
+
* in an efficient yet GPU-architecture friendly manner.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @param {*} publicAPI The public API to extend
|
|
13
|
+
* @param {*} model The private model to extend.
|
|
14
|
+
*/
|
|
15
|
+
function vtkStreamingOpenGLTexture(publicAPI, model) {
|
|
16
|
+
model.classHierarchy.push('vtkStreamingOpenGLTexture');
|
|
17
|
+
|
|
18
|
+
const superCreate3DFilterableFromRaw = publicAPI.create3DFilterableFromRaw;
|
|
19
|
+
|
|
20
|
+
publicAPI.create3DFilterableFromRaw = (
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
depth,
|
|
24
|
+
numComps,
|
|
25
|
+
dataType,
|
|
26
|
+
data,
|
|
27
|
+
preferSizeOverAccuracy
|
|
28
|
+
) => {
|
|
29
|
+
model.inputDataType = dataType;
|
|
30
|
+
model.inputNumComps = numComps;
|
|
31
|
+
|
|
32
|
+
superCreate3DFilterableFromRaw(
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
depth,
|
|
36
|
+
numComps,
|
|
37
|
+
dataType,
|
|
38
|
+
data,
|
|
39
|
+
preferSizeOverAccuracy
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* This function updates the GPU texture memory to match the current
|
|
45
|
+
* representation of data held in RAM.
|
|
46
|
+
*
|
|
47
|
+
* @param {Float32Array|Uint8Array|Int16Array|Uint16Array} data The data array which has been updated.
|
|
48
|
+
*/
|
|
49
|
+
publicAPI.update3DFromRaw = (data) => {
|
|
50
|
+
const { updatedFrames } = model;
|
|
51
|
+
|
|
52
|
+
if (!updatedFrames.length) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
model._openGLRenderWindow.activateTexture(publicAPI);
|
|
56
|
+
publicAPI.createTexture();
|
|
57
|
+
publicAPI.bind();
|
|
58
|
+
|
|
59
|
+
let bytesPerVoxel;
|
|
60
|
+
let TypedArrayConstructor;
|
|
61
|
+
|
|
62
|
+
if (data instanceof Uint8Array) {
|
|
63
|
+
bytesPerVoxel = 1;
|
|
64
|
+
TypedArrayConstructor = Uint8Array;
|
|
65
|
+
} else if (data instanceof Int16Array) {
|
|
66
|
+
bytesPerVoxel = 2;
|
|
67
|
+
TypedArrayConstructor = Int16Array;
|
|
68
|
+
} else if (data instanceof Uint16Array) {
|
|
69
|
+
bytesPerVoxel = 2;
|
|
70
|
+
TypedArrayConstructor = Uint16Array;
|
|
71
|
+
} else if (data instanceof Float32Array) {
|
|
72
|
+
bytesPerVoxel = 4;
|
|
73
|
+
TypedArrayConstructor = Float32Array;
|
|
74
|
+
} else {
|
|
75
|
+
throw new Error(`No support for given TypedArray.`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
for (let i = 0; i < updatedFrames.length; i++) {
|
|
79
|
+
if (updatedFrames[i]) {
|
|
80
|
+
model.fillSubImage3D(data, i, bytesPerVoxel, TypedArrayConstructor);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Reset updatedFrames
|
|
85
|
+
model.updatedFrames = [];
|
|
86
|
+
|
|
87
|
+
if (model.generateMipmap) {
|
|
88
|
+
model.context.generateMipmap(model.target);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
publicAPI.deactivate();
|
|
92
|
+
return true;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* This function updates the GPU texture memory to match the current
|
|
97
|
+
* representation of data held in RAM.
|
|
98
|
+
*
|
|
99
|
+
* @param {Float32Array|Uint8Array} data The data array which has been updated.
|
|
100
|
+
* @param {number} frameIndex The frame to load in.
|
|
101
|
+
* @param {number} BytesPerVoxel The number of bytes per voxel in the data, so we don't have to constantly
|
|
102
|
+
* check the array type.
|
|
103
|
+
* @param {object} TypedArrayConstructor The constructor for the array type. Again so we don't have to constantly check.
|
|
104
|
+
*/
|
|
105
|
+
model.fillSubImage3D = (
|
|
106
|
+
data,
|
|
107
|
+
frameIndex,
|
|
108
|
+
bytesPerVoxel,
|
|
109
|
+
TypedArrayConstructor
|
|
110
|
+
) => {
|
|
111
|
+
const buffer = data.buffer;
|
|
112
|
+
|
|
113
|
+
const frameLength = model.width * model.height;
|
|
114
|
+
const frameLengthInBytes = frameLength * model.components * bytesPerVoxel;
|
|
115
|
+
|
|
116
|
+
const zOffset = frameIndex * frameLengthInBytes;
|
|
117
|
+
const rowLength = model.width * model.components;
|
|
118
|
+
|
|
119
|
+
const gl = model.context;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* It appears that the implementation of texSubImage3D uses 2D textures to do the texture copy if
|
|
123
|
+
* MAX_TEXTURE_SIZE is greater than MAX_TEXTURE_SIZE_3D. As such if you make a single block too big
|
|
124
|
+
* the transfer messes up cleanly and you render a black box or some data if you are lucky.
|
|
125
|
+
*
|
|
126
|
+
* This block-size based on 2D texture size seems like the safest approach that should work on most systems.
|
|
127
|
+
*
|
|
128
|
+
* There are certainly further optimizations that could be done here, we can do bigger chunks with other systems
|
|
129
|
+
* But we need to find the _exact_ criteria. And then its not even guaranteed it'll be much faster.
|
|
130
|
+
*/
|
|
131
|
+
const MAX_TEXTURE_SIZE = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
132
|
+
let blockHeight = Math.floor(
|
|
133
|
+
(bytesPerVoxel * MAX_TEXTURE_SIZE) / model.width
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// Cap to actual frame height:
|
|
137
|
+
blockHeight = Math.min(blockHeight, model.height);
|
|
138
|
+
const { useNorm16Texture, preferSizeOverAccuracy } =
|
|
139
|
+
getConfiguration().rendering;
|
|
140
|
+
// TODO: there is currently a bug in chrome and safari which requires
|
|
141
|
+
// blockheight = 1 for norm16 textures:
|
|
142
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1408247
|
|
143
|
+
// https://bugs.webkit.org/show_bug.cgi?id=252039
|
|
144
|
+
if (useNorm16Texture && !preferSizeOverAccuracy) {
|
|
145
|
+
blockHeight = 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const multiRowBlockLength = rowLength * blockHeight;
|
|
149
|
+
const multiRowBlockLengthInBytes = multiRowBlockLength * bytesPerVoxel;
|
|
150
|
+
|
|
151
|
+
const normalBlocks = Math.floor(model.height / blockHeight);
|
|
152
|
+
|
|
153
|
+
const lastBlockHeight = model.height % blockHeight;
|
|
154
|
+
const multiRowLastBlockLength = rowLength * lastBlockHeight;
|
|
155
|
+
|
|
156
|
+
// Perform most blocks.
|
|
157
|
+
for (let block = 0; block < normalBlocks; block++) {
|
|
158
|
+
const yOffset = block * blockHeight;
|
|
159
|
+
|
|
160
|
+
let dataView = new TypedArrayConstructor(
|
|
161
|
+
buffer,
|
|
162
|
+
zOffset + block * multiRowBlockLengthInBytes,
|
|
163
|
+
multiRowBlockLength
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
if (
|
|
167
|
+
model.useHalfFloat &&
|
|
168
|
+
(TypedArrayConstructor === Uint16Array ||
|
|
169
|
+
TypedArrayConstructor === Int16Array)
|
|
170
|
+
) {
|
|
171
|
+
// in the case we want to use halfFloat rendering (preferSizeOverAccuracy = true),
|
|
172
|
+
// we need to convert uint16 and int16 into fp16 format.
|
|
173
|
+
// This is the step where precision is lost for streaming volume viewport.
|
|
174
|
+
for (let idx = 0; idx < dataView.length; idx++) {
|
|
175
|
+
dataView[idx] = HalfFloat.toHalf(dataView[idx]);
|
|
176
|
+
}
|
|
177
|
+
if (TypedArrayConstructor === Int16Array) {
|
|
178
|
+
dataView = new Uint16Array(dataView);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
gl.texSubImage3D(
|
|
183
|
+
model.target, // target
|
|
184
|
+
0, // mipMap level (always zero)
|
|
185
|
+
0, // xOffset
|
|
186
|
+
yOffset, // yOffset
|
|
187
|
+
frameIndex,
|
|
188
|
+
model.width,
|
|
189
|
+
blockHeight, //model.height,
|
|
190
|
+
1, // numFramesInBlock,
|
|
191
|
+
model.format,
|
|
192
|
+
model.openGLDataType,
|
|
193
|
+
dataView
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// perform last block if present
|
|
198
|
+
|
|
199
|
+
if (lastBlockHeight !== 0) {
|
|
200
|
+
const yOffset = normalBlocks * blockHeight;
|
|
201
|
+
|
|
202
|
+
// Dataview of last block
|
|
203
|
+
const dataView = new TypedArrayConstructor(
|
|
204
|
+
buffer,
|
|
205
|
+
zOffset + normalBlocks * multiRowBlockLengthInBytes,
|
|
206
|
+
multiRowLastBlockLength
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
gl.texSubImage3D(
|
|
210
|
+
model.target, // target
|
|
211
|
+
0, // mipMap level (always zero)
|
|
212
|
+
0, // xOffset
|
|
213
|
+
yOffset, // yOffset
|
|
214
|
+
frameIndex,
|
|
215
|
+
model.width,
|
|
216
|
+
lastBlockHeight, //model.height,
|
|
217
|
+
1, // numFramesInBlock,
|
|
218
|
+
model.format,
|
|
219
|
+
model.openGLDataType,
|
|
220
|
+
dataView
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
publicAPI.getTextureParameters = () => {
|
|
226
|
+
return {
|
|
227
|
+
width: model.width,
|
|
228
|
+
height: model.height,
|
|
229
|
+
depth: model.depth,
|
|
230
|
+
numComps: model.inputNumComps,
|
|
231
|
+
dataType: model.inputDataType,
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Called when a frame is loaded so that on next render we know which data to load in.
|
|
237
|
+
* @param {number} frameIndex The frame to load in.
|
|
238
|
+
*/
|
|
239
|
+
publicAPI.setUpdatedFrame = (frameIndex) => {
|
|
240
|
+
model.updatedFrames[frameIndex] = true;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ----------------------------------------------------------------------------
|
|
245
|
+
// Object factory
|
|
246
|
+
// ----------------------------------------------------------------------------
|
|
247
|
+
|
|
248
|
+
// ----------------------------------------------------------------------------
|
|
249
|
+
|
|
250
|
+
const DEFAULT_VALUES = {
|
|
251
|
+
updatedFrames: [],
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export function extend(publicAPI, model, initialValues = {}) {
|
|
255
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
256
|
+
|
|
257
|
+
vtkOpenGLTexture.extend(publicAPI, model, initialValues);
|
|
258
|
+
|
|
259
|
+
// Object methods
|
|
260
|
+
vtkStreamingOpenGLTexture(publicAPI, model);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ----------------------------------------------------------------------------
|
|
264
|
+
|
|
265
|
+
export const newInstance = macro.newInstance(
|
|
266
|
+
extend,
|
|
267
|
+
'vtkStreamingOpenGLTexture'
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
// ----------------------------------------------------------------------------
|
|
271
|
+
|
|
272
|
+
export default { newInstance, extend };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import macro from '@kitware/vtk.js/macros';
|
|
2
|
+
// import vtkGenericWidgetRepresentation from '@kitware/vtk.js/Rendering/SceneGraph/GenericWidgetRepresentation'
|
|
3
|
+
import vtkOpenGLActor from '@kitware/vtk.js/Rendering/OpenGL/Actor';
|
|
4
|
+
import vtkOpenGLActor2D from '@kitware/vtk.js/Rendering/OpenGL/Actor2D';
|
|
5
|
+
import vtkOpenGLCamera from '@kitware/vtk.js/Rendering/OpenGL/Camera';
|
|
6
|
+
import vtkOpenGLGlyph3DMapper from '@kitware/vtk.js/Rendering/OpenGL/Glyph3DMapper';
|
|
7
|
+
import vtkOpenGLImageMapper from '@kitware/vtk.js/Rendering/OpenGL/ImageMapper';
|
|
8
|
+
import vtkOpenGLImageSlice from '@kitware/vtk.js/Rendering/OpenGL/ImageSlice';
|
|
9
|
+
import vtkOpenGLPixelSpaceCallbackMapper from '@kitware/vtk.js/Rendering/OpenGL/PixelSpaceCallbackMapper';
|
|
10
|
+
import vtkOpenGLPolyDataMapper from '@kitware/vtk.js/Rendering/OpenGL/PolyDataMapper';
|
|
11
|
+
import vtkOpenGLRenderer from '@kitware/vtk.js/Rendering/OpenGL/Renderer';
|
|
12
|
+
import vtkOpenGLSkybox from '@kitware/vtk.js/Rendering/OpenGL/Skybox';
|
|
13
|
+
import vtkOpenGLSphereMapper from '@kitware/vtk.js/Rendering/OpenGL/SphereMapper';
|
|
14
|
+
import vtkOpenGLStickMapper from '@kitware/vtk.js/Rendering/OpenGL/StickMapper';
|
|
15
|
+
import vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture';
|
|
16
|
+
import vtkOpenGLVolume from '@kitware/vtk.js/Rendering/OpenGL/Volume';
|
|
17
|
+
import vtkOpenGLVolumeMapper from '@kitware/vtk.js/Rendering/OpenGL/VolumeMapper';
|
|
18
|
+
import vtkViewNodeFactory from '@kitware/vtk.js/Rendering/SceneGraph/ViewNodeFactory';
|
|
19
|
+
import vtkStreamingOpenGLVolumeMapper from './vtkStreamingOpenGLVolumeMapper';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* vtkStreamingOpenGLViewNodeFactory - A fork of the vtkOpenGLViewNodeFactory,
|
|
23
|
+
* so that we can inject our custom derived "Streaming" classes.
|
|
24
|
+
*
|
|
25
|
+
* @param {*} publicAPI The public API to extend
|
|
26
|
+
* @param {*} model The private model to extend.
|
|
27
|
+
*/
|
|
28
|
+
function vtkStreamingOpenGLViewNodeFactory(publicAPI, model) {
|
|
29
|
+
// Set our className
|
|
30
|
+
model.classHierarchy.push('vtkStreamingOpenGLViewNodeFactory');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* createNode - fork of createNode from vtkOpenGLViewNodeFactory.
|
|
34
|
+
* This fork is required to inject the properties from model.getModelInitialValues.
|
|
35
|
+
*
|
|
36
|
+
* @param {object} dataObject An instance of a vtk.js class.
|
|
37
|
+
*/
|
|
38
|
+
publicAPI.createNode = (dataObject) => {
|
|
39
|
+
if (dataObject.isDeleted()) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let cpt = 0;
|
|
44
|
+
let className = dataObject.getClassName(cpt++);
|
|
45
|
+
let isObject = false;
|
|
46
|
+
const keys = Object.keys(model.overrides);
|
|
47
|
+
while (className && !isObject) {
|
|
48
|
+
if (keys.indexOf(className) !== -1) {
|
|
49
|
+
isObject = true;
|
|
50
|
+
} else {
|
|
51
|
+
className = dataObject.getClassName(cpt++);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!isObject) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const initialValues = model.getModelInitialValues(dataObject);
|
|
60
|
+
|
|
61
|
+
const vn = model.overrides[className](initialValues);
|
|
62
|
+
vn.setMyFactory(publicAPI);
|
|
63
|
+
return vn;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* getModelInitialValues - This function allows us to pass textures down from our
|
|
68
|
+
* vtkSharedVolumeMapper to new instances of vtkStreamingOpenGLVolumeMapper.
|
|
69
|
+
* The prevents us from sharing memory.
|
|
70
|
+
*
|
|
71
|
+
* TODO: It would be beneficial to push similar, but generalized, functionality
|
|
72
|
+
* back to vtk.js in the future.
|
|
73
|
+
*
|
|
74
|
+
* @param {object} dataObject An instance of a vtk.js class.
|
|
75
|
+
*/
|
|
76
|
+
model.getModelInitialValues = (dataObject) => {
|
|
77
|
+
const initialValues = {};
|
|
78
|
+
|
|
79
|
+
const className = dataObject.getClassName();
|
|
80
|
+
|
|
81
|
+
if (className === 'vtkSharedVolumeMapper') {
|
|
82
|
+
initialValues.scalarTexture = dataObject.getScalarTexture();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return initialValues;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ----------------------------------------------------------------------------
|
|
90
|
+
// Object factory
|
|
91
|
+
// ----------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
const DEFAULT_VALUES = {};
|
|
94
|
+
|
|
95
|
+
// ----------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
export function extend(publicAPI, model, initialValues = {}) {
|
|
98
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
99
|
+
|
|
100
|
+
// Inheritance
|
|
101
|
+
vtkViewNodeFactory.extend(publicAPI, model, initialValues);
|
|
102
|
+
|
|
103
|
+
// Object methods
|
|
104
|
+
vtkStreamingOpenGLViewNodeFactory(publicAPI, model);
|
|
105
|
+
|
|
106
|
+
// Initialization
|
|
107
|
+
publicAPI.registerOverride('vtkActor', vtkOpenGLActor.newInstance);
|
|
108
|
+
publicAPI.registerOverride('vtkActor2D', vtkOpenGLActor2D.newInstance);
|
|
109
|
+
publicAPI.registerOverride('vtkCamera', vtkOpenGLCamera.newInstance);
|
|
110
|
+
publicAPI.registerOverride(
|
|
111
|
+
'vtkGlyph3DMapper',
|
|
112
|
+
vtkOpenGLGlyph3DMapper.newInstance
|
|
113
|
+
);
|
|
114
|
+
publicAPI.registerOverride(
|
|
115
|
+
'vtkImageMapper',
|
|
116
|
+
vtkOpenGLImageMapper.newInstance
|
|
117
|
+
);
|
|
118
|
+
publicAPI.registerOverride('vtkImageSlice', vtkOpenGLImageSlice.newInstance);
|
|
119
|
+
publicAPI.registerOverride('vtkMapper', vtkOpenGLPolyDataMapper.newInstance);
|
|
120
|
+
publicAPI.registerOverride(
|
|
121
|
+
'vtkPixelSpaceCallbackMapper',
|
|
122
|
+
vtkOpenGLPixelSpaceCallbackMapper.newInstance
|
|
123
|
+
);
|
|
124
|
+
publicAPI.registerOverride('vtkRenderer', vtkOpenGLRenderer.newInstance);
|
|
125
|
+
publicAPI.registerOverride('vtkSkybox', vtkOpenGLSkybox.newInstance);
|
|
126
|
+
publicAPI.registerOverride(
|
|
127
|
+
'vtkSphereMapper',
|
|
128
|
+
vtkOpenGLSphereMapper.newInstance
|
|
129
|
+
);
|
|
130
|
+
publicAPI.registerOverride(
|
|
131
|
+
'vtkStickMapper',
|
|
132
|
+
vtkOpenGLStickMapper.newInstance
|
|
133
|
+
);
|
|
134
|
+
publicAPI.registerOverride('vtkTexture', vtkOpenGLTexture.newInstance);
|
|
135
|
+
publicAPI.registerOverride('vtkVolume', vtkOpenGLVolume.newInstance);
|
|
136
|
+
publicAPI.registerOverride(
|
|
137
|
+
'vtkVolumeMapper',
|
|
138
|
+
vtkOpenGLVolumeMapper.newInstance
|
|
139
|
+
);
|
|
140
|
+
publicAPI.registerOverride(
|
|
141
|
+
'vtkSharedVolumeMapper',
|
|
142
|
+
vtkStreamingOpenGLVolumeMapper.newInstance
|
|
143
|
+
);
|
|
144
|
+
// publicAPI.registerOverride(
|
|
145
|
+
// 'vtkWidgetRepresentation',
|
|
146
|
+
// vtkGenericWidgetRepresentation.newInstance
|
|
147
|
+
// )
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ----------------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
export const newInstance = macro.newInstance(
|
|
153
|
+
extend,
|
|
154
|
+
'vtkStreamingOpenGLViewNodeFactory'
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// ----------------------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
export default { newInstance, extend };
|