@kitware/vtk.js 23.4.3 → 23.4.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/Common/Core/Math/Constants.js +12 -0
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
- package/Common/DataModel/AbstractPointLocator.js +40 -0
- package/Common/DataModel/BoundingBox.d.ts +659 -0
- package/Common/DataModel/Collection.d.ts +118 -0
- package/Common/DataModel/Collection.js +113 -0
- package/Common/DataModel/DataSet/Constants.d.ts +27 -0
- package/Common/DataModel/EdgeLocator.d.ts +79 -0
- package/Common/DataModel/EdgeLocator.js +85 -0
- package/Common/DataModel/ITKHelper.d.ts +54 -0
- package/Common/DataModel/IncrementalOctreeNode.d.ts +297 -0
- package/Common/DataModel/IncrementalOctreeNode.js +640 -0
- package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
- package/Common/DataModel/IncrementalOctreePointLocator.js +398 -0
- package/Common/DataModel/Locator.d.ts +43 -0
- package/Common/DataModel/Locator.js +37 -0
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +77 -0
- package/Common/DataModel/Polygon/Constants.js +12 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Quad/Constants.js +9 -0
- package/Common/DataModel/Quad.d.ts +91 -0
- package/Common/DataModel/Quad.js +235 -0
- package/Common/DataModel/SelectionNode/Constants.d.ts +27 -0
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/Transform/Transform.js +51 -0
- package/Filters/Core/PolyDataNormals.js +124 -0
- package/Filters/General/ClipClosedSurface/Constants.js +10 -0
- package/Filters/General/ClipClosedSurface.d.ts +95 -0
- package/Filters/General/ClipClosedSurface.js +972 -0
- package/Filters/General/ContourTriangulator/Constants.js +6 -0
- package/Filters/General/ContourTriangulator/helper.js +1951 -0
- package/Filters/General/ContourTriangulator.d.ts +136 -0
- package/Filters/General/ContourTriangulator.js +202 -0
- package/Filters/General/ImageMarchingCubes.js +1 -1
- package/Filters/General/MoleculeToRepresentation.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1243 -0
- package/Filters/General/TubeFilter.js +1 -1
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- 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/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
- package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
- package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
- package/Interaction/Style/InteractorStyleManipulator.d.ts +348 -0
- package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +1 -1
- package/Interaction/Widgets/LabelRepresentation.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -1
- 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 +115 -0
- package/Proxy/Core/SourceProxy.d.ts +22 -0
- package/Proxy/Core/View2DProxy.d.ts +7 -0
- package/Proxy/Core/View2DProxy.js +1 -1
- 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/README.md +2 -2
- package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
- package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
- package/Rendering/Core/AbstractImageMapper.js +44 -0
- package/Rendering/Core/Camera.js +1 -1
- package/Rendering/Core/CellPicker.js +1 -1
- package/Rendering/Core/ColorTransferFunction/ColorMaps.d.ts +24 -0
- package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/HardwareSelector.d.ts +84 -0
- package/Rendering/Core/ImageArrayMapper.d.ts +253 -0
- package/Rendering/Core/ImageArrayMapper.js +242 -0
- package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
- 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/InteractorObserver.d.ts +132 -0
- package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
- package/Rendering/Core/InteractorStyle.d.ts +229 -0
- package/Rendering/Core/Light.js +1 -1
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Picker.js +1 -1
- package/Rendering/Core/Prop/Constants.d.ts +9 -0
- package/Rendering/Core/Prop/Constants.js +9 -0
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property2D/Constants.d.ts +9 -0
- package/Rendering/Core/RenderWindow.js +1 -1
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/VolumeMapper/Constants.d.ts +20 -0
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +129 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +131 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +763 -0
- package/Rendering/OpenGL/HardwareSelector/Constants.d.ts +8 -0
- package/Rendering/OpenGL/HardwareSelector.d.ts +339 -0
- package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
- package/Rendering/OpenGL/PolyDataMapper.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/RenderWindow/Constants.d.ts +10 -0
- package/Rendering/OpenGL/RenderWindow/Constants.js +13 -0
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +70 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
- package/Rendering/WebGPU/Actor2D.js +151 -0
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +853 -0
- package/Rendering/WebGPU/IndexBuffer.js +397 -0
- package/Rendering/WebGPU/PolyDataMapper2D.js +99 -0
- package/Rendering/WebGPU/SimpleMapper.js +290 -0
- package/Widgets/Core/AbstractWidget.d.ts +187 -0
- package/Widgets/Core/AbstractWidgetFactory.d.ts +131 -0
- package/Widgets/Core/StateBuilder/color3Mixin.js +24 -0
- package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
- package/Widgets/Core/StateBuilder.d.ts +29 -0
- package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
- package/Widgets/Core/WidgetManager.d.ts +231 -0
- package/Widgets/Core/WidgetState.d.ts +81 -0
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Manipulators/TrackballManipulator.js +1 -1
- package/Widgets/Representations/GlyphRepresentation.js +325 -0
- package/Widgets/Representations/LineHandleRepresentation.js +116 -0
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
- package/Widgets/Widgets3D/LabelWidget/behavior.js +157 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +78 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/index.d.ts +133 -74
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { vtkObject } from './../../interfaces';
|
|
2
|
+
import { Nullable } from './../../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export interface ICollectionInitialValues {
|
|
8
|
+
collection?: vtkObject[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export interface vtkCollection extends vtkObject {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Add item (vtkObject) to the collection
|
|
16
|
+
* @param {vtkObject} item item to be added to the collection
|
|
17
|
+
*/
|
|
18
|
+
addItem(item: vtkObject): void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Add item (vtkObject) to the collection _at_ the given index.
|
|
22
|
+
* This differs from VTK-C++ where insertItem inserts at position
|
|
23
|
+
* after the provided index value.
|
|
24
|
+
* @param {number} idx index where the new item should be inserted.
|
|
25
|
+
* @param {vtkObject} item item to be inserted
|
|
26
|
+
*/
|
|
27
|
+
insertItem(idx: number, item: vtkObject): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Replace an existing item (vtkObject) with a new one
|
|
31
|
+
* @param {number} idx index of item to be replaced
|
|
32
|
+
* @param {vtkObject} item
|
|
33
|
+
*/
|
|
34
|
+
replaceItem(idx: number, item: vtkObject): void;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Remove an existing item from the collection
|
|
38
|
+
* @param {number|vtkObject} inValue index or reference of an item to be removed
|
|
39
|
+
*/
|
|
40
|
+
removeItem(inValue: number|vtkObject): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Remove all items from the collection
|
|
44
|
+
*/
|
|
45
|
+
removeAllItems(): void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Check if a provided item is already present in the collection
|
|
49
|
+
*/
|
|
50
|
+
isItemPresent(item: vtkObject): boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get the total number of items in the collection
|
|
54
|
+
*/
|
|
55
|
+
getNumberOfItems(): number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check if the collection is empty
|
|
59
|
+
*/
|
|
60
|
+
empty(): boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* get the current item and provided index, returns null if index is out of bounds
|
|
64
|
+
*/
|
|
65
|
+
getItem(idx: number): Nullable<vtkObject>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Execute a passed function on every item in the collection
|
|
69
|
+
* @param callbackfn callback function to be executed on every item in the collection
|
|
70
|
+
*/
|
|
71
|
+
forEach<T>(callbackfn: (value: T, index: number, array: readonly T[]) => void): void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Execute a passed function on every item in the collection, in order to calculate an aggregated return value.
|
|
75
|
+
* @param callbackfn callback function to be used for aggregating a single value from each item in the collection
|
|
76
|
+
* @param initialValue starting value to calculate aggregation
|
|
77
|
+
*/
|
|
78
|
+
reduce<T>(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Similar to forEach, but returns an array of resulting values.
|
|
82
|
+
* @param callbackfn callback function to execute on each item in the collection, that returns a value.
|
|
83
|
+
*/
|
|
84
|
+
map<T>(callbackfn: (value: T, index: number, array: readonly T[]) => void): void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Check each element for modified time and update the collection's
|
|
88
|
+
* MTime to the latest timestamp from individual items in the collection.
|
|
89
|
+
*/
|
|
90
|
+
updateMTimeWithElements(): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Method used to decorate a given object (publicAPI+model) with vtkCollection characteristics.
|
|
95
|
+
*
|
|
96
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
97
|
+
* @param model object on which data structure will be bounds (protected)
|
|
98
|
+
* @param {ICollectionInitialValues} [initialValues] (default: {})
|
|
99
|
+
*/
|
|
100
|
+
export function extend(publicAPI: object, model: object, initialValues? : ICollectionInitialValues): void;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Method used to create a new instance of vtkCollection.
|
|
104
|
+
* @param {ICollectionInitialValues} [initialValues] for pre-setting some of its content
|
|
105
|
+
*/
|
|
106
|
+
export function newInstance(initialValues? : ICollectionInitialValues): vtkCollection;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* vtkCollection is a container of multiple vtkObject items.
|
|
110
|
+
* This can be useful for encapsulating multiple vtkObjects such as images
|
|
111
|
+
* into a single vtkObject (vtkCollection instance) to be passed as input
|
|
112
|
+
* to other filters and mappers as a single unit.
|
|
113
|
+
*/
|
|
114
|
+
export declare const vtkCollection: {
|
|
115
|
+
newInstance: typeof newInstance;
|
|
116
|
+
extend: typeof extend;
|
|
117
|
+
};
|
|
118
|
+
export default vtkCollection;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import macro from '../../macros.js';
|
|
2
|
+
|
|
3
|
+
var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
|
|
4
|
+
// vtkCollection methods
|
|
5
|
+
// ----------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
function vtkCollection(publicAPI, model) {
|
|
8
|
+
// Set our className
|
|
9
|
+
model.classHierarchy.push('vtkCollection');
|
|
10
|
+
|
|
11
|
+
publicAPI.addItem = function (item) {
|
|
12
|
+
model.collection.push(item);
|
|
13
|
+
publicAPI.modified();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
publicAPI.insertItem = function (idx, item) {
|
|
17
|
+
if (idx < 0 || model.collection.length < idx) {
|
|
18
|
+
vtkErrorMacro('idx out of bounds for insertion.');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
model.collection.splice(idx, 0, item);
|
|
22
|
+
publicAPI.modified();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
publicAPI.replaceItem = function (idx, item) {
|
|
26
|
+
model.collection.splice(idx, 1, item);
|
|
27
|
+
publicAPI.modified();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
publicAPI.removeItem = function (inValue) {
|
|
31
|
+
var idx = typeof inValue === 'number' ? inValue : model.collection.indexOf(inValue);
|
|
32
|
+
|
|
33
|
+
if (idx >= 0 && idx < model.collection.length) {
|
|
34
|
+
model.collection.splice(idx, 1);
|
|
35
|
+
publicAPI.modified();
|
|
36
|
+
} else {
|
|
37
|
+
vtkErrorMacro('idx out of bounds for removeItem.');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
publicAPI.removeAllItems = function () {
|
|
42
|
+
model.collection = [];
|
|
43
|
+
publicAPI.modified();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
publicAPI.isItemPresent = function (item) {
|
|
47
|
+
return model.collection.includes(item);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
publicAPI.getNumberOfItems = function () {
|
|
51
|
+
return model.collection.length;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
publicAPI.empty = function () {
|
|
55
|
+
return model.collection.length === 0;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
publicAPI.getItem = function (idx) {
|
|
59
|
+
return model.collection[idx];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
publicAPI.forEach = function (ftor) {
|
|
63
|
+
model.collection.forEach(ftor); // Call modified() for the collection, since ftor could have modified the elements.
|
|
64
|
+
|
|
65
|
+
publicAPI.updateMTimeWithElements();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
publicAPI.reduce = function (ftor, initialValue) {
|
|
69
|
+
return model.collection.reduce(ftor, initialValue);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
publicAPI.map = function (ftor) {
|
|
73
|
+
return model.collection.map(ftor);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
publicAPI.updateMTimeWithElements = function () {
|
|
77
|
+
var maxMTimeOfItems = 0; // we expect time values to be positive numbers
|
|
78
|
+
|
|
79
|
+
for (var i = 0; i < model.collection.length; ++i) {
|
|
80
|
+
var elem = model.collection[i];
|
|
81
|
+
maxMTimeOfItems = Math.max(maxMTimeOfItems, elem.getMTime());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (maxMTimeOfItems > publicAPI.getMTime()) {
|
|
85
|
+
publicAPI.modified();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
} // ----------------------------------------------------------------------------
|
|
89
|
+
// Object factory
|
|
90
|
+
// ----------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var DEFAULT_VALUES = {
|
|
94
|
+
collection: []
|
|
95
|
+
}; // ----------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
function extend(publicAPI, model) {
|
|
98
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
99
|
+
Object.assign(model, DEFAULT_VALUES, initialValues); // Object methods
|
|
100
|
+
|
|
101
|
+
macro.obj(publicAPI, model); // Object specific methods
|
|
102
|
+
|
|
103
|
+
vtkCollection(publicAPI, model);
|
|
104
|
+
} // ----------------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
var newInstance = macro.newInstance(extend, 'vtkCollection'); // ----------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
var index = {
|
|
109
|
+
newInstance: newInstance,
|
|
110
|
+
extend: extend
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export { index as default, extend, newInstance };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum FieldAssociations {
|
|
2
|
+
FIELD_ASSOCIATION_POINTS = 0,
|
|
3
|
+
FIELD_ASSOCIATION_CELLS = 1,
|
|
4
|
+
FIELD_ASSOCIATION_NONE = 2,
|
|
5
|
+
FIELD_ASSOCIATION_POINTS_THEN_CELLS = 3,
|
|
6
|
+
FIELD_ASSOCIATION_VERTICES = 4,
|
|
7
|
+
FIELD_ASSOCIATION_EDGES = 5,
|
|
8
|
+
FIELD_ASSOCIATION_ROWS = 6,
|
|
9
|
+
NUMBER_OF_ASSOCIATIONS = 7,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare enum FieldDataTypes {
|
|
13
|
+
UNIFORM = 0,
|
|
14
|
+
DATA_OBJECT_FIELD = 0,
|
|
15
|
+
COORDINATE = 1,
|
|
16
|
+
POINT_DATA = 1,
|
|
17
|
+
POINT = 2,
|
|
18
|
+
POINT_FIELD_DATA = 2,
|
|
19
|
+
CELL = 3,
|
|
20
|
+
CELL_FIELD_DATA = 3,
|
|
21
|
+
VERTEX = 4,
|
|
22
|
+
VERTEX_FIELD_DATA = 4,
|
|
23
|
+
EDGE = 5,
|
|
24
|
+
EDGE_FIELD_DATA = 5,
|
|
25
|
+
ROW = 6,
|
|
26
|
+
ROW_DATA = 6,
|
|
27
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Nullable } from './../../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export interface IEdgeLocatorInitialValues {
|
|
7
|
+
oriented?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IEdge<T = unknown> {
|
|
11
|
+
key: number;
|
|
12
|
+
edgeId: number;
|
|
13
|
+
value?: T;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface vtkEdgeLocator {
|
|
17
|
+
/**
|
|
18
|
+
* Remove all the edges previously added.
|
|
19
|
+
*/
|
|
20
|
+
initialize(): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns the inserted edge or null if no edge was inserted.
|
|
24
|
+
* @param {Number} pointId0 Edge first point id
|
|
25
|
+
* @param {Number} pointId1 Edge last point id
|
|
26
|
+
* @return {IEdge|null} an edge object ({ key, edgeId, value }) or null
|
|
27
|
+
*/
|
|
28
|
+
isInsertedEdge<T = unknown>(pointId0: number, pointId1: number): Nullable<IEdge<T>>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Insert edge if it does not already exist.
|
|
32
|
+
* Returns the existing or newly inserted edge.
|
|
33
|
+
*
|
|
34
|
+
* @param {Number} pointId0 Edge first point id
|
|
35
|
+
* @param {Number} pointId1 Edge last point id
|
|
36
|
+
* @param {unknown} value Optional value option
|
|
37
|
+
* @return {IEdge|null} an edge object ({ key, edgeId, value }) or null
|
|
38
|
+
* @see insertEdge()
|
|
39
|
+
* @see isInsertedEdge()
|
|
40
|
+
*/
|
|
41
|
+
insertUniqueEdge<T>(pointId0: number, pointId1: number, value?: T): IEdge<T>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Insert edge. If the edge already exists, it is overwritten by this
|
|
45
|
+
* new edge. You may verify that the edge did not previously exist with
|
|
46
|
+
* `isInsertedEdge()`.
|
|
47
|
+
* Returns the newly inserted edge.
|
|
48
|
+
* @param {Number} pointId0 Edge first point id
|
|
49
|
+
* @param {Number} pointId1 Edge last point id
|
|
50
|
+
* @param {unknown} value Optional value option
|
|
51
|
+
* @return {Edge|null} an edge object ({ key, edgeId, value }) or null
|
|
52
|
+
* @see isInsertedEdge
|
|
53
|
+
* @see insertUniqueEdge
|
|
54
|
+
*/
|
|
55
|
+
insertEdge<T>(pointId0: number, pointId1: number, value?: T): IEdge<T>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ----------------------------------------------------------------------------
|
|
59
|
+
// Static API
|
|
60
|
+
// ----------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
// ----------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Method use to create a new instance of vtkEdgeLocator
|
|
66
|
+
* @param {IEdgeLocatorInitialValues} [initialValues] for pre-setting some of its content
|
|
67
|
+
*/
|
|
68
|
+
export function newInstance(
|
|
69
|
+
initialValues?: IEdgeLocatorInitialValues
|
|
70
|
+
): vtkEdgeLocator;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* vtkEdgeLocator
|
|
74
|
+
*/
|
|
75
|
+
export declare const vtkEdgeLocator: {
|
|
76
|
+
newInstance: typeof newInstance;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default vtkEdgeLocator;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
|
+
|
|
4
|
+
var EdgeLocator = /*#__PURE__*/function () {
|
|
5
|
+
function EdgeLocator() {
|
|
6
|
+
var oriented = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7
|
+
|
|
8
|
+
_classCallCheck(this, EdgeLocator);
|
|
9
|
+
|
|
10
|
+
this.oriented = oriented;
|
|
11
|
+
this.edgeMap = new Map();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_createClass(EdgeLocator, [{
|
|
15
|
+
key: "initialize",
|
|
16
|
+
value: function initialize() {
|
|
17
|
+
this.edgeMap.clear();
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
key: "computeEdgeKey",
|
|
21
|
+
value: function computeEdgeKey(pointId0, pointId1) {
|
|
22
|
+
return this.oriented || pointId0 < pointId1 ? // Cantor pairing function:
|
|
23
|
+
0.5 * (pointId0 * pointId1) * (pointId0 * pointId1 + 1) + pointId1 : 0.5 * (pointId1 * pointId0) * (pointId1 * pointId0 + 1) + pointId0;
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
key: "insertUniqueEdge",
|
|
27
|
+
value: function insertUniqueEdge(pointId0, pointId1, newEdgeValue) {
|
|
28
|
+
// Generate a unique key
|
|
29
|
+
var key = this.computeEdgeKey(pointId0, pointId1);
|
|
30
|
+
var node = this.edgeMap.get(key);
|
|
31
|
+
|
|
32
|
+
if (!node) {
|
|
33
|
+
// Didn't find key, so add a new edge entry
|
|
34
|
+
node = {
|
|
35
|
+
key: key,
|
|
36
|
+
edgeId: this.edgeMap.size,
|
|
37
|
+
value: newEdgeValue
|
|
38
|
+
};
|
|
39
|
+
this.edgeMap.set(key, node);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return node;
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "insertEdge",
|
|
46
|
+
value: function insertEdge(pointId0, pointId1, newEdgeValue) {
|
|
47
|
+
// Generate a unique key
|
|
48
|
+
var key = this.computeEdgeKey(pointId0, pointId1);
|
|
49
|
+
var node = {
|
|
50
|
+
key: key,
|
|
51
|
+
edgeId: this.edgeMap.size,
|
|
52
|
+
value: newEdgeValue
|
|
53
|
+
};
|
|
54
|
+
this.edgeMap.set(key, node);
|
|
55
|
+
return node;
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "isInsertedEdge",
|
|
59
|
+
value: function isInsertedEdge(pointId0, pointId1) {
|
|
60
|
+
var key = this.computeEdgeKey(pointId0, pointId1);
|
|
61
|
+
return this.edgeMap.get(key);
|
|
62
|
+
}
|
|
63
|
+
}], [{
|
|
64
|
+
key: "getEdgePointIds",
|
|
65
|
+
value: function getEdgePointIds(node) {
|
|
66
|
+
var n = 0.5 * (-1 + Math.sqrt(8 * node.key + 1));
|
|
67
|
+
var pointId0 = node.key - 0.5 * (n + 1) * n;
|
|
68
|
+
var pointId1 = n - pointId0;
|
|
69
|
+
return [pointId0, pointId1];
|
|
70
|
+
}
|
|
71
|
+
}]);
|
|
72
|
+
|
|
73
|
+
return EdgeLocator;
|
|
74
|
+
}();
|
|
75
|
+
|
|
76
|
+
function newInstance() {
|
|
77
|
+
var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
78
|
+
return new EdgeLocator(initialValues.oriented);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var vtkEdgeLocator = {
|
|
82
|
+
newInstance: newInstance
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { vtkEdgeLocator as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import vtkPolyData from './PolyData';
|
|
2
|
+
import vtkImageData from './ImageData';
|
|
3
|
+
|
|
4
|
+
export interface IOptions {
|
|
5
|
+
pointDataName?: string;
|
|
6
|
+
scalarArrayName?: string;
|
|
7
|
+
cellDataName?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Converts an itk-wasm Image to a vtk.js vtkImageData.
|
|
12
|
+
* Requires an itk-wasm Image as input.
|
|
13
|
+
* @param itkImage
|
|
14
|
+
* @param {IOptions} [options]
|
|
15
|
+
*/
|
|
16
|
+
export function convertItkToVtkImage(itkImage: any, options?: IOptions): vtkImageData;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Converts a vtk.js vtkImageData to an itk-wasm Image.
|
|
20
|
+
* Requires a vtk.js vtkImageData as input.
|
|
21
|
+
* @param {vtkImageData} vtkImage
|
|
22
|
+
* @param {IOptions} [options]
|
|
23
|
+
*/
|
|
24
|
+
export function convertVtkToItkImage(vtkImage: vtkImageData, options?: IOptions): any;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Converts an itk-wasm PolyData to a vtk.js vtkPolyData.
|
|
28
|
+
* Requires an itk-wasm PolyData as input.
|
|
29
|
+
* @param itkPolyData
|
|
30
|
+
* @param {IOptions} [options]
|
|
31
|
+
*/
|
|
32
|
+
export function convertItkToVtkPolyData(itkPolyData: any, options?: IOptions): vtkPolyData;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Converts a vtk.js vtkPolyData to an itk-wasm PolyData.
|
|
36
|
+
* Requires a vtk.js vtkPolyData as input.
|
|
37
|
+
*
|
|
38
|
+
* @param {vtkPolyData} polyData
|
|
39
|
+
* @param {IOptions} [options]
|
|
40
|
+
*/
|
|
41
|
+
export function convertVtkToItkPolyData(polyData: vtkPolyData, options?: IOptions): any;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* vtkITKHelper is a helper which provides a set of functions to work with
|
|
46
|
+
* itk-wasm module.
|
|
47
|
+
*/
|
|
48
|
+
export declare const vtkITKHelper: {
|
|
49
|
+
convertItkToVtkImage: typeof convertItkToVtkImage,
|
|
50
|
+
convertVtkToItkImage: typeof convertVtkToItkImage,
|
|
51
|
+
convertItkToVtkPolyData: typeof convertItkToVtkPolyData,
|
|
52
|
+
convertVtkToItkPolyData: typeof convertVtkToItkPolyData,
|
|
53
|
+
};
|
|
54
|
+
export default vtkITKHelper;
|