@kitware/vtk.js 30.6.0 → 30.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/Common/Core/Base64.d.ts +2 -2
  2. package/Common/Core/CellArray.d.ts +45 -42
  3. package/Common/Core/DataArray.d.ts +465 -449
  4. package/Common/Core/Endian.d.ts +5 -5
  5. package/Common/Core/HalfFloat.d.ts +3 -3
  6. package/Common/Core/ImageHelper.d.ts +11 -5
  7. package/Common/Core/LookupTable.d.ts +260 -257
  8. package/Common/Core/Math.d.ts +461 -270
  9. package/Common/Core/MatrixBuilder.d.ts +117 -112
  10. package/Common/Core/Points.d.ts +114 -106
  11. package/Common/Core/PriorityQueue.d.ts +34 -30
  12. package/Common/Core/ProgressHandler.d.ts +44 -39
  13. package/Common/Core/ScalarsToColors/Constants.d.ts +9 -9
  14. package/Common/Core/ScalarsToColors.d.ts +351 -326
  15. package/Common/Core/StringArray.d.ts +94 -89
  16. package/Common/Core/URLExtract.d.ts +9 -6
  17. package/Common/Core/VariantArray.d.ts +94 -89
  18. package/Common/DataModel/AbstractPointLocator.d.ts +18 -18
  19. package/Common/DataModel/Box.d.ts +60 -52
  20. package/Common/DataModel/CardinalSpline1D.d.ts +59 -34
  21. package/Common/DataModel/Cell.d.ts +70 -67
  22. package/Common/DataModel/Collection.d.ts +100 -84
  23. package/Common/DataModel/Cone.d.ts +30 -27
  24. package/Common/DataModel/Cylinder.d.ts +122 -112
  25. package/Common/DataModel/DataSet/Constants.d.ts +9 -9
  26. package/Common/DataModel/DataSet.d.ts +38 -35
  27. package/Common/DataModel/DataSetAttributes/FieldData.d.ts +217 -206
  28. package/Common/DataModel/DataSetAttributes.d.ts +420 -415
  29. package/Common/DataModel/EdgeLocator.d.ts +82 -79
  30. package/Common/DataModel/ITKHelper.d.ts +33 -22
  31. package/Common/DataModel/ImageData.d.ts +362 -340
  32. package/Common/DataModel/IncrementalOctreeNode.d.ts +242 -242
  33. package/Common/DataModel/IncrementalOctreePointLocator.d.ts +16 -16
  34. package/Common/DataModel/KochanekSpline1D.d.ts +60 -36
  35. package/Common/DataModel/Line.d.ts +104 -83
  36. package/Common/DataModel/Locator.d.ts +10 -10
  37. package/Common/DataModel/PiecewiseFunction.d.ts +215 -199
  38. package/Common/DataModel/Plane.d.ts +255 -223
  39. package/Common/DataModel/PointSet.d.ts +32 -28
  40. package/Common/DataModel/PolyData/Constants.d.ts +2 -2
  41. package/Common/DataModel/PolyData.d.ts +143 -140
  42. package/Common/DataModel/PolyLine.d.ts +51 -28
  43. package/Common/DataModel/Polygon.d.ts +34 -33
  44. package/Common/DataModel/SelectionNode/Constants.d.ts +18 -18
  45. package/Common/DataModel/SelectionNode.d.ts +62 -56
  46. package/Common/DataModel/Sphere.d.ts +74 -72
  47. package/Common/DataModel/Spline1D.d.ts +60 -40
  48. package/Common/DataModel/Spline3D/Constants.d.ts +3 -3
  49. package/Common/DataModel/Spline3D.d.ts +27 -22
  50. package/Common/Transform/LandmarkTransform.d.ts +67 -64
  51. package/Common/Transform/Transform.d.ts +148 -126
  52. package/Filters/General/AppendPolyData.d.ts +43 -37
  53. package/Filters/General/ClipClosedSurface.d.ts +41 -41
  54. package/Filters/General/ContourTriangulator.d.ts +38 -38
  55. package/Filters/General/ImageCropFilter.d.ts +48 -44
  56. package/Filters/General/ImageDataOutlineFilter.d.ts +41 -37
  57. package/Filters/General/ImageOutlineFilter.d.ts +41 -37
  58. package/Filters/General/ImageSliceFilter.d.ts +38 -34
  59. package/Filters/General/ImageStreamline.d.ts +120 -93
  60. package/Filters/General/LineFilter.d.ts +18 -15
  61. package/Filters/General/OutlineFilter.d.ts +19 -16
  62. package/Filters/General/TriangleFilter.d.ts +23 -19
  63. package/Filters/General/TubeFilter.d.ts +194 -188
  64. package/Filters/Sources/Arrow2DSource.d.ts +151 -143
  65. package/Filters/Sources/ArrowSource.d.ts +148 -140
  66. package/Filters/Sources/CircleSource.d.ts +138 -130
  67. package/Filters/Sources/ConeSource.d.ts +167 -159
  68. package/Filters/Sources/CubeSource.d.ts +198 -181
  69. package/Filters/Sources/Cursor3D.d.ts +171 -164
  70. package/Filters/Sources/CylinderSource.d.ts +173 -166
  71. package/Filters/Sources/LineSource.d.ts +100 -92
  72. package/Filters/Sources/PlaneSource.d.ts +211 -203
  73. package/Filters/Sources/PointSource.d.ts +90 -82
  74. package/Filters/Sources/SphereSource.d.ts +171 -164
  75. package/Filters/Texture/TextureMapToPlane.d.ts +213 -208
  76. package/Filters/Texture/TextureMapToSphere.d.ts +77 -72
  77. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.d.ts +18 -5
  78. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.d.ts +18 -5
  79. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.d.ts +19 -6
  80. package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.d.ts +18 -5
  81. package/IO/Core/DataAccessHelper.d.ts +36 -22
  82. package/IO/Core/HttpDataSetReader.d.ts +279 -249
  83. package/IO/Core/HttpSceneLoader.d.ts +92 -87
  84. package/IO/Core/ImageStream/DefaultProtocol.d.ts +27 -20
  85. package/IO/Core/ImageStream/ViewStream.d.ts +7 -7
  86. package/IO/Core/ImageStream.d.ts +52 -47
  87. package/IO/Core/WSLinkClient.d.ts +12 -6
  88. package/IO/Geometry/DracoReader.d.ts +106 -88
  89. package/IO/Geometry/PLYReader.d.ts +92 -75
  90. package/IO/Geometry/PLYWriter.d.ts +163 -148
  91. package/IO/Geometry/STLReader.d.ts +92 -77
  92. package/IO/Geometry/STLWriter.d.ts +50 -42
  93. package/IO/Misc/ElevationReader.d.ts +155 -139
  94. package/IO/Misc/ITKImageReader.d.ts +58 -50
  95. package/IO/Misc/ITKPolyDataReader.d.ts +58 -50
  96. package/IO/Misc/JSONNucleoReader.d.ts +74 -57
  97. package/IO/Misc/JSONReader.d.ts +78 -72
  98. package/IO/Misc/MTLReader.d.ts +143 -130
  99. package/IO/Misc/OBJReader.d.ts +129 -110
  100. package/IO/Misc/PDBReader.d.ts +109 -93
  101. package/IO/XML/XMLImageDataReader.d.ts +31 -19
  102. package/IO/XML/XMLPolyDataReader.d.ts +31 -19
  103. package/IO/XML/XMLReader.d.ts +141 -105
  104. package/Imaging/Core/AbstractImageInterpolator/Constants.d.ts +2 -2
  105. package/Imaging/Core/ImageReslice.d.ts +231 -173
  106. package/Interaction/Style/InteractorStyleHMDXR.d.ts +7 -3
  107. package/Interaction/Style/InteractorStyleImage.d.ts +5 -4
  108. package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +17 -6
  109. package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +5 -5
  110. package/Interaction/Widgets/OrientationMarkerWidget.d.ts +146 -142
  111. package/Proxy/Core/ViewProxy.d.ts +1 -1
  112. package/Proxy/Representations/GeometryRepresentationProxy.d.ts +28 -27
  113. package/Proxy/Representations/ResliceRepresentationProxy.d.ts +0 -1
  114. package/Rendering/Core/AbstractImageMapper.d.ts +125 -113
  115. package/Rendering/Core/AbstractMapper.d.ts +58 -52
  116. package/Rendering/Core/AbstractMapper3D.d.ts +32 -25
  117. package/Rendering/Core/AbstractPicker.d.ts +91 -88
  118. package/Rendering/Core/Actor.d.ts +117 -114
  119. package/Rendering/Core/Actor2D.d.ts +101 -98
  120. package/Rendering/Core/AnnotatedCubeActor.d.ts +58 -53
  121. package/Rendering/Core/AxesActor.d.ts +10 -4
  122. package/Rendering/Core/Camera.d.ts +739 -727
  123. package/Rendering/Core/CellPicker.d.ts +87 -77
  124. package/Rendering/Core/ColorTransferFunction/Constants.d.ts +2 -2
  125. package/Rendering/Core/ColorTransferFunction/CssFilters.d.ts +39 -13
  126. package/Rendering/Core/ColorTransferFunction.d.ts +3 -6
  127. package/Rendering/Core/Coordinate/Constants.d.ts +1 -1
  128. package/Rendering/Core/Coordinate.d.ts +154 -150
  129. package/Rendering/Core/Follower.d.ts +52 -47
  130. package/Rendering/Core/Glyph3DMapper/Constants.d.ts +8 -8
  131. package/Rendering/Core/Glyph3DMapper.d.ts +152 -149
  132. package/Rendering/Core/ImageArrayMapper.d.ts +237 -213
  133. package/Rendering/Core/ImageCPRMapper/Constants.d.ts +4 -4
  134. package/Rendering/Core/ImageCPRMapper.d.ts +424 -392
  135. package/Rendering/Core/ImageMapper/Constants.d.ts +8 -8
  136. package/Rendering/Core/ImageMapper.d.ts +292 -268
  137. package/Rendering/Core/ImageProperty/Constants.d.ts +3 -3
  138. package/Rendering/Core/ImageProperty.d.ts +204 -197
  139. package/Rendering/Core/ImageResliceMapper/Constants.d.ts +5 -5
  140. package/Rendering/Core/ImageResliceMapper.d.ts +235 -210
  141. package/Rendering/Core/ImageSlice.d.ts +142 -136
  142. package/Rendering/Core/InteractorObserver.d.ts +41 -32
  143. package/Rendering/Core/Light.d.ts +321 -318
  144. package/Rendering/Core/Mapper/Constants.d.ts +14 -14
  145. package/Rendering/Core/Mapper.d.ts +539 -512
  146. package/Rendering/Core/Mapper2D.d.ts +342 -330
  147. package/Rendering/Core/Picker.d.ts +114 -106
  148. package/Rendering/Core/PixelSpaceCallbackMapper.d.ts +56 -40
  149. package/Rendering/Core/PointPicker.d.ts +42 -37
  150. package/Rendering/Core/Prop/Constants.d.ts +3 -3
  151. package/Rendering/Core/Prop.d.ts +274 -274
  152. package/Rendering/Core/Prop3D.d.ts +259 -257
  153. package/Rendering/Core/Property/Constants.d.ts +12 -12
  154. package/Rendering/Core/Property.d.ts +535 -531
  155. package/Rendering/Core/Property2D/Constants.d.ts +1 -1
  156. package/Rendering/Core/Property2D.d.ts +114 -109
  157. package/Rendering/Core/RenderWindow.d.ts +193 -191
  158. package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +19 -19
  159. package/Rendering/Core/RenderWindowInteractor.d.ts +1335 -1219
  160. package/Rendering/Core/Renderer.d.ts +677 -663
  161. package/Rendering/Core/ScalarBarActor.d.ts +333 -322
  162. package/Rendering/Core/Skybox.d.ts +45 -42
  163. package/Rendering/Core/SphereMapper.d.ts +49 -44
  164. package/Rendering/Core/StickMapper.d.ts +49 -44
  165. package/Rendering/Core/Texture.d.ts +87 -80
  166. package/Rendering/Core/Viewport.d.ts +229 -222
  167. package/Rendering/Core/Volume.d.ts +78 -73
  168. package/Rendering/Core/VolumeMapper/Constants.d.ts +11 -11
  169. package/Rendering/Core/VolumeMapper.d.ts +295 -285
  170. package/Rendering/Core/VolumeProperty/Constants.d.ts +19 -19
  171. package/Rendering/Core/VolumeProperty.d.ts +375 -365
  172. package/Rendering/Misc/CanvasView.d.ts +148 -145
  173. package/Rendering/Misc/FullScreenRenderWindow.d.ts +111 -108
  174. package/Rendering/Misc/GenericRenderWindow.d.ts +69 -65
  175. package/Rendering/Misc/RenderWindowWithControlBar.d.ts +46 -39
  176. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +49 -29
  177. package/Rendering/Misc/SynchronizableRenderWindow.d.ts +51 -35
  178. package/Rendering/Misc/TextureLODsDownloader.d.ts +110 -106
  179. package/Rendering/OpenGL/BufferObject.d.ts +3 -2
  180. package/Rendering/OpenGL/RenderWindow.d.ts +456 -405
  181. package/Rendering/OpenGL/Texture.d.ts +66 -14
  182. package/Rendering/SceneGraph/RenderPass.d.ts +88 -83
  183. package/Rendering/SceneGraph/ViewNode.d.ts +150 -146
  184. package/Rendering/SceneGraph/ViewNodeFactory.d.ts +17 -12
  185. package/Rendering/WebXR/RenderWindowHelper/Constants.d.ts +5 -5
  186. package/Rendering/WebXR/RenderWindowHelper.d.ts +54 -49
  187. package/Widgets/Core/AbstractWidget.d.ts +30 -24
  188. package/Widgets/Core/AbstractWidgetFactory.d.ts +53 -33
  189. package/Widgets/Core/WidgetManager/Constants.d.ts +4 -4
  190. package/Widgets/Core/WidgetManager.d.ts +21 -15
  191. package/Widgets/Core/WidgetState.d.ts +11 -7
  192. package/Widgets/Manipulators/AbstractManipulator.d.ts +224 -217
  193. package/Widgets/Manipulators/LineManipulator.d.ts +33 -21
  194. package/Widgets/Manipulators/PickerManipulator.d.ts +22 -18
  195. package/Widgets/Manipulators/PlaneManipulator.d.ts +33 -22
  196. package/Widgets/Manipulators/TrackballManipulator.d.ts +40 -26
  197. package/Widgets/Representations/WidgetRepresentation.d.ts +62 -51
  198. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +23 -5
  199. package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +25 -10
  200. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.d.ts +26 -7
  201. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.d.ts +13 -12
  202. package/Widgets/Widgets3D/ResliceCursorWidget.d.ts +26 -15
  203. package/Widgets/Widgets3D/SeedWidget.d.ts +2 -2
  204. package/Widgets/Widgets3D/SphereWidget.d.ts +5 -3
  205. package/interfaces.d.ts +243 -243
  206. package/package.json +3 -3
@@ -1,449 +1,465 @@
1
- import { vtkObject, vtkRange } from './../../interfaces';
2
- import { float, int, Nullable, Range, TypedArray } from './../../types';
3
-
4
-
5
- /**
6
- * Output of the rangeHelper instance
7
- */
8
- interface VtkStatisticInformation {
9
- min: number;
10
- max: number;
11
- count: number;
12
- sum: number;
13
- mean: number;
14
- }
15
-
16
- /**
17
- * Helper class used to compute data range of a set of numbers
18
- */
19
- interface vtkRangeHelper {
20
- add(value: number): void;
21
- get(): VtkStatisticInformation;
22
- getRange(): vtkRange;
23
- }
24
-
25
- /**
26
- * The inital values of a vtkDataArray.
27
- */
28
- export interface IDataArrayInitialValues {
29
- dataType?: string;
30
- empty?: boolean;
31
- name?: string;
32
- numberOfComponents?: number;
33
- rangeTuple?: Range;
34
- size?: number;
35
- values?: Array<number>|TypedArray;
36
- }
37
-
38
- export interface vtkDataArray extends vtkObject {
39
-
40
- /**
41
- * Get the size, in bytes, of the lowest-level element of an array.
42
- */
43
- getElementComponentSize(): number;
44
-
45
- /**
46
- * Get the component for a given tupleIdx.
47
- * @param {Number} tupleIdx
48
- * @param {Number} [componentIndex] (default: 0)
49
- */
50
- getComponent(tupleIdx: number, componentIndex?: number): number;
51
-
52
- /**
53
- * Set the component value for a given tupleIdx and componentIndex.
54
- * @param {Number} tupleIdx
55
- * @param {Number} componentIndex
56
- * @param {Number} value
57
- */
58
- setComponent(tupleIdx: number, componentIndex: number, value: number): void;
59
-
60
- /**
61
- *
62
- */
63
- getData(): number[]|TypedArray;
64
-
65
- /**
66
- * Call this method when the underlying data has changed
67
- * This method calls `modified()`
68
- * For example, when you need to modify chunks of the array, it is faster
69
- * to get the underlying array with `getData()`, modify it, and then call
70
- * `dataChange()`.
71
- */
72
- dataChange(): void;
73
-
74
- /**
75
- * Get the range of the given component.
76
- *
77
- * @param {Number} componentIndex (default: -1)
78
- */
79
- getRange(componentIndex?: number): Range;
80
-
81
- /**
82
- *
83
- * @param {vtkRange} rangeValue
84
- * @param {Number} componentIndex
85
- */
86
- setRange(rangeValue: vtkRange, componentIndex: number): Range;
87
-
88
- /**
89
- * Set the given tuple at the given index.
90
- * @param {Number} idx
91
- * @param {Array<Number>|TypedArray} tuple
92
- */
93
- setTuple(idx: number, tuple: Array<number>|TypedArray): void;
94
-
95
- /**
96
- * Set the given tuples starting at the given index.
97
- * @param {Number} idx
98
- * @param {Array<Number>|TypedArray} tuples
99
- */
100
- setTuples(idx: number, tuples: Array<number>|TypedArray): void;
101
-
102
- /**
103
- * Get the tuple at the given index.
104
- *
105
- * For performance reasons, it is advised to pass a 'tupleToFill':
106
- * `const x = [];`
107
- * `for (int i = 0; i < N; ++i) {
108
- * ` dataArray.getTuple(idx, x);`
109
- * ` ...`
110
- * instead of:
111
- * `for (int i = 0; i < N; ++i) {
112
- * ` const x = dataArray.getTuple(idx);`
113
- * `...`
114
- * @param {Number} idx
115
- * @param {Number[]|TypedArray} [tupleToFill] (default [])
116
- * @returns {Number[]|TypedArray}
117
- */
118
- getTuple(idx: number, tupleToFill?: number[]|TypedArray): number[]|TypedArray;
119
-
120
- /**
121
- * Get the tuples between fromId (inclusive) and toId (exclusive).
122
- *
123
- * If fromId or toId is negative, it refers to a tuple index from the
124
- * end of the underlying typedArray.
125
- * If the range between fromId and toId is invalid, getTuples returns
126
- * null.
127
- *
128
- * NOTE: Any changes to the returned TypedArray will result in changes to
129
- * this DataArray's underlying TypedArray.
130
- *
131
- * @param {Number} [fromId] (default: 0)
132
- * @param {Number} [toId] (default: publicAPI.getNumberOfTuples())
133
- * @returns {Nullable<TypedArray>}
134
- */
135
- getTuples(fromId?: number, toId?: number): Nullable<TypedArray>;
136
-
137
- /**
138
- * Insert the given tuple at the given index.
139
- * NOTE: May resize the data values array. "Safe" version of setTuple.
140
- *
141
- * A typical usage is when `vtkDataArray` is initialized with
142
- * `initialValues = { size: 0, values: new Uint8Array(1000) }`, where
143
- * an empty but pre-allocated array with 1'000 components is created.
144
- * The component values can then be inserted with `insertTuple()` or
145
- * `insertNextTuple()` without requiring new memory allocation until
146
- * the size of 1'000 is exceeded (e.g. after inserting the 250th
147
- * 4-component tuple).
148
- *
149
- * `insertTuple` increases the number of tuples (`getNumberOfTuples()`).
150
- *
151
- * @see insertNextTuple
152
- * @see getNumberOfTuples
153
- *
154
- * @param {Number} idx
155
- * @param {Array<Number>|TypedArray} tuple
156
- * @returns {Number} Index of the inserted tuple
157
- */
158
- insertTuple(idx: number, tuple: Array<number>|TypedArray): number;
159
-
160
- /**
161
- * Insert tuples starting at the given idx.
162
- *
163
- * @param {Number} idx
164
- * @param {Array<Number>|TypedArray} tuples Flat array of tuples to insert
165
- * @returns The index of the last inserted tuple
166
- */
167
- insertTuples(idx: number, tuples: Array<number>|TypedArray): number;
168
-
169
- /**
170
- * Insert the given tuple at the next available slot and return the index of the insertion.
171
- * NOTE: May resize the data values array. "Safe" version of setTuple.
172
- *
173
- * @see insertTuple
174
- *
175
- * @param {Array<Number>|TypedArray} tuple
176
- * @returns {Number} Index of the inserted tuple.
177
- */
178
- insertNextTuple(tuple: Array<number>|TypedArray): number;
179
-
180
- /**
181
- * Convenience function to insert an array of tuples with insertNextTuple.
182
- * NOTE: tuples.length must be a multiple of `getNumberOfComponents`.
183
- * @param {Array<Number>|TypedArray} tuples
184
- * @returns The index of the last inserted tuple
185
- */
186
- insertNextTuples(tuples: Array<number>|TypedArray): number;
187
-
188
- /**
189
- *
190
- * @param {Number} [idx] (default: 1)
191
- * @returns {Number}
192
- */
193
- getTupleLocation(idx?: number): number;
194
-
195
- /**
196
- * Get the dimension (n) of the components.
197
- * @returns {Number}
198
- */
199
- getNumberOfComponents(): number;
200
-
201
- /**
202
- * Get the actual number of values in the array, which is equal to `getNumberOfTuples() * getNumberOfComponents()`.
203
- * @returns {Number}
204
- */
205
- getNumberOfValues(): number;
206
-
207
- /**
208
- * Get the actual number of complete tuples (a component group) in the array.
209
- * @returns {Number}
210
- */
211
- getNumberOfTuples(): number;
212
-
213
- /**
214
- * Convenient method to search the index of the first matching tuple in the array.
215
- * This is a naïve search, consider using a "locator" instead.
216
- * @param {Array<Number>|TypedArray} tupleToSearch
217
- * @param {Number} precision (1e-6 by default)
218
- * @returns {Number} the index of the tuple if found, -1 otherwise.
219
- */
220
- findTuple(tupleToSearch: Array<number>|TypedArray, precision?: number): number;
221
-
222
- /**
223
- * Get the data type of this array as a string.
224
- * @returns {String}
225
- */
226
- getDataType(): string;
227
-
228
- /**
229
- * Return a clone of this array.
230
- * @returns {vtkDataArray}
231
- */
232
- newClone(): vtkDataArray;
233
-
234
- /**
235
- * Get the name of the array.
236
- * @returns {String}
237
- */
238
- getName(): string;
239
-
240
- /**
241
- * Set the data of this array.
242
- * Optionally pass ´numberOfComponents´ to overwrite this dataArray's
243
- * numberOfComponents.
244
- * If this dataArray's numberOfComponents doesn't divide the given array's
245
- * length, this dataArray's numberOfComponents is set to 1.
246
- *
247
- * @param {Number[]|TypedArray} typedArray The Array value.
248
- * @param {Number} [numberOfComponents]
249
- */
250
- setData(typedArray: number[]|TypedArray, numberOfComponents?: number): void;
251
-
252
- /**
253
- * Get the state of this array.
254
- * @returns {object}
255
- */
256
- getState(): object;
257
-
258
- /**
259
- * Deep copy of another vtkDataArray into this one.
260
- * @param {vtkDataArray} other
261
- */
262
- deepCopy(other: vtkDataArray): void;
263
-
264
- /**
265
- * Interpolate between the tuples retrieved from source1
266
- * and source2 with the resp. indices and set the
267
- * resulting tuple to the idx of this DataArray.
268
- *
269
- * @param {int} idx,
270
- * @param {vtkDataArray} source1,
271
- * @param {int} source1Idx,
272
- * @param {vtkDataArray} source2,
273
- * @param {int} source2Idx,
274
- * @param {float} t
275
- */
276
- interpolateTuple(
277
- idx: int,
278
- source1: vtkDataArray,
279
- source1Idx: int,
280
- source2: vtkDataArray,
281
- source2Idx: int,
282
- t: float
283
- ): void;
284
-
285
- /**
286
- * Resize the array to the requested number of tuples and preserve data.
287
- * Increasing the array size may allocate extra memory beyond what was
288
- * requested.
289
- * Decreasing the array size will trim memory to the requested size.
290
- * model.size WILL be modified according ot the new size.
291
- * If requestedNumTuples > getNumberOfTuples(),
292
- * it creates a new typed array and copies the old values to the new array.
293
- * If requestedNumTuples < getNumberOfTuples(), the typed array is untouched,
294
- * only model.size is modified.
295
- * @param {Number} requestedNumTuples Final expected number of tuples; must be >= 0
296
- * @returns {Boolean} True if a resize occured, false otherwise
297
- * @see insertNextTuple
298
- * @see insertNextTuples
299
- * @see initialize
300
- */
301
- resize(requestedNumTuples: number): boolean;
302
-
303
- /**
304
- * Reset this array.
305
- * NOTE: This won't touch the actual memory of the underlying typedArray.
306
- * @see insertNextTuple
307
- * @see insertNextTuples
308
- */
309
- initialize(): void;
310
-
311
- // --- via macro --
312
-
313
- /**
314
- * Set the name of this array.
315
- * @param {String} name
316
- * @returns {Boolean}
317
- */
318
- setName(name: string): boolean;
319
-
320
- /**
321
- * Set the dimension (n) of the components.
322
- * @param {Number} numberOfComponents
323
- */
324
- setNumberOfComponents(numberOfComponents: number): boolean;
325
- }
326
-
327
- // ----------------------------------------------------------------------------
328
- // Static API
329
- // ----------------------------------------------------------------------------
330
-
331
- /**
332
- * Compute range of a given array. The array could be composed of tuples and
333
- * individual component range could be computed as well as magnitude.
334
- *
335
- * ```js
336
- * const array = [x0, y0, z0, x1, y1, z1, ..., xn, yn, zn];
337
- * const { min: yMin, max: yMax } = computeRange(array, 1, 3);
338
- * const { min: minMagnitude, max: maxMagnitude } = computeRange(array, -1, 3);
339
- * ```
340
- *
341
- * @param {Number[]} values Array to go through to extract the range from
342
- * @param {Number} [component] (default: 0) indice to use inside tuple size
343
- * @param {Number} [numberOfComponents] (default: 1) size of the tuple
344
- */
345
- export function computeRange(values: ArrayLike<number>, component?: number, numberOfComponents?: number): vtkRange;
346
-
347
- /**
348
- * Compute range of a given array, it only supports 1D arrays.
349
- *
350
- * @param {Number[]} values Array to go through to extract the range from
351
- * @param {Number} offset offset index to select the desired component in the tuple
352
- * @param {Number} numberOfComponents size of tuple in a multi-channel array
353
- */
354
- export function fastComputeRange(values: ArrayLike<number>, offset: number, numberOfComponents: number): vtkRange;
355
-
356
- /**
357
- * @deprecated please use `fastComputeRange` instead
358
- * Create helper object that can be used to gather min, max, count, sum of
359
- * a set of values.
360
- */
361
- export function createRangeHelper(): vtkRangeHelper
362
-
363
- /**
364
- * Return the name of a typed array
365
- *
366
- * ```js
367
- * const isFloat32 = ('Float32Array' === getDataType(array));
368
- * const clone = new macro.TYPED_ARRAYS[getDataType(array)](array.length);
369
- * ```
370
- *
371
- * @param typedArray to extract its type from
372
- */
373
- export function getDataType(typedArray: TypedArray): string
374
-
375
- /**
376
- * Return the max norm of a given vtkDataArray
377
- *
378
- * @param dataArray to process
379
- */
380
- export function getMaxNorm(dataArray: vtkDataArray): number
381
-
382
- /**
383
- * Method use to decorate a given object (publicAPI+model) with vtkDataArray characteristics.
384
- *
385
- * @param publicAPI object on which methods will be bounds (public)
386
- * @param model object on which data structure will be bounds (protected)
387
- * @param {object} [initialValues] (default: {}) Must pass a number > 0 for `size` except if `empty: true` is also passed or a non-empty typed array for `values`.
388
- */
389
- export function extend(publicAPI: object, model: object, initialValues?: IDataArrayInitialValues): void;
390
-
391
- // ----------------------------------------------------------------------------
392
-
393
- /**
394
- * Method use to create a new instance of vtkDataArray
395
- * @param {object} [initialValues] for pre-setting some of its content
396
- */
397
- export function newInstance(initialValues?: object): vtkDataArray;
398
-
399
- /**
400
- * Constants capturing the number of bytes per element based on its data type.
401
- */
402
- export enum DataTypeByteSize {
403
- Int8Array,
404
- Uint8Array,
405
- Uint8ClampedArray,
406
- Int16Array,
407
- Uint16Array,
408
- Int32Array,
409
- Uint32Array,
410
- Float32Array,
411
- Float64Array,
412
- }
413
-
414
- /**
415
- * Constants capturing the various VTK data types.
416
- */
417
- export enum VtkDataTypes {
418
- VOID,
419
- CHAR,
420
- SIGNED_CHAR,
421
- UNSIGNED_CHAR,
422
- SHORT,
423
- UNSIGNED_SHORT,
424
- INT,
425
- UNSIGNED_INT,
426
- FLOAT,
427
- DOUBLE,
428
- }
429
-
430
- /**
431
- * vtkDataArray is an abstract superclass for data array objects containing
432
- * numeric data.
433
- */
434
- export declare const vtkDataArray: {
435
- newInstance: typeof newInstance,
436
- extend: typeof extend,
437
- // static
438
- computeRange: typeof computeRange,
439
- createRangeHelper: typeof createRangeHelper,
440
- fastComputeRange: typeof fastComputeRange,
441
- getDataType: typeof getDataType,
442
- getMaxNorm: typeof getMaxNorm,
443
- // constants
444
- DataTypeByteSize: typeof DataTypeByteSize,
445
- VtkDataTypes: typeof VtkDataTypes,
446
- DefaultDataType: VtkDataTypes,
447
- };
448
-
449
- export default vtkDataArray;
1
+ import { vtkObject, vtkRange } from './../../interfaces';
2
+ import { float, int, Nullable, Range, TypedArray } from './../../types';
3
+
4
+ /**
5
+ * Output of the rangeHelper instance
6
+ */
7
+ interface VtkStatisticInformation {
8
+ min: number;
9
+ max: number;
10
+ count: number;
11
+ sum: number;
12
+ mean: number;
13
+ }
14
+
15
+ /**
16
+ * Helper class used to compute data range of a set of numbers
17
+ */
18
+ interface vtkRangeHelper {
19
+ add(value: number): void;
20
+ get(): VtkStatisticInformation;
21
+ getRange(): vtkRange;
22
+ }
23
+
24
+ /**
25
+ * The inital values of a vtkDataArray.
26
+ */
27
+ export interface IDataArrayInitialValues {
28
+ dataType?: string;
29
+ empty?: boolean;
30
+ name?: string;
31
+ numberOfComponents?: number;
32
+ rangeTuple?: Range;
33
+ size?: number;
34
+ values?: Array<number> | TypedArray;
35
+ }
36
+
37
+ export interface vtkDataArray extends vtkObject {
38
+ /**
39
+ * Get the size, in bytes, of the lowest-level element of an array.
40
+ */
41
+ getElementComponentSize(): number;
42
+
43
+ /**
44
+ * Get the component for a given tupleIdx.
45
+ * @param {Number} tupleIdx
46
+ * @param {Number} [componentIndex] (default: 0)
47
+ */
48
+ getComponent(tupleIdx: number, componentIndex?: number): number;
49
+
50
+ /**
51
+ * Set the component value for a given tupleIdx and componentIndex.
52
+ * @param {Number} tupleIdx
53
+ * @param {Number} componentIndex
54
+ * @param {Number} value
55
+ */
56
+ setComponent(tupleIdx: number, componentIndex: number, value: number): void;
57
+
58
+ /**
59
+ *
60
+ */
61
+ getData(): number[] | TypedArray;
62
+
63
+ /**
64
+ * Call this method when the underlying data has changed
65
+ * This method calls `modified()`
66
+ * For example, when you need to modify chunks of the array, it is faster
67
+ * to get the underlying array with `getData()`, modify it, and then call
68
+ * `dataChange()`.
69
+ */
70
+ dataChange(): void;
71
+
72
+ /**
73
+ * Get the range of the given component.
74
+ *
75
+ * @param {Number} componentIndex (default: -1)
76
+ */
77
+ getRange(componentIndex?: number): Range;
78
+
79
+ /**
80
+ *
81
+ * @param {vtkRange} rangeValue
82
+ * @param {Number} componentIndex
83
+ */
84
+ setRange(rangeValue: vtkRange, componentIndex: number): Range;
85
+
86
+ /**
87
+ * Set the given tuple at the given index.
88
+ * @param {Number} idx
89
+ * @param {Array<Number>|TypedArray} tuple
90
+ */
91
+ setTuple(idx: number, tuple: Array<number> | TypedArray): void;
92
+
93
+ /**
94
+ * Set the given tuples starting at the given index.
95
+ * @param {Number} idx
96
+ * @param {Array<Number>|TypedArray} tuples
97
+ */
98
+ setTuples(idx: number, tuples: Array<number> | TypedArray): void;
99
+
100
+ /**
101
+ * Get the tuple at the given index.
102
+ *
103
+ * For performance reasons, it is advised to pass a 'tupleToFill':
104
+ * `const x = [];`
105
+ * `for (int i = 0; i < N; ++i) {
106
+ * ` dataArray.getTuple(idx, x);`
107
+ * ` ...`
108
+ * instead of:
109
+ * `for (int i = 0; i < N; ++i) {
110
+ * ` const x = dataArray.getTuple(idx);`
111
+ * `...`
112
+ * @param {Number} idx
113
+ * @param {Number[]|TypedArray} [tupleToFill] (default [])
114
+ * @returns {Number[]|TypedArray}
115
+ */
116
+ getTuple(
117
+ idx: number,
118
+ tupleToFill?: number[] | TypedArray
119
+ ): number[] | TypedArray;
120
+
121
+ /**
122
+ * Get the tuples between fromId (inclusive) and toId (exclusive).
123
+ *
124
+ * If fromId or toId is negative, it refers to a tuple index from the
125
+ * end of the underlying typedArray.
126
+ * If the range between fromId and toId is invalid, getTuples returns
127
+ * null.
128
+ *
129
+ * NOTE: Any changes to the returned TypedArray will result in changes to
130
+ * this DataArray's underlying TypedArray.
131
+ *
132
+ * @param {Number} [fromId] (default: 0)
133
+ * @param {Number} [toId] (default: publicAPI.getNumberOfTuples())
134
+ * @returns {Nullable<TypedArray>}
135
+ */
136
+ getTuples(fromId?: number, toId?: number): Nullable<TypedArray>;
137
+
138
+ /**
139
+ * Insert the given tuple at the given index.
140
+ * NOTE: May resize the data values array. "Safe" version of setTuple.
141
+ *
142
+ * A typical usage is when `vtkDataArray` is initialized with
143
+ * `initialValues = { size: 0, values: new Uint8Array(1000) }`, where
144
+ * an empty but pre-allocated array with 1'000 components is created.
145
+ * The component values can then be inserted with `insertTuple()` or
146
+ * `insertNextTuple()` without requiring new memory allocation until
147
+ * the size of 1'000 is exceeded (e.g. after inserting the 250th
148
+ * 4-component tuple).
149
+ *
150
+ * `insertTuple` increases the number of tuples (`getNumberOfTuples()`).
151
+ *
152
+ * @see insertNextTuple
153
+ * @see getNumberOfTuples
154
+ *
155
+ * @param {Number} idx
156
+ * @param {Array<Number>|TypedArray} tuple
157
+ * @returns {Number} Index of the inserted tuple
158
+ */
159
+ insertTuple(idx: number, tuple: Array<number> | TypedArray): number;
160
+
161
+ /**
162
+ * Insert tuples starting at the given idx.
163
+ *
164
+ * @param {Number} idx
165
+ * @param {Array<Number>|TypedArray} tuples Flat array of tuples to insert
166
+ * @returns The index of the last inserted tuple
167
+ */
168
+ insertTuples(idx: number, tuples: Array<number> | TypedArray): number;
169
+
170
+ /**
171
+ * Insert the given tuple at the next available slot and return the index of the insertion.
172
+ * NOTE: May resize the data values array. "Safe" version of setTuple.
173
+ *
174
+ * @see insertTuple
175
+ *
176
+ * @param {Array<Number>|TypedArray} tuple
177
+ * @returns {Number} Index of the inserted tuple.
178
+ */
179
+ insertNextTuple(tuple: Array<number> | TypedArray): number;
180
+
181
+ /**
182
+ * Convenience function to insert an array of tuples with insertNextTuple.
183
+ * NOTE: tuples.length must be a multiple of `getNumberOfComponents`.
184
+ * @param {Array<Number>|TypedArray} tuples
185
+ * @returns The index of the last inserted tuple
186
+ */
187
+ insertNextTuples(tuples: Array<number> | TypedArray): number;
188
+
189
+ /**
190
+ *
191
+ * @param {Number} [idx] (default: 1)
192
+ * @returns {Number}
193
+ */
194
+ getTupleLocation(idx?: number): number;
195
+
196
+ /**
197
+ * Get the dimension (n) of the components.
198
+ * @returns {Number}
199
+ */
200
+ getNumberOfComponents(): number;
201
+
202
+ /**
203
+ * Get the actual number of values in the array, which is equal to `getNumberOfTuples() * getNumberOfComponents()`.
204
+ * @returns {Number}
205
+ */
206
+ getNumberOfValues(): number;
207
+
208
+ /**
209
+ * Get the actual number of complete tuples (a component group) in the array.
210
+ * @returns {Number}
211
+ */
212
+ getNumberOfTuples(): number;
213
+
214
+ /**
215
+ * Convenient method to search the index of the first matching tuple in the array.
216
+ * This is a naïve search, consider using a "locator" instead.
217
+ * @param {Array<Number>|TypedArray} tupleToSearch
218
+ * @param {Number} precision (1e-6 by default)
219
+ * @returns {Number} the index of the tuple if found, -1 otherwise.
220
+ */
221
+ findTuple(
222
+ tupleToSearch: Array<number> | TypedArray,
223
+ precision?: number
224
+ ): number;
225
+
226
+ /**
227
+ * Get the data type of this array as a string.
228
+ * @returns {String}
229
+ */
230
+ getDataType(): string;
231
+
232
+ /**
233
+ * Return a clone of this array.
234
+ * @returns {vtkDataArray}
235
+ */
236
+ newClone(): vtkDataArray;
237
+
238
+ /**
239
+ * Get the name of the array.
240
+ * @returns {String}
241
+ */
242
+ getName(): string;
243
+
244
+ /**
245
+ * Set the data of this array.
246
+ * Optionally pass ´numberOfComponents´ to overwrite this dataArray's
247
+ * numberOfComponents.
248
+ * If this dataArray's numberOfComponents doesn't divide the given array's
249
+ * length, this dataArray's numberOfComponents is set to 1.
250
+ *
251
+ * @param {Number[]|TypedArray} typedArray The Array value.
252
+ * @param {Number} [numberOfComponents]
253
+ */
254
+ setData(typedArray: number[] | TypedArray, numberOfComponents?: number): void;
255
+
256
+ /**
257
+ * Get the state of this array.
258
+ * @returns {object}
259
+ */
260
+ getState(): object;
261
+
262
+ /**
263
+ * Deep copy of another vtkDataArray into this one.
264
+ * @param {vtkDataArray} other
265
+ */
266
+ deepCopy(other: vtkDataArray): void;
267
+
268
+ /**
269
+ * Interpolate between the tuples retrieved from source1
270
+ * and source2 with the resp. indices and set the
271
+ * resulting tuple to the idx of this DataArray.
272
+ *
273
+ * @param {int} idx,
274
+ * @param {vtkDataArray} source1,
275
+ * @param {int} source1Idx,
276
+ * @param {vtkDataArray} source2,
277
+ * @param {int} source2Idx,
278
+ * @param {float} t
279
+ */
280
+ interpolateTuple(
281
+ idx: int,
282
+ source1: vtkDataArray,
283
+ source1Idx: int,
284
+ source2: vtkDataArray,
285
+ source2Idx: int,
286
+ t: float
287
+ ): void;
288
+
289
+ /**
290
+ * Resize the array to the requested number of tuples and preserve data.
291
+ * Increasing the array size may allocate extra memory beyond what was
292
+ * requested.
293
+ * Decreasing the array size will trim memory to the requested size.
294
+ * model.size WILL be modified according ot the new size.
295
+ * If requestedNumTuples > getNumberOfTuples(),
296
+ * it creates a new typed array and copies the old values to the new array.
297
+ * If requestedNumTuples < getNumberOfTuples(), the typed array is untouched,
298
+ * only model.size is modified.
299
+ * @param {Number} requestedNumTuples Final expected number of tuples; must be >= 0
300
+ * @returns {Boolean} True if a resize occured, false otherwise
301
+ * @see insertNextTuple
302
+ * @see insertNextTuples
303
+ * @see initialize
304
+ */
305
+ resize(requestedNumTuples: number): boolean;
306
+
307
+ /**
308
+ * Reset this array.
309
+ * NOTE: This won't touch the actual memory of the underlying typedArray.
310
+ * @see insertNextTuple
311
+ * @see insertNextTuples
312
+ */
313
+ initialize(): void;
314
+
315
+ // --- via macro --
316
+
317
+ /**
318
+ * Set the name of this array.
319
+ * @param {String} name
320
+ * @returns {Boolean}
321
+ */
322
+ setName(name: string): boolean;
323
+
324
+ /**
325
+ * Set the dimension (n) of the components.
326
+ * @param {Number} numberOfComponents
327
+ */
328
+ setNumberOfComponents(numberOfComponents: number): boolean;
329
+ }
330
+
331
+ // ----------------------------------------------------------------------------
332
+ // Static API
333
+ // ----------------------------------------------------------------------------
334
+
335
+ /**
336
+ * Compute range of a given array. The array could be composed of tuples and
337
+ * individual component range could be computed as well as magnitude.
338
+ *
339
+ * ```js
340
+ * const array = [x0, y0, z0, x1, y1, z1, ..., xn, yn, zn];
341
+ * const { min: yMin, max: yMax } = computeRange(array, 1, 3);
342
+ * const { min: minMagnitude, max: maxMagnitude } = computeRange(array, -1, 3);
343
+ * ```
344
+ *
345
+ * @param {Number[]} values Array to go through to extract the range from
346
+ * @param {Number} [component] (default: 0) indice to use inside tuple size
347
+ * @param {Number} [numberOfComponents] (default: 1) size of the tuple
348
+ */
349
+ export function computeRange(
350
+ values: ArrayLike<number>,
351
+ component?: number,
352
+ numberOfComponents?: number
353
+ ): vtkRange;
354
+
355
+ /**
356
+ * Compute range of a given array, it only supports 1D arrays.
357
+ *
358
+ * @param {Number[]} values Array to go through to extract the range from
359
+ * @param {Number} offset offset index to select the desired component in the tuple
360
+ * @param {Number} numberOfComponents size of tuple in a multi-channel array
361
+ */
362
+ export function fastComputeRange(
363
+ values: ArrayLike<number>,
364
+ offset: number,
365
+ numberOfComponents: number
366
+ ): vtkRange;
367
+
368
+ /**
369
+ * @deprecated please use `fastComputeRange` instead
370
+ * Create helper object that can be used to gather min, max, count, sum of
371
+ * a set of values.
372
+ */
373
+ export function createRangeHelper(): vtkRangeHelper;
374
+
375
+ /**
376
+ * Return the name of a typed array
377
+ *
378
+ * ```js
379
+ * const isFloat32 = ('Float32Array' === getDataType(array));
380
+ * const clone = new macro.TYPED_ARRAYS[getDataType(array)](array.length);
381
+ * ```
382
+ *
383
+ * @param typedArray to extract its type from
384
+ */
385
+ export function getDataType(typedArray: TypedArray): string;
386
+
387
+ /**
388
+ * Return the max norm of a given vtkDataArray
389
+ *
390
+ * @param dataArray to process
391
+ */
392
+ export function getMaxNorm(dataArray: vtkDataArray): number;
393
+
394
+ /**
395
+ * Method use to decorate a given object (publicAPI+model) with vtkDataArray characteristics.
396
+ *
397
+ * @param publicAPI object on which methods will be bounds (public)
398
+ * @param model object on which data structure will be bounds (protected)
399
+ * @param {object} [initialValues] (default: {}) Must pass a number > 0 for `size` except if `empty: true` is also passed or a non-empty typed array for `values`.
400
+ */
401
+ export function extend(
402
+ publicAPI: object,
403
+ model: object,
404
+ initialValues?: IDataArrayInitialValues
405
+ ): void;
406
+
407
+ // ----------------------------------------------------------------------------
408
+
409
+ /**
410
+ * Method use to create a new instance of vtkDataArray
411
+ * @param {object} [initialValues] for pre-setting some of its content
412
+ */
413
+ export function newInstance(initialValues?: object): vtkDataArray;
414
+
415
+ /**
416
+ * Constants capturing the number of bytes per element based on its data type.
417
+ */
418
+ export enum DataTypeByteSize {
419
+ Int8Array,
420
+ Uint8Array,
421
+ Uint8ClampedArray,
422
+ Int16Array,
423
+ Uint16Array,
424
+ Int32Array,
425
+ Uint32Array,
426
+ Float32Array,
427
+ Float64Array,
428
+ }
429
+
430
+ /**
431
+ * Constants capturing the various VTK data types.
432
+ */
433
+ export enum VtkDataTypes {
434
+ VOID,
435
+ CHAR,
436
+ SIGNED_CHAR,
437
+ UNSIGNED_CHAR,
438
+ SHORT,
439
+ UNSIGNED_SHORT,
440
+ INT,
441
+ UNSIGNED_INT,
442
+ FLOAT,
443
+ DOUBLE,
444
+ }
445
+
446
+ /**
447
+ * vtkDataArray is an abstract superclass for data array objects containing
448
+ * numeric data.
449
+ */
450
+ export declare const vtkDataArray: {
451
+ newInstance: typeof newInstance;
452
+ extend: typeof extend;
453
+ // static
454
+ computeRange: typeof computeRange;
455
+ createRangeHelper: typeof createRangeHelper;
456
+ fastComputeRange: typeof fastComputeRange;
457
+ getDataType: typeof getDataType;
458
+ getMaxNorm: typeof getMaxNorm;
459
+ // constants
460
+ DataTypeByteSize: typeof DataTypeByteSize;
461
+ VtkDataTypes: typeof VtkDataTypes;
462
+ DefaultDataType: VtkDataTypes;
463
+ };
464
+
465
+ export default vtkDataArray;