@kitware/vtk.js 28.10.2 → 28.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/Common/Core/Base64.js +53 -82
  2. package/Common/Core/CellArray.js +52 -60
  3. package/Common/Core/ClassHierarchy.js +8 -36
  4. package/Common/Core/DataArray/Constants.js +6 -6
  5. package/Common/Core/DataArray.js +185 -270
  6. package/Common/Core/Endian.js +14 -17
  7. package/Common/Core/HalfFloat.js +17 -34
  8. package/Common/Core/ImageHelper.js +17 -25
  9. package/Common/Core/LookupTable.js +131 -144
  10. package/Common/Core/Math/Constants.js +8 -8
  11. package/Common/Core/Math/index.js +754 -942
  12. package/Common/Core/Math.js +2 -4
  13. package/Common/Core/MatrixBuilder.js +99 -151
  14. package/Common/Core/Points.js +43 -43
  15. package/Common/Core/PriorityQueue.js +30 -28
  16. package/Common/Core/ProgressHandler.js +31 -32
  17. package/Common/Core/ScalarsToColors/Constants.js +4 -4
  18. package/Common/Core/ScalarsToColors.js +196 -253
  19. package/Common/Core/StringArray.js +48 -73
  20. package/Common/Core/URLExtract.js +10 -29
  21. package/Common/Core/VariantArray.js +48 -73
  22. package/Common/Core.js +11 -11
  23. package/Common/DataModel/AbstractPointLocator.js +19 -17
  24. package/Common/DataModel/BoundingBox.js +322 -490
  25. package/Common/DataModel/Box.js +46 -63
  26. package/Common/DataModel/CardinalSpline1D.js +92 -102
  27. package/Common/DataModel/Cell.js +41 -61
  28. package/Common/DataModel/CellLinks.js +91 -127
  29. package/Common/DataModel/CellTypes/Constants.js +7 -6
  30. package/Common/DataModel/CellTypes.js +55 -74
  31. package/Common/DataModel/Collection.js +45 -61
  32. package/Common/DataModel/Cone.js +28 -20
  33. package/Common/DataModel/Cylinder.js +41 -35
  34. package/Common/DataModel/DataSet/Constants.js +11 -5
  35. package/Common/DataModel/DataSet.js +37 -25
  36. package/Common/DataModel/DataSetAttributes/Constants.js +18 -18
  37. package/Common/DataModel/DataSetAttributes/FieldData.js +103 -194
  38. package/Common/DataModel/DataSetAttributes.js +96 -138
  39. package/Common/DataModel/EdgeLocator.js +45 -70
  40. package/Common/DataModel/ITKHelper.js +67 -137
  41. package/Common/DataModel/ImageData.js +115 -172
  42. package/Common/DataModel/ImplicitBoolean/Constants.js +2 -2
  43. package/Common/DataModel/ImplicitBoolean.js +66 -96
  44. package/Common/DataModel/IncrementalOctreeNode.js +201 -231
  45. package/Common/DataModel/IncrementalOctreePointLocator.js +160 -198
  46. package/Common/DataModel/KochanekSpline1D.js +78 -81
  47. package/Common/DataModel/Line/Constants.js +2 -2
  48. package/Common/DataModel/Line.js +82 -105
  49. package/Common/DataModel/Locator.js +17 -10
  50. package/Common/DataModel/Molecule.js +26 -17
  51. package/Common/DataModel/PiecewiseFunction.js +218 -239
  52. package/Common/DataModel/Plane.js +90 -113
  53. package/Common/DataModel/PointSet.js +30 -26
  54. package/Common/DataModel/PolyData/Constants.js +2 -2
  55. package/Common/DataModel/PolyData.js +95 -120
  56. package/Common/DataModel/PolyLine.js +44 -61
  57. package/Common/DataModel/Polygon/Constants.js +4 -4
  58. package/Common/DataModel/Polygon.js +128 -169
  59. package/Common/DataModel/Quad/Constants.js +2 -2
  60. package/Common/DataModel/Quad.js +61 -100
  61. package/Common/DataModel/SelectionNode/Constants.js +5 -4
  62. package/Common/DataModel/SelectionNode.js +25 -21
  63. package/Common/DataModel/Sphere.js +40 -35
  64. package/Common/DataModel/Spline1D/Constants.js +3 -2
  65. package/Common/DataModel/Spline1D.js +34 -18
  66. package/Common/DataModel/Spline3D/Constants.js +2 -2
  67. package/Common/DataModel/Spline3D.js +46 -41
  68. package/Common/DataModel/StructuredData/Constants.js +2 -2
  69. package/Common/DataModel/StructuredData.js +9 -20
  70. package/Common/DataModel/Triangle.js +207 -250
  71. package/Common/DataModel.js +19 -19
  72. package/Common/System/MobileVR.js +56 -61
  73. package/Common/System/TimerLog.js +1 -1
  74. package/Common/System.js +2 -2
  75. package/Common/Transform/LandmarkTransform/Constants.js +2 -2
  76. package/Common/Transform/LandmarkTransform.js +133 -117
  77. package/Common/Transform/Transform.js +42 -57
  78. package/Common/Transform.js +2 -2
  79. package/Common/index.js +4 -4
  80. package/Filters/Core/Cutter.js +134 -146
  81. package/Filters/Core/PolyDataNormals.js +44 -50
  82. package/Filters/Core.js +2 -2
  83. package/Filters/Cornerstone/ImageDataToCornerstoneImage.js +45 -33
  84. package/Filters/Cornerstone.js +1 -1
  85. package/Filters/General/AppendPolyData.js +84 -100
  86. package/Filters/General/Calculator.js +95 -163
  87. package/Filters/General/ClipClosedSurface/Constants.js +2 -2
  88. package/Filters/General/ClipClosedSurface.js +341 -416
  89. package/Filters/General/ClosedPolyLineToSurfaceFilter.js +141 -156
  90. package/Filters/General/ContourTriangulator/Constants.js +2 -2
  91. package/Filters/General/ContourTriangulator/helper.js +684 -812
  92. package/Filters/General/ContourTriangulator.js +92 -89
  93. package/Filters/General/ImageCropFilter.js +77 -78
  94. package/Filters/General/ImageDataOutlineFilter.js +42 -36
  95. package/Filters/General/ImageMarchingCubes/caseTable.js +9 -521
  96. package/Filters/General/ImageMarchingCubes.js +99 -112
  97. package/Filters/General/ImageMarchingSquares/caseTable.js +9 -41
  98. package/Filters/General/ImageMarchingSquares.js +93 -118
  99. package/Filters/General/ImageOutlineFilter.js +53 -54
  100. package/Filters/General/ImageSliceFilter.js +39 -30
  101. package/Filters/General/ImageStreamline.js +107 -124
  102. package/Filters/General/LineFilter.js +26 -15
  103. package/Filters/General/MoleculeToRepresentation.js +136 -149
  104. package/Filters/General/OBBTree/OBBNode.js +36 -34
  105. package/Filters/General/OBBTree/helper.js +19 -24
  106. package/Filters/General/OBBTree.js +396 -488
  107. package/Filters/General/OutlineFilter.js +52 -34
  108. package/Filters/General/PaintFilter/PaintFilter.worker.js +93 -130
  109. package/Filters/General/PaintFilter.js +150 -162
  110. package/Filters/General/ScalarToRGBA.js +38 -33
  111. package/Filters/General/TriangleFilter.js +65 -62
  112. package/Filters/General/TubeFilter/Constants.js +4 -4
  113. package/Filters/General/TubeFilter.js +376 -496
  114. package/Filters/General/WarpScalar.js +58 -60
  115. package/Filters/General/WindowedSincPolyDataFilter.js +258 -330
  116. package/Filters/General.js +21 -21
  117. package/Filters/Sources/Arrow2DSource/Constants.js +2 -2
  118. package/Filters/Sources/Arrow2DSource.js +56 -56
  119. package/Filters/Sources/ArrowSource.js +39 -29
  120. package/Filters/Sources/CircleSource.js +43 -43
  121. package/Filters/Sources/ConcentricCylinderSource.js +151 -174
  122. package/Filters/Sources/ConeSource.js +51 -42
  123. package/Filters/Sources/CubeSource.js +75 -96
  124. package/Filters/Sources/Cursor3D.js +94 -109
  125. package/Filters/Sources/CylinderSource.js +90 -90
  126. package/Filters/Sources/ImageGridSource.js +43 -43
  127. package/Filters/Sources/LineSource.js +49 -39
  128. package/Filters/Sources/PlaneSource.js +97 -104
  129. package/Filters/Sources/PointSource.js +46 -37
  130. package/Filters/Sources/RTAnalyticSource.js +50 -48
  131. package/Filters/Sources/SLICSource.js +63 -73
  132. package/Filters/Sources/SphereSource.js +88 -78
  133. package/Filters/Sources/ViewFinderSource.js +26 -23
  134. package/Filters/Sources.js +14 -14
  135. package/Filters/Texture/TextureMapToPlane.js +95 -97
  136. package/Filters/Texture/TextureMapToSphere.js +46 -54
  137. package/Filters/Texture.js +2 -2
  138. package/Filters/index.js +5 -5
  139. package/IO/Core/BinaryHelper.js +12 -18
  140. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +43 -59
  141. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +76 -113
  142. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +62 -112
  143. package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +76 -113
  144. package/IO/Core/DataAccessHelper.js +6 -6
  145. package/IO/Core/HttpDataSetReader.js +136 -139
  146. package/IO/Core/HttpDataSetSeriesReader.js +64 -75
  147. package/IO/Core/HttpSceneLoader.js +130 -179
  148. package/IO/Core/ImageStream/DefaultProtocol.js +29 -43
  149. package/IO/Core/ImageStream/ViewStream.js +100 -103
  150. package/IO/Core/ImageStream.js +62 -54
  151. package/IO/Core/ResourceLoader.js +10 -9
  152. package/IO/Core/Serializer/ArraySerializer.js +40 -40
  153. package/IO/Core/Serializer/FieldDataSerializer.js +18 -28
  154. package/IO/Core/Serializer/ImageDataSerializer.js +22 -23
  155. package/IO/Core/Serializer/PolyDataSerializer.js +17 -21
  156. package/IO/Core/Serializer.js +6 -13
  157. package/IO/Core/WSLinkClient.js +90 -76
  158. package/IO/Core/ZipMultiDataSetReader.js +46 -44
  159. package/IO/Core/ZipMultiDataSetWriter.js +43 -34
  160. package/IO/Core.js +7 -7
  161. package/IO/Geometry/DracoReader.js +118 -121
  162. package/IO/Geometry/PLYReader.js +163 -223
  163. package/IO/Geometry/PLYWriter/Constants.js +5 -5
  164. package/IO/Geometry/PLYWriter.js +139 -154
  165. package/IO/Geometry/STLReader.js +123 -146
  166. package/IO/Geometry/STLWriter/Constants.js +2 -2
  167. package/IO/Geometry/STLWriter.js +83 -82
  168. package/IO/Geometry.js +5 -5
  169. package/IO/Legacy/LegacyAsciiParser.js +78 -139
  170. package/IO/Legacy/PolyDataReader.js +48 -36
  171. package/IO/Legacy.js +2 -2
  172. package/IO/Misc/ElevationReader.js +67 -60
  173. package/IO/Misc/HttpDataSetLODsLoader.js +41 -38
  174. package/IO/Misc/ITKImageReader.js +58 -45
  175. package/IO/Misc/ITKPolyDataReader.js +50 -38
  176. package/IO/Misc/JSONNucleoReader.js +49 -42
  177. package/IO/Misc/JSONReader.js +38 -33
  178. package/IO/Misc/MTLReader.js +74 -119
  179. package/IO/Misc/OBJReader.js +153 -206
  180. package/IO/Misc/PDBReader.js +70 -68
  181. package/IO/Misc/SkyboxReader.js +77 -82
  182. package/IO/Misc.js +9 -9
  183. package/IO/XML/XMLImageDataReader.js +36 -38
  184. package/IO/XML/XMLImageDataWriter.js +28 -21
  185. package/IO/XML/XMLPolyDataReader.js +49 -46
  186. package/IO/XML/XMLPolyDataWriter.js +43 -42
  187. package/IO/XML/XMLReader.js +262 -304
  188. package/IO/XML/XMLWriter/Constants.js +3 -3
  189. package/IO/XML/XMLWriter.js +70 -84
  190. package/IO/XML.js +6 -6
  191. package/IO/index.js +5 -5
  192. package/Imaging/Core/AbstractImageInterpolator/Constants.js +4 -4
  193. package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +30 -27
  194. package/Imaging/Core/AbstractImageInterpolator.js +74 -87
  195. package/Imaging/Core/ImageInterpolator.js +201 -252
  196. package/Imaging/Core/ImagePointDataIterator.js +96 -122
  197. package/Imaging/Core/ImageReslice/Constants.js +2 -2
  198. package/Imaging/Core/ImageReslice.js +327 -464
  199. package/Imaging/Core.js +4 -4
  200. package/Imaging/Hybrid/SampleFunction.js +58 -51
  201. package/Imaging/Hybrid.js +1 -1
  202. package/Imaging/index.js +2 -2
  203. package/Interaction/Animations/TimeStepBasedAnimationHandler.js +39 -54
  204. package/Interaction/Manipulators/CompositeCameraManipulator.js +22 -13
  205. package/Interaction/Manipulators/CompositeGestureManipulator.js +31 -43
  206. package/Interaction/Manipulators/CompositeKeyboardManipulator.js +15 -11
  207. package/Interaction/Manipulators/CompositeMouseManipulator.js +27 -33
  208. package/Interaction/Manipulators/CompositeVRManipulator.js +22 -15
  209. package/Interaction/Manipulators/GestureCameraManipulator.js +54 -36
  210. package/Interaction/Manipulators/KeyboardCameraManipulator.js +95 -97
  211. package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +70 -89
  212. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +67 -54
  213. package/Interaction/Manipulators/MouseCameraSliceManipulator.js +40 -38
  214. package/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator.js +83 -68
  215. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +32 -28
  216. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +47 -40
  217. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +55 -43
  218. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +56 -46
  219. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +41 -46
  220. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.js +29 -27
  221. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +123 -146
  222. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +144 -166
  223. package/Interaction/Manipulators/MouseRangeManipulator.js +127 -132
  224. package/Interaction/Manipulators/VRButtonPanManipulator.js +33 -23
  225. package/Interaction/Manipulators.js +21 -21
  226. package/Interaction/Misc/DeviceOrientationToCamera.js +25 -47
  227. package/Interaction/Misc.js +1 -1
  228. package/Interaction/Style/InteractorStyleImage.js +101 -121
  229. package/Interaction/Style/InteractorStyleMPRSlice.js +111 -128
  230. package/Interaction/Style/InteractorStyleManipulator/Presets.js +9 -17
  231. package/Interaction/Style/InteractorStyleManipulator.js +254 -329
  232. package/Interaction/Style/InteractorStyleRemoteMouse.js +195 -180
  233. package/Interaction/Style/InteractorStyleTrackballCamera.js +154 -157
  234. package/Interaction/Style/InteractorStyleUnicam.js +30 -38
  235. package/Interaction/Style.js +5 -5
  236. package/Interaction/UI/CornerAnnotation/CornerAnnotation.module.css.js +1 -1
  237. package/Interaction/UI/CornerAnnotation.js +65 -48
  238. package/Interaction/UI/FPSMonitor.js +104 -105
  239. package/Interaction/UI/Icons.js +1 -1
  240. package/Interaction/UI/Slider/Constants.js +2 -2
  241. package/Interaction/UI/Slider.js +78 -95
  242. package/Interaction/UI/VolumeController.js +104 -97
  243. package/Interaction/UI.js +5 -5
  244. package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +2 -2
  245. package/Interaction/Widgets/OrientationMarkerWidget.js +90 -135
  246. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
  247. package/Interaction/Widgets/PiecewiseGaussianWidget.js +381 -498
  248. package/Interaction/Widgets.js +2 -2
  249. package/Interaction/index.js +5 -5
  250. package/Proxy/Animation/AbstractAnimationProxy.js +22 -15
  251. package/Proxy/Animation/AnimationProxyManager.js +43 -51
  252. package/Proxy/Animation/TimeStepBasedAnimationHandlerProxy.js +26 -19
  253. package/Proxy/Core/AbstractRepresentationProxy.js +97 -151
  254. package/Proxy/Core/LookupTableProxy/Constants.js +4 -4
  255. package/Proxy/Core/LookupTableProxy.js +49 -52
  256. package/Proxy/Core/PiecewiseFunctionProxy/Constants.js +4 -4
  257. package/Proxy/Core/PiecewiseFunctionProxy.js +63 -72
  258. package/Proxy/Core/ProxyManager/core.js +83 -106
  259. package/Proxy/Core/ProxyManager/properties.js +53 -76
  260. package/Proxy/Core/ProxyManager/state.js +100 -110
  261. package/Proxy/Core/ProxyManager/view.js +45 -55
  262. package/Proxy/Core/ProxyManager.js +16 -8
  263. package/Proxy/Core/SourceProxy.js +41 -38
  264. package/Proxy/Core/View2DProxy.js +143 -199
  265. package/Proxy/Core/ViewProxy.js +223 -269
  266. package/Proxy/Core.js +7 -7
  267. package/Proxy/Representations/GeometryRepresentationProxy.js +34 -20
  268. package/Proxy/Representations/GlyphRepresentationProxy.js +42 -41
  269. package/Proxy/Representations/MoleculeRepresentationProxy.js +32 -22
  270. package/Proxy/Representations/ResliceRepresentationProxy.js +48 -32
  271. package/Proxy/Representations/SkyboxRepresentationProxy.js +30 -29
  272. package/Proxy/Representations/SliceRepresentationProxy.js +93 -112
  273. package/Proxy/Representations/SlicedGeometryRepresentationProxy.js +46 -42
  274. package/Proxy/Representations/VolumeRepresentationProxy.js +108 -133
  275. package/Proxy/Representations.js +7 -7
  276. package/Proxy/index.js +2 -2
  277. package/Rendering/Core/AbstractImageMapper/helper.js +44 -49
  278. package/Rendering/Core/AbstractImageMapper.js +18 -19
  279. package/Rendering/Core/AbstractMapper.js +39 -55
  280. package/Rendering/Core/AbstractMapper3D.js +26 -31
  281. package/Rendering/Core/AbstractPicker.js +25 -21
  282. package/Rendering/Core/Actor.js +71 -93
  283. package/Rendering/Core/Actor2D.js +64 -78
  284. package/Rendering/Core/AnnotatedCubeActor/Presets.js +5 -11
  285. package/Rendering/Core/AnnotatedCubeActor.js +94 -79
  286. package/Rendering/Core/AxesActor.js +65 -87
  287. package/Rendering/Core/Camera.js +246 -271
  288. package/Rendering/Core/CellPicker.js +125 -148
  289. package/Rendering/Core/ColorTransferFunction/ColorMaps.js +20 -21
  290. package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +20 -21
  291. package/Rendering/Core/ColorTransferFunction/Constants.js +4 -4
  292. package/Rendering/Core/ColorTransferFunction.js +460 -546
  293. package/Rendering/Core/Coordinate/Constants.js +2 -2
  294. package/Rendering/Core/Coordinate.js +119 -198
  295. package/Rendering/Core/CubeAxesActor.js +294 -320
  296. package/Rendering/Core/Follower.js +46 -45
  297. package/Rendering/Core/Glyph3DMapper/Constants.js +4 -4
  298. package/Rendering/Core/Glyph3DMapper.js +96 -148
  299. package/Rendering/Core/HardwareSelector.js +36 -69
  300. package/Rendering/Core/ImageArrayMapper.js +87 -126
  301. package/Rendering/Core/ImageCPRMapper.js +134 -209
  302. package/Rendering/Core/ImageMapper/Constants.js +2 -2
  303. package/Rendering/Core/ImageMapper.js +85 -144
  304. package/Rendering/Core/ImageProperty/Constants.js +2 -2
  305. package/Rendering/Core/ImageProperty.js +66 -81
  306. package/Rendering/Core/ImageResliceMapper/Constants.js +2 -2
  307. package/Rendering/Core/ImageResliceMapper.js +36 -29
  308. package/Rendering/Core/ImageSlice.js +85 -127
  309. package/Rendering/Core/InteractorObserver.js +82 -73
  310. package/Rendering/Core/InteractorStyle/Constants.js +2 -2
  311. package/Rendering/Core/InteractorStyle.js +56 -58
  312. package/Rendering/Core/Light.js +43 -49
  313. package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +37 -48
  314. package/Rendering/Core/Mapper/Constants.js +6 -6
  315. package/Rendering/Core/Mapper/Static.js +15 -12
  316. package/Rendering/Core/Mapper.js +194 -259
  317. package/Rendering/Core/Mapper2D.js +61 -100
  318. package/Rendering/Core/Picker.js +124 -143
  319. package/Rendering/Core/PixelSpaceCallbackMapper.js +40 -37
  320. package/Rendering/Core/PointPicker.js +68 -79
  321. package/Rendering/Core/Prop/Constants.js +2 -2
  322. package/Rendering/Core/Prop.js +58 -106
  323. package/Rendering/Core/Prop3D.js +54 -83
  324. package/Rendering/Core/Property/Constants.js +6 -6
  325. package/Rendering/Core/Property.js +45 -74
  326. package/Rendering/Core/Property2D/Constants.js +2 -2
  327. package/Rendering/Core/Property2D.js +33 -42
  328. package/Rendering/Core/RenderWindow.js +70 -82
  329. package/Rendering/Core/RenderWindowInteractor/Constants.js +7 -7
  330. package/Rendering/Core/RenderWindowInteractor.js +324 -439
  331. package/Rendering/Core/Renderer.js +192 -256
  332. package/Rendering/Core/ScalarBarActor.js +267 -272
  333. package/Rendering/Core/Skybox.js +26 -24
  334. package/Rendering/Core/SphereMapper.js +22 -12
  335. package/Rendering/Core/StickMapper.js +22 -12
  336. package/Rendering/Core/SurfaceLICInterface/Constants.js +6 -6
  337. package/Rendering/Core/SurfaceLICInterface.js +13 -9
  338. package/Rendering/Core/SurfaceLICMapper.js +23 -15
  339. package/Rendering/Core/Texture.js +99 -141
  340. package/Rendering/Core/Viewport.js +60 -88
  341. package/Rendering/Core/Volume.js +55 -77
  342. package/Rendering/Core/VolumeMapper/Constants.js +4 -4
  343. package/Rendering/Core/VolumeMapper.js +59 -91
  344. package/Rendering/Core/VolumeProperty/Constants.js +4 -4
  345. package/Rendering/Core/VolumeProperty.js +78 -115
  346. package/Rendering/Core.js +47 -49
  347. package/Rendering/Misc/CanvasView.js +62 -61
  348. package/Rendering/Misc/FullScreenRenderWindow.js +60 -62
  349. package/Rendering/Misc/GenericRenderWindow.js +48 -37
  350. package/Rendering/Misc/RemoteView.js +86 -80
  351. package/Rendering/Misc/RenderWindowWithControlBar.js +54 -48
  352. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +43 -51
  353. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +52 -82
  354. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +258 -308
  355. package/Rendering/Misc/SynchronizableRenderWindow.js +133 -163
  356. package/Rendering/Misc/TextureLODsDownloader.js +72 -74
  357. package/Rendering/Misc.js +7 -7
  358. package/Rendering/OpenGL/Actor.js +57 -68
  359. package/Rendering/OpenGL/Actor2D.js +56 -56
  360. package/Rendering/OpenGL/BufferObject/Constants.js +2 -2
  361. package/Rendering/OpenGL/BufferObject.js +50 -65
  362. package/Rendering/OpenGL/Camera.js +35 -29
  363. package/Rendering/OpenGL/CellArrayBufferObject.js +119 -149
  364. package/Rendering/OpenGL/Convolution2DPass.js +87 -81
  365. package/Rendering/OpenGL/CubeAxesActor.js +28 -21
  366. package/Rendering/OpenGL/ForwardPass.js +53 -64
  367. package/Rendering/OpenGL/Framebuffer.js +61 -101
  368. package/Rendering/OpenGL/Glyph3DMapper.js +165 -196
  369. package/Rendering/OpenGL/HardwareSelector/Constants.js +2 -2
  370. package/Rendering/OpenGL/HardwareSelector.js +272 -397
  371. package/Rendering/OpenGL/Helper.js +58 -73
  372. package/Rendering/OpenGL/ImageCPRMapper.js +339 -421
  373. package/Rendering/OpenGL/ImageMapper.js +268 -361
  374. package/Rendering/OpenGL/ImageResliceMapper.js +306 -438
  375. package/Rendering/OpenGL/ImageSlice.js +48 -54
  376. package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +102 -84
  377. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +43 -42
  378. package/Rendering/OpenGL/PolyDataMapper.js +358 -492
  379. package/Rendering/OpenGL/PolyDataMapper2D.js +153 -205
  380. package/Rendering/OpenGL/RadialDistortionPass.js +86 -89
  381. package/Rendering/OpenGL/RenderWindow/Constants.js +2 -2
  382. package/Rendering/OpenGL/RenderWindow/ContextProxy.js +20 -29
  383. package/Rendering/OpenGL/RenderWindow.js +356 -510
  384. package/Rendering/OpenGL/Renderer.js +77 -89
  385. package/Rendering/OpenGL/ReplacementShaderMapper.js +28 -46
  386. package/Rendering/OpenGL/ScalarBarActor.js +28 -21
  387. package/Rendering/OpenGL/Shader.js +37 -31
  388. package/Rendering/OpenGL/ShaderCache.js +67 -74
  389. package/Rendering/OpenGL/ShaderProgram.js +136 -248
  390. package/Rendering/OpenGL/Skybox.js +99 -60
  391. package/Rendering/OpenGL/SphereMapper.js +94 -108
  392. package/Rendering/OpenGL/StickMapper.js +110 -114
  393. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +91 -157
  394. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +142 -151
  395. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +142 -216
  396. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +79 -100
  397. package/Rendering/OpenGL/SurfaceLIC.js +2 -2
  398. package/Rendering/OpenGL/Texture/Constants.js +4 -4
  399. package/Rendering/OpenGL/Texture.js +443 -608
  400. package/Rendering/OpenGL/TextureUnitManager.js +47 -43
  401. package/Rendering/OpenGL/VertexArrayObject.js +92 -131
  402. package/Rendering/OpenGL/ViewNodeFactory.js +25 -13
  403. package/Rendering/OpenGL/Volume.js +38 -34
  404. package/Rendering/OpenGL/VolumeMapper.js +437 -547
  405. package/Rendering/OpenGL.js +28 -28
  406. package/Rendering/SceneGraph/RenderPass.js +34 -31
  407. package/Rendering/SceneGraph/RenderWindowViewNode.js +68 -94
  408. package/Rendering/SceneGraph/ViewNode.js +82 -111
  409. package/Rendering/SceneGraph/ViewNodeFactory.js +31 -26
  410. package/Rendering/SceneGraph.js +4 -4
  411. package/Rendering/WebGPU/Actor.js +49 -49
  412. package/Rendering/WebGPU/Actor2D.js +45 -44
  413. package/Rendering/WebGPU/BindGroup.js +43 -50
  414. package/Rendering/WebGPU/Buffer.js +41 -50
  415. package/Rendering/WebGPU/BufferManager/Constants.js +4 -4
  416. package/Rendering/WebGPU/BufferManager.js +111 -141
  417. package/Rendering/WebGPU/Camera.js +65 -67
  418. package/Rendering/WebGPU/CellArrayMapper.js +621 -388
  419. package/Rendering/WebGPU/CubeAxesActor.js +28 -19
  420. package/Rendering/WebGPU/Device.js +78 -133
  421. package/Rendering/WebGPU/ForwardPass.js +75 -72
  422. package/Rendering/WebGPU/FullScreenQuad.js +25 -18
  423. package/Rendering/WebGPU/Glyph3DMapper.js +62 -74
  424. package/Rendering/WebGPU/HardwareSelectionPass.js +45 -38
  425. package/Rendering/WebGPU/HardwareSelector.js +200 -276
  426. package/Rendering/WebGPU/ImageMapper.js +180 -171
  427. package/Rendering/WebGPU/ImageSlice.js +45 -44
  428. package/Rendering/WebGPU/IndexBuffer.js +166 -200
  429. package/Rendering/WebGPU/OpaquePass.js +37 -36
  430. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +72 -45
  431. package/Rendering/WebGPU/Pipeline.js +37 -51
  432. package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +27 -19
  433. package/Rendering/WebGPU/PolyDataMapper.js +50 -53
  434. package/Rendering/WebGPU/PolyDataMapper2D.js +39 -39
  435. package/Rendering/WebGPU/RenderEncoder.js +68 -88
  436. package/Rendering/WebGPU/RenderWindow.js +262 -376
  437. package/Rendering/WebGPU/Renderer.js +224 -208
  438. package/Rendering/WebGPU/Sampler.js +27 -21
  439. package/Rendering/WebGPU/ScalarBarActor.js +28 -19
  440. package/Rendering/WebGPU/ShaderCache.js +43 -41
  441. package/Rendering/WebGPU/ShaderDescription.js +52 -59
  442. package/Rendering/WebGPU/ShaderModule.js +26 -17
  443. package/Rendering/WebGPU/SimpleMapper.js +185 -121
  444. package/Rendering/WebGPU/SphereMapper.js +200 -130
  445. package/Rendering/WebGPU/StickMapper.js +289 -152
  446. package/Rendering/WebGPU/StorageBuffer.js +100 -115
  447. package/Rendering/WebGPU/Texture.js +79 -99
  448. package/Rendering/WebGPU/TextureManager.js +52 -54
  449. package/Rendering/WebGPU/TextureView.js +40 -43
  450. package/Rendering/WebGPU/Types.js +53 -70
  451. package/Rendering/WebGPU/UniformBuffer.js +158 -184
  452. package/Rendering/WebGPU/VertexInput.js +64 -90
  453. package/Rendering/WebGPU/ViewNodeFactory.js +25 -13
  454. package/Rendering/WebGPU/Volume.js +52 -51
  455. package/Rendering/WebGPU/VolumePass.js +218 -239
  456. package/Rendering/WebGPU/VolumePassFSQ.js +625 -306
  457. package/Rendering/WebGPU.js +1 -1
  458. package/Rendering/index.js +5 -5
  459. package/Widgets/Core/AbstractWidget/Constants.js +2 -2
  460. package/Widgets/Core/AbstractWidget.js +49 -58
  461. package/Widgets/Core/AbstractWidgetFactory.js +101 -122
  462. package/Widgets/Core/StateBuilder/boundsMixin.js +23 -28
  463. package/Widgets/Core/StateBuilder/color3Mixin.js +10 -7
  464. package/Widgets/Core/StateBuilder/colorMixin.js +10 -6
  465. package/Widgets/Core/StateBuilder/cornerMixin.js +16 -15
  466. package/Widgets/Core/StateBuilder/directionMixin.js +20 -18
  467. package/Widgets/Core/StateBuilder/manipulatorMixin.js +26 -18
  468. package/Widgets/Core/StateBuilder/nameMixin.js +10 -6
  469. package/Widgets/Core/StateBuilder/orientationMixin.js +19 -16
  470. package/Widgets/Core/StateBuilder/originMixin.js +25 -32
  471. package/Widgets/Core/StateBuilder/scale1Mixin.js +10 -6
  472. package/Widgets/Core/StateBuilder/scale3Mixin.js +10 -6
  473. package/Widgets/Core/StateBuilder/shapeMixin.js +12 -6
  474. package/Widgets/Core/StateBuilder/textMixin.js +10 -6
  475. package/Widgets/Core/StateBuilder/visibleMixin.js +10 -6
  476. package/Widgets/Core/StateBuilder.js +120 -149
  477. package/Widgets/Core/WidgetManager/Constants.js +7 -7
  478. package/Widgets/Core/WidgetManager.js +249 -421
  479. package/Widgets/Core/WidgetState.js +48 -57
  480. package/Widgets/Core.js +5 -5
  481. package/Widgets/Manipulators/AbstractManipulator.js +20 -14
  482. package/Widgets/Manipulators/CPRManipulator.js +55 -71
  483. package/Widgets/Manipulators/LineManipulator.js +31 -28
  484. package/Widgets/Manipulators/PickerManipulator.d.ts +48 -0
  485. package/Widgets/Manipulators/PickerManipulator.js +65 -0
  486. package/Widgets/Manipulators/PlaneManipulator.js +26 -23
  487. package/Widgets/Manipulators/TrackballManipulator.js +39 -35
  488. package/Widgets/Manipulators.js +4 -2
  489. package/Widgets/Representations/ArrowHandleRepresentation.js +148 -162
  490. package/Widgets/Representations/CircleContextRepresentation.js +44 -38
  491. package/Widgets/Representations/ContextRepresentation.js +17 -14
  492. package/Widgets/Representations/ConvexFaceContextRepresentation.js +50 -47
  493. package/Widgets/Representations/CroppingOutlineRepresentation.js +38 -27
  494. package/Widgets/Representations/CubeHandleRepresentation.js +21 -18
  495. package/Widgets/Representations/GlyphRepresentation.js +107 -152
  496. package/Widgets/Representations/HandleRepresentation.js +17 -14
  497. package/Widgets/Representations/ImplicitPlaneRepresentation.js +97 -91
  498. package/Widgets/Representations/LineHandleRepresentation.js +44 -41
  499. package/Widgets/Representations/OutlineContextRepresentation.js +42 -36
  500. package/Widgets/Representations/PolyLineRepresentation.js +60 -75
  501. package/Widgets/Representations/RectangleContextRepresentation.js +42 -37
  502. package/Widgets/Representations/SphereContextRepresentation.js +19 -27
  503. package/Widgets/Representations/SphereHandleRepresentation.js +31 -27
  504. package/Widgets/Representations/SplineContextRepresentation.js +46 -70
  505. package/Widgets/Representations/WidgetRepresentation/Constants.js +2 -2
  506. package/Widgets/Representations/WidgetRepresentation.js +99 -134
  507. package/Widgets/Representations.js +13 -13
  508. package/Widgets/Widgets3D/AngleWidget/behavior.js +41 -63
  509. package/Widgets/Widgets3D/AngleWidget.js +40 -38
  510. package/Widgets/Widgets3D/DistanceWidget/behavior.js +40 -61
  511. package/Widgets/Widgets3D/DistanceWidget.js +38 -36
  512. package/Widgets/Widgets3D/EllipseWidget/behavior.js +14 -19
  513. package/Widgets/Widgets3D/EllipseWidget/state.js +4 -2
  514. package/Widgets/Widgets3D/EllipseWidget.js +37 -26
  515. package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +26 -56
  516. package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +14 -17
  517. package/Widgets/Widgets3D/ImageCroppingWidget/state.js +20 -16
  518. package/Widgets/Widgets3D/ImageCroppingWidget.js +80 -98
  519. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +55 -77
  520. package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +17 -18
  521. package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +15 -7
  522. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +30 -29
  523. package/Widgets/Widgets3D/LabelWidget/behavior.js +37 -62
  524. package/Widgets/Widgets3D/LabelWidget.js +31 -25
  525. package/Widgets/Widgets3D/LineWidget/Constants.js +8 -8
  526. package/Widgets/Widgets3D/LineWidget/behavior.js +77 -114
  527. package/Widgets/Widgets3D/LineWidget/helpers.js +13 -20
  528. package/Widgets/Widgets3D/LineWidget/state.js +2 -1
  529. package/Widgets/Widgets3D/LineWidget.js +39 -35
  530. package/Widgets/Widgets3D/PaintWidget/behavior.js +24 -59
  531. package/Widgets/Widgets3D/PaintWidget.js +39 -37
  532. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +44 -68
  533. package/Widgets/Widgets3D/PolyLineWidget.js +36 -31
  534. package/Widgets/Widgets3D/RectangleWidget/behavior.js +6 -11
  535. package/Widgets/Widgets3D/RectangleWidget/state.js +4 -2
  536. package/Widgets/Widgets3D/RectangleWidget.js +37 -25
  537. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +35 -21
  538. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +133 -209
  539. package/Widgets/Widgets3D/ResliceCursorWidget/cprBehavior.js +26 -41
  540. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +89 -116
  541. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +33 -40
  542. package/Widgets/Widgets3D/ResliceCursorWidget.js +186 -227
  543. package/Widgets/Widgets3D/SeedWidget/behavior.js +82 -0
  544. package/Widgets/Widgets3D/SeedWidget/state.js +18 -0
  545. package/Widgets/Widgets3D/SeedWidget.d.ts +44 -0
  546. package/Widgets/Widgets3D/SeedWidget.js +43 -0
  547. package/Widgets/Widgets3D/ShapeWidget/Constants.js +19 -19
  548. package/Widgets/Widgets3D/ShapeWidget/behavior.js +150 -252
  549. package/Widgets/Widgets3D/ShapeWidget.js +24 -27
  550. package/Widgets/Widgets3D/SphereWidget/behavior.js +35 -69
  551. package/Widgets/Widgets3D/SphereWidget/state.js +9 -5
  552. package/Widgets/Widgets3D/SphereWidget.js +34 -44
  553. package/Widgets/Widgets3D/SplineWidget/behavior.js +85 -120
  554. package/Widgets/Widgets3D/SplineWidget.js +43 -39
  555. package/Widgets/Widgets3D.js +15 -15
  556. package/Widgets/index.js +4 -4
  557. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +95 -207
  558. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
  559. package/favicon.js +5 -6
  560. package/index.d.ts +4 -2
  561. package/index.js +4 -3
  562. package/macros.js +4 -1931
  563. package/macros2.js +1684 -0
  564. package/package.json +6 -6
  565. package/vtk.js +18 -31
@@ -1,6 +1,5 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import { mat4, vec4 } from 'gl-matrix';
3
- import macro, { vtkWarningMacro } from '../../macros.js';
2
+ import { m as macro, v as vtkWarningMacro } from '../../macros2.js';
4
3
  import vtkDataArray from '../../Common/Core/DataArray.js';
5
4
  import { f as vtkMath } from '../../Common/Core/Math/index.js';
6
5
  import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
@@ -10,177 +9,147 @@ import vtkImageData from '../../Common/DataModel/ImageData.js';
10
9
  import vtkImageInterpolator from './ImageInterpolator.js';
11
10
  import vtkImagePointDataIterator from './ImagePointDataIterator.js';
12
11
  import { InterpolationMode, ImageBorderMode } from './AbstractImageInterpolator/Constants.js';
13
- import { vtkInterpolationMathRound, vtkInterpolationMathClamp, vtkInterpolationMathFloor } from './AbstractImageInterpolator/InterpolationInfo.js';
12
+ import { vtkInterpolationMathClamp, vtkInterpolationMathFloor, vtkInterpolationMathRound } from './AbstractImageInterpolator/InterpolationInfo.js';
14
13
  import Constants from './ImageReslice/Constants.js';
15
14
 
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+ const {
16
+ SlabMode
17
+ } = Constants;
18
+ const {
19
+ vtkErrorMacro
20
+ } = macro;
17
21
 
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
- var SlabMode = Constants.SlabMode;
20
- var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
22
+ // ----------------------------------------------------------------------------
21
23
  // vtkImageReslice methods
22
24
  // ----------------------------------------------------------------------------
23
25
 
24
26
  function vtkImageReslice(publicAPI, model) {
25
27
  // Set our className
26
28
  model.classHierarchy.push('vtkImageReslice');
27
-
28
- var superClass = _objectSpread({}, publicAPI);
29
-
30
- var indexMatrix = null;
31
- var optimizedTransform = null;
32
-
29
+ const superClass = {
30
+ ...publicAPI
31
+ };
32
+ let indexMatrix = null;
33
+ let optimizedTransform = null;
33
34
  function getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f) {
34
- var n = sampleCount - 1;
35
-
36
- for (var i = 0; i < inComponents; i += 1) {
37
- var result = tmpPtr[i] * 0.5;
38
-
39
- for (var j = 1; j < n; j += 1) {
35
+ const n = sampleCount - 1;
36
+ for (let i = 0; i < inComponents; i += 1) {
37
+ let result = tmpPtr[i] * 0.5;
38
+ for (let j = 1; j < n; j += 1) {
40
39
  result += tmpPtr[i + j * inComponents];
41
40
  }
42
-
43
41
  result += tmpPtr[i + n * inComponents] * 0.5;
44
42
  tmpPtr[i] = result * f;
45
43
  }
46
44
  }
47
-
48
45
  function getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f) {
49
- for (var i = 0; i < inComponents; i += 1) {
50
- var result = tmpPtr[i];
51
-
52
- for (var j = 1; j < sampleCount; j += 1) {
46
+ for (let i = 0; i < inComponents; i += 1) {
47
+ let result = tmpPtr[i];
48
+ for (let j = 1; j < sampleCount; j += 1) {
53
49
  result += tmpPtr[i + j * inComponents];
54
50
  }
55
-
56
51
  tmpPtr[i] = result * f;
57
52
  }
58
53
  }
59
-
60
54
  function getImageResliceCompositeMinValue(tmpPtr, inComponents, sampleCount) {
61
- for (var i = 0; i < inComponents; i += 1) {
62
- var result = tmpPtr[i];
63
-
64
- for (var j = 1; j < sampleCount; j += 1) {
55
+ for (let i = 0; i < inComponents; i += 1) {
56
+ let result = tmpPtr[i];
57
+ for (let j = 1; j < sampleCount; j += 1) {
65
58
  result = Math.min(result, tmpPtr[i + j * inComponents]);
66
59
  }
67
-
68
60
  tmpPtr[i] = result;
69
61
  }
70
62
  }
71
-
72
63
  function getImageResliceCompositeMaxValue(tmpPtr, inComponents, sampleCount) {
73
- for (var i = 0; i < inComponents; i += 1) {
74
- var result = tmpPtr[i];
75
-
76
- for (var j = 1; j < sampleCount; j += 1) {
64
+ for (let i = 0; i < inComponents; i += 1) {
65
+ let result = tmpPtr[i];
66
+ for (let j = 1; j < sampleCount; j += 1) {
77
67
  result = Math.max(result, tmpPtr[i + j * inComponents]);
78
68
  }
79
-
80
69
  tmpPtr[i] = result;
81
70
  }
82
71
  }
83
-
84
72
  function getImageResliceCompositeMeanValue(tmpPtr, inComponents, sampleCount) {
85
- var f = 1.0 / sampleCount;
73
+ const f = 1.0 / sampleCount;
86
74
  getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f);
87
75
  }
88
-
89
76
  function getImageResliceCompositeMeanTrap(tmpPtr, inComponents, sampleCount) {
90
- var f = 1.0 / (sampleCount - 1);
77
+ const f = 1.0 / (sampleCount - 1);
91
78
  getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f);
92
79
  }
93
-
94
80
  function getImageResliceCompositeSumValue(tmpPtr, inComponents, sampleCount) {
95
- var f = 1.0;
81
+ const f = 1.0;
96
82
  getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f);
97
83
  }
98
-
99
84
  function getImageResliceCompositeSumTrap(tmpPtr, inComponents, sampleCount) {
100
- var f = 1.0;
85
+ const f = 1.0;
101
86
  getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f);
102
87
  }
103
-
104
- publicAPI.getMTime = function () {
105
- var mTime = superClass.getMTime();
106
-
88
+ publicAPI.getMTime = () => {
89
+ let mTime = superClass.getMTime();
107
90
  if (model.resliceTransform) {
108
91
  mTime = Math.max(mTime, model.resliceTransform.getMTime());
109
92
  }
110
-
111
93
  return mTime;
112
94
  };
113
-
114
- publicAPI.setResliceAxes = function (resliceAxes) {
95
+ publicAPI.setResliceAxes = resliceAxes => {
115
96
  if (!model.resliceAxes) {
116
97
  model.resliceAxes = mat4.identity(new Float64Array(16));
117
98
  }
118
-
119
99
  if (!mat4.exactEquals(model.resliceAxes, resliceAxes)) {
120
100
  mat4.copy(model.resliceAxes, resliceAxes);
121
101
  publicAPI.modified();
122
102
  return true;
123
103
  }
124
-
125
104
  return null;
126
105
  };
127
-
128
- publicAPI.requestData = function (inData, outData) {
106
+ publicAPI.requestData = (inData, outData) => {
129
107
  // implement requestData
130
- var input = inData[0];
131
-
108
+ const input = inData[0];
132
109
  if (!input) {
133
110
  vtkErrorMacro('Invalid or missing input');
134
111
  return;
135
- } // console.time('reslice');
136
- // Retrieve output and volume data
137
-
112
+ }
138
113
 
139
- var origin = input.getOrigin();
140
- var inSpacing = input.getSpacing();
141
- var dims = input.getDimensions();
142
- var inScalars = input.getPointData().getScalars();
143
- var inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];
144
- var outOrigin = [0, 0, 0];
145
- var outSpacing = [1, 1, 1];
146
- var outWholeExt = [0, 0, 0, 0, 0, 0];
147
- var outDims = [0, 0, 0];
148
- var matrix = mat4.identity(new Float64Array(16));
114
+ // console.time('reslice');
149
115
 
116
+ // Retrieve output and volume data
117
+ const origin = input.getOrigin();
118
+ const inSpacing = input.getSpacing();
119
+ const dims = input.getDimensions();
120
+ const inScalars = input.getPointData().getScalars();
121
+ const inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];
122
+ const outOrigin = [0, 0, 0];
123
+ const outSpacing = [1, 1, 1];
124
+ const outWholeExt = [0, 0, 0, 0, 0, 0];
125
+ const outDims = [0, 0, 0];
126
+ const matrix = mat4.identity(new Float64Array(16));
150
127
  if (model.resliceAxes) {
151
128
  mat4.multiply(matrix, matrix, model.resliceAxes);
152
129
  }
153
-
154
- var imatrix = new Float64Array(16);
130
+ const imatrix = new Float64Array(16);
155
131
  mat4.invert(imatrix, matrix);
156
- var inCenter = [origin[0] + 0.5 * (inWholeExt[0] + inWholeExt[1]) * inSpacing[0], origin[1] + 0.5 * (inWholeExt[2] + inWholeExt[3]) * inSpacing[1], origin[2] + 0.5 * (inWholeExt[4] + inWholeExt[5]) * inSpacing[2]];
157
- var maxBounds = null;
158
-
132
+ const inCenter = [origin[0] + 0.5 * (inWholeExt[0] + inWholeExt[1]) * inSpacing[0], origin[1] + 0.5 * (inWholeExt[2] + inWholeExt[3]) * inSpacing[1], origin[2] + 0.5 * (inWholeExt[4] + inWholeExt[5]) * inSpacing[2]];
133
+ let maxBounds = null;
159
134
  if (model.autoCropOutput) {
160
135
  maxBounds = publicAPI.getAutoCroppedOutputBounds(input);
161
136
  }
162
-
163
- for (var i = 0; i < 3; i++) {
164
- var s = 0; // default output spacing
165
-
166
- var d = 0; // default linear dimension
167
-
168
- var e = 0; // default extent start
169
-
170
- var c = 0; // transformed center-of-volume
137
+ for (let i = 0; i < 3; i++) {
138
+ let s = 0; // default output spacing
139
+ let d = 0; // default linear dimension
140
+ let e = 0; // default extent start
141
+ let c = 0; // transformed center-of-volume
171
142
 
172
143
  if (model.transformInputSampling) {
173
- var r = 0.0;
174
-
175
- for (var j = 0; j < 3; j++) {
144
+ let r = 0.0;
145
+ for (let j = 0; j < 3; j++) {
176
146
  c += imatrix[4 * j + i] * (inCenter[j] - matrix[4 * 3 + j]);
177
- var tmp = matrix[4 * i + j] * matrix[4 * i + j];
147
+ const tmp = matrix[4 * i + j] * matrix[4 * i + j];
178
148
  s += tmp * Math.abs(inSpacing[j]);
179
149
  d += tmp * (inWholeExt[2 * j + 1] - inWholeExt[2 * j]) * Math.abs(inSpacing[j]);
180
150
  e += tmp * inWholeExt[2 * j];
181
151
  r += tmp;
182
152
  }
183
-
184
153
  s /= r;
185
154
  d /= r * Math.sqrt(r);
186
155
  e /= r;
@@ -190,13 +159,11 @@ function vtkImageReslice(publicAPI, model) {
190
159
  d = (inWholeExt[2 * i + 1] - inWholeExt[2 * i]) * s;
191
160
  e = inWholeExt[2 * i];
192
161
  }
193
-
194
162
  if (model.outputSpacing == null) {
195
163
  outSpacing[i] = s;
196
164
  } else {
197
165
  outSpacing[i] = model.outputSpacing[i];
198
166
  }
199
-
200
167
  if (i >= model.outputDimensionality) {
201
168
  outWholeExt[2 * i] = 0;
202
169
  outWholeExt[2 * i + 1] = 0;
@@ -204,14 +171,12 @@ function vtkImageReslice(publicAPI, model) {
204
171
  if (model.autoCropOutput) {
205
172
  d = maxBounds[2 * i + 1] - maxBounds[2 * i];
206
173
  }
207
-
208
174
  outWholeExt[2 * i] = Math.round(e);
209
175
  outWholeExt[2 * i + 1] = Math.round(outWholeExt[2 * i] + Math.abs(d / outSpacing[i]));
210
176
  } else {
211
177
  outWholeExt[2 * i] = model.outputExtent[2 * i];
212
178
  outWholeExt[2 * i + 1] = model.outputExtent[2 * i + 1];
213
179
  }
214
-
215
180
  if (i >= model.outputDimensionality) {
216
181
  outOrigin[i] = 0;
217
182
  } else if (model.outputOrigin == null) {
@@ -225,180 +190,173 @@ function vtkImageReslice(publicAPI, model) {
225
190
  } else {
226
191
  outOrigin[i] = model.outputOrigin[i];
227
192
  }
228
-
229
193
  outDims[i] = outWholeExt[2 * i + 1] - outWholeExt[2 * i] + 1;
230
194
  }
231
-
232
- var dataType = inScalars.getDataType();
233
-
195
+ let dataType = inScalars.getDataType();
234
196
  if (model.outputScalarType) {
235
197
  dataType = model.outputScalarType;
236
198
  }
199
+ const numComponents = input.getPointData().getScalars().getNumberOfComponents(); // or s.numberOfComponents;
237
200
 
238
- var numComponents = input.getPointData().getScalars().getNumberOfComponents(); // or s.numberOfComponents;
239
-
240
- var outScalarsData = macro.newTypedArray(dataType, outDims[0] * outDims[1] * outDims[2] * numComponents);
241
- var outScalars = vtkDataArray.newInstance({
201
+ const outScalarsData = macro.newTypedArray(dataType, outDims[0] * outDims[1] * outDims[2] * numComponents);
202
+ const outScalars = vtkDataArray.newInstance({
242
203
  name: 'Scalars',
243
204
  values: outScalarsData,
244
205
  numberOfComponents: numComponents
245
- }); // Update output
206
+ });
246
207
 
247
- var output = vtkImageData.newInstance();
208
+ // Update output
209
+ const output = vtkImageData.newInstance();
248
210
  output.setDimensions(outDims);
249
211
  output.setOrigin(outOrigin);
250
212
  output.setSpacing(outSpacing);
251
-
252
213
  if (model.outputDirection) {
253
214
  output.setDirection(model.outputDirection);
254
215
  }
255
-
256
216
  output.getPointData().setScalars(outScalars);
257
217
  publicAPI.getIndexMatrix(input, output);
258
- var interpolationMode = model.interpolationMode;
218
+ let interpolationMode = model.interpolationMode;
259
219
  model.usePermuteExecute = false;
260
-
261
220
  if (model.optimization) {
262
221
  if (model.slabSliceSpacingFraction === 1.0 && model.interpolator.isSeparable() && publicAPI.isPermutationMatrix(indexMatrix)) {
263
222
  model.usePermuteExecute = true;
264
-
265
223
  if (publicAPI.canUseNearestNeighbor(indexMatrix, outWholeExt)) {
266
224
  interpolationMode = InterpolationMode.NEAREST;
267
225
  }
268
226
  }
269
227
  }
270
-
271
228
  model.interpolator.setInterpolationMode(interpolationMode);
272
- var borderMode = ImageBorderMode.CLAMP;
229
+ let borderMode = ImageBorderMode.CLAMP;
273
230
  borderMode = model.wrap ? ImageBorderMode.REPEAT : borderMode;
274
231
  borderMode = model.mirror ? ImageBorderMode.MIRROR : borderMode;
275
232
  model.interpolator.setBorderMode(borderMode);
276
- var mintol = 7.62939453125e-6;
277
- var maxtol = 2.0 * 2147483647;
278
- var tol = 0.5 * model.border;
233
+ const mintol = 7.62939453125e-6;
234
+ const maxtol = 2.0 * 2147483647;
235
+ let tol = 0.5 * model.border;
279
236
  tol = borderMode === ImageBorderMode.CLAMP ? tol : maxtol;
280
237
  tol = tol > mintol ? tol : mintol;
281
238
  model.interpolator.setTolerance(tol);
282
239
  model.interpolator.initialize(input);
283
240
  publicAPI.vtkImageResliceExecute(input, output);
284
241
  model.interpolator.releaseData();
285
- outData[0] = output; // console.timeEnd('reslice');
242
+ outData[0] = output;
243
+
244
+ // console.timeEnd('reslice');
286
245
  };
287
246
 
288
- publicAPI.vtkImageResliceExecute = function (input, output) {
247
+ publicAPI.vtkImageResliceExecute = (input, output) => {
289
248
  // const outDims = output.getDimensions();
290
- var inScalars = input.getPointData().getScalars();
291
- var outScalars = output.getPointData().getScalars();
292
- var outPtr = outScalars.getData();
293
- var outExt = output.getExtent();
294
- var newmat = indexMatrix;
295
-
296
- var nsamples = Math.max(model.slabNumberOfSlices, 1); // spacing between slab samples (as a fraction of slice spacing).
297
-
298
- var slabSampleSpacing = model.slabSliceSpacingFraction; // check for perspective transformation
299
-
300
- var perspective = publicAPI.isPerspectiveMatrix(newmat); // extra scalar info for nearest-neighbor optimization
301
-
302
- var inPtr = inScalars.getData();
303
- var inputScalarSize = 1; // inScalars.getElementComponentSize(); // inScalars.getDataTypeSize();
304
-
305
- var inputScalarType = inScalars.getDataType();
306
- var inComponents = inScalars.getNumberOfComponents(); // interpolator.GetNumberOfComponents();
307
-
308
- var componentOffset = model.interpolator.getComponentOffset();
309
- var borderMode = model.interpolator.getBorderMode();
310
- var inDims = input.getDimensions();
311
- var inExt = [0, inDims[0] - 1, 0, inDims[1] - 1, 0, inDims[2] - 1]; // interpolator->GetExtent();
312
-
313
- var inInc = [0, 0, 0];
249
+ const inScalars = input.getPointData().getScalars();
250
+ const outScalars = output.getPointData().getScalars();
251
+ let outPtr = outScalars.getData();
252
+ const outExt = output.getExtent();
253
+ const newmat = indexMatrix;
254
+
255
+ // multiple samples for thick slabs
256
+ const nsamples = Math.max(model.slabNumberOfSlices, 1);
257
+
258
+ // spacing between slab samples (as a fraction of slice spacing).
259
+ const slabSampleSpacing = model.slabSliceSpacingFraction;
260
+
261
+ // check for perspective transformation
262
+ const perspective = publicAPI.isPerspectiveMatrix(newmat);
263
+
264
+ // extra scalar info for nearest-neighbor optimization
265
+ let inPtr = inScalars.getData();
266
+ const inputScalarSize = 1; // inScalars.getElementComponentSize(); // inScalars.getDataTypeSize();
267
+ const inputScalarType = inScalars.getDataType();
268
+ const inComponents = inScalars.getNumberOfComponents(); // interpolator.GetNumberOfComponents();
269
+ const componentOffset = model.interpolator.getComponentOffset();
270
+ const borderMode = model.interpolator.getBorderMode();
271
+ const inDims = input.getDimensions();
272
+ const inExt = [0, inDims[0] - 1, 0, inDims[1] - 1, 0, inDims[2] - 1]; // interpolator->GetExtent();
273
+ const inInc = [0, 0, 0];
314
274
  inInc[0] = inScalars.getNumberOfComponents();
315
275
  inInc[1] = inInc[0] * inDims[0];
316
276
  inInc[2] = inInc[1] * inDims[1];
317
- var fullSize = inDims[0] * inDims[1] * inDims[2];
318
-
277
+ const fullSize = inDims[0] * inDims[1] * inDims[2];
319
278
  if (componentOffset > 0 && componentOffset + inComponents < inInc[0]) {
320
279
  inPtr = inPtr.subarray(inputScalarSize * componentOffset);
321
280
  }
322
-
323
- var interpolationMode = InterpolationMode.NEAREST;
324
-
281
+ let interpolationMode = InterpolationMode.NEAREST;
325
282
  if (model.interpolator.isA('vtkImageInterpolator')) {
326
283
  interpolationMode = model.interpolator.getInterpolationMode();
327
284
  }
285
+ const convertScalars = null;
286
+ const rescaleScalars = model.scalarShift !== 0.0 || model.scalarScale !== 1.0;
328
287
 
329
- var convertScalars = null;
330
- var rescaleScalars = model.scalarShift !== 0.0 || model.scalarScale !== 1.0; // is nearest neighbor optimization possible?
331
-
332
- var optimizeNearest = interpolationMode === InterpolationMode.NEAREST && borderMode === ImageBorderMode.CLAMP && !(perspective || convertScalars != null || rescaleScalars) && inputScalarType === outScalars.getDataType() && fullSize === inScalars.getNumberOfTuples() && model.border === true && nsamples <= 1; // get pixel information
288
+ // is nearest neighbor optimization possible?
289
+ const optimizeNearest = interpolationMode === InterpolationMode.NEAREST && borderMode === ImageBorderMode.CLAMP && !(perspective || convertScalars != null || rescaleScalars) && inputScalarType === outScalars.getDataType() && fullSize === inScalars.getNumberOfTuples() && model.border === true && nsamples <= 1;
333
290
 
334
- var scalarType = outScalars.getDataType();
335
- var scalarSize = 1; // outScalars.getElementComponentSize() // outScalars.scalarSize;
291
+ // get pixel information
292
+ const scalarType = outScalars.getDataType();
293
+ const scalarSize = 1; // outScalars.getElementComponentSize() // outScalars.scalarSize;
294
+ const outComponents = outScalars.getNumberOfComponents();
336
295
 
337
- var outComponents = outScalars.getNumberOfComponents(); // break matrix into a set of axes plus an origin
296
+ // break matrix into a set of axes plus an origin
338
297
  // (this allows us to calculate the transform Incrementally)
339
-
340
- var xAxis = [0, 0, 0, 0];
341
- var yAxis = [0, 0, 0, 0];
342
- var zAxis = [0, 0, 0, 0];
343
- var origin = [0, 0, 0, 0];
344
-
345
- for (var i = 0; i < 4; ++i) {
298
+ const xAxis = [0, 0, 0, 0];
299
+ const yAxis = [0, 0, 0, 0];
300
+ const zAxis = [0, 0, 0, 0];
301
+ const origin = [0, 0, 0, 0];
302
+ for (let i = 0; i < 4; ++i) {
346
303
  xAxis[i] = newmat[4 * 0 + i];
347
304
  yAxis[i] = newmat[4 * 1 + i];
348
305
  zAxis[i] = newmat[4 * 2 + i];
349
306
  origin[i] = newmat[4 * 3 + i];
350
- } // get the input origin and spacing for conversion purposes
351
-
307
+ }
352
308
 
309
+ // get the input origin and spacing for conversion purposes
353
310
  model.interpolator.getOrigin();
354
- var inSpacing = model.interpolator.getSpacing();
355
- [1.0 / inSpacing[0], 1.0 / inSpacing[1], 1.0 / inSpacing[2]]; // allocate an output row of type double
356
-
357
- var floatPtr = null;
311
+ const inSpacing = model.interpolator.getSpacing();
312
+ [1.0 / inSpacing[0], 1.0 / inSpacing[1], 1.0 / inSpacing[2]];
358
313
 
314
+ // allocate an output row of type double
315
+ let floatPtr = null;
359
316
  if (!optimizeNearest) {
360
317
  floatPtr = new Float64Array(inComponents * (outExt[1] - outExt[0] + nsamples));
361
318
  }
319
+ const background = macro.newTypedArray(inputScalarType, model.backgroundColor);
362
320
 
363
- var background = macro.newTypedArray(inputScalarType, model.backgroundColor); // set color for area outside of input volume extent
321
+ // set color for area outside of input volume extent
364
322
  // void *background;
365
323
  // vtkAllocBackgroundPixel(&background,
366
324
  // self->GetBackgroundColor(), scalarType, scalarSize, outComponents);
367
- // get various helper functions
368
-
369
- var forceClamping = interpolationMode > InterpolationMode.LINEAR || nsamples > 1 && model.slabMode === SlabMode.SUM;
370
- var convertpixels = publicAPI.getConversionFunc(inputScalarType, scalarType, model.scalarShift, model.scalarScale, forceClamping);
371
- var setpixels = publicAPI.getSetPixelsFunc(scalarType, scalarSize, outComponents, outPtr);
372
- var composite = publicAPI.getCompositeFunc(model.slabMode, model.slabTrapezoidIntegration); // create some variables for when we march through the data
373
-
374
- var idY = outExt[2] - 1;
375
- var idZ = outExt[4] - 1;
376
- var inPoint0 = [0.0, 0.0, 0.0, 0.0];
377
- var inPoint1 = [0.0, 0.0, 0.0, 0.0]; // create an iterator to march through the data
378
325
 
379
- var iter = vtkImagePointDataIterator.newInstance();
326
+ // get various helper functions
327
+ const forceClamping = interpolationMode > InterpolationMode.LINEAR || nsamples > 1 && model.slabMode === SlabMode.SUM;
328
+ const convertpixels = publicAPI.getConversionFunc(inputScalarType, scalarType, model.scalarShift, model.scalarScale, forceClamping);
329
+ const setpixels = publicAPI.getSetPixelsFunc(scalarType, scalarSize, outComponents, outPtr);
330
+ const composite = publicAPI.getCompositeFunc(model.slabMode, model.slabTrapezoidIntegration);
331
+
332
+ // create some variables for when we march through the data
333
+ let idY = outExt[2] - 1;
334
+ let idZ = outExt[4] - 1;
335
+ const inPoint0 = [0.0, 0.0, 0.0, 0.0];
336
+ const inPoint1 = [0.0, 0.0, 0.0, 0.0];
337
+
338
+ // create an iterator to march through the data
339
+ const iter = vtkImagePointDataIterator.newInstance();
380
340
  iter.initialize(output, outExt, model.stencil, null);
381
- var outPtr0 = iter.getScalars(output, 0);
382
- var outPtrIndex = 0;
383
- var outTmp = macro.newTypedArray(scalarType, vtkBoundingBox.getDiagonalLength(outExt) * outComponents * 2);
384
- var interpolatedPtr = new Float64Array(inComponents * nsamples);
385
- var interpolatedPoint = new Float64Array(inComponents);
386
-
341
+ const outPtr0 = iter.getScalars(output, 0);
342
+ let outPtrIndex = 0;
343
+ const outTmp = macro.newTypedArray(scalarType, vtkBoundingBox.getDiagonalLength(outExt) * outComponents * 2);
344
+ const interpolatedPtr = new Float64Array(inComponents * nsamples);
345
+ const interpolatedPoint = new Float64Array(inComponents);
387
346
  for (; !iter.isAtEnd(); iter.nextSpan()) {
388
- var span = iter.spanEndId() - iter.getId();
347
+ const span = iter.spanEndId() - iter.getId();
389
348
  outPtrIndex = iter.getId() * scalarSize * outComponents;
390
-
391
349
  if (!iter.isInStencil()) {
392
350
  // clear any regions that are outside the stencil
393
- var n = setpixels(outTmp, background, outComponents, span);
394
-
395
- for (var _i = 0; _i < n; ++_i) {
396
- outPtr0[outPtrIndex++] = outTmp[_i];
351
+ const n = setpixels(outTmp, background, outComponents, span);
352
+ for (let i = 0; i < n; ++i) {
353
+ outPtr0[outPtrIndex++] = outTmp[i];
397
354
  }
398
355
  } else {
399
356
  // get output index, and compute position in input image
400
- var outIndex = iter.getIndex(); // if Z index increased, then advance position along Z axis
357
+ const outIndex = iter.getIndex();
401
358
 
359
+ // if Z index increased, then advance position along Z axis
402
360
  if (outIndex[2] > idZ) {
403
361
  idZ = outIndex[2];
404
362
  inPoint0[0] = origin[0] + idZ * zAxis[0];
@@ -406,40 +364,37 @@ function vtkImageReslice(publicAPI, model) {
406
364
  inPoint0[2] = origin[2] + idZ * zAxis[2];
407
365
  inPoint0[3] = origin[3] + idZ * zAxis[3];
408
366
  idY = outExt[2] - 1;
409
- } // if Y index increased, then advance position along Y axis
410
-
367
+ }
411
368
 
369
+ // if Y index increased, then advance position along Y axis
412
370
  if (outIndex[1] > idY) {
413
371
  idY = outIndex[1];
414
372
  inPoint1[0] = inPoint0[0] + idY * yAxis[0];
415
373
  inPoint1[1] = inPoint0[1] + idY * yAxis[1];
416
374
  inPoint1[2] = inPoint0[2] + idY * yAxis[2];
417
375
  inPoint1[3] = inPoint0[3] + idY * yAxis[3];
418
- } // march through one row of the output image
419
-
420
-
421
- var idXmin = outIndex[0];
422
- var idXmax = idXmin + span - 1;
376
+ }
423
377
 
378
+ // march through one row of the output image
379
+ const idXmin = outIndex[0];
380
+ const idXmax = idXmin + span - 1;
424
381
  if (!optimizeNearest) {
425
- var wasInBounds = 1;
426
- var isInBounds = 1;
427
- var startIdX = idXmin;
428
- var idX = idXmin;
429
- var tmpPtr = floatPtr;
430
- var pixelIndex = 0;
431
-
382
+ let wasInBounds = 1;
383
+ let isInBounds = 1;
384
+ let startIdX = idXmin;
385
+ let idX = idXmin;
386
+ const tmpPtr = floatPtr;
387
+ let pixelIndex = 0;
432
388
  while (startIdX <= idXmax) {
433
389
  for (; idX <= idXmax && isInBounds === wasInBounds; idX++) {
434
- var inPoint2 = [inPoint1[0] + idX * xAxis[0], inPoint1[1] + idX * xAxis[1], inPoint1[2] + idX * xAxis[2], inPoint1[3] + idX * xAxis[3]];
435
- var inPoint3 = [0, 0, 0, 0];
436
- var inPoint = inPoint2;
390
+ const inPoint2 = [inPoint1[0] + idX * xAxis[0], inPoint1[1] + idX * xAxis[1], inPoint1[2] + idX * xAxis[2], inPoint1[3] + idX * xAxis[3]];
391
+ const inPoint3 = [0, 0, 0, 0];
392
+ let inPoint = inPoint2;
437
393
  isInBounds = false;
438
- var interpolatedPtrIndex = 0;
439
-
440
- for (var sample = 0; sample < nsamples; ++sample) {
394
+ let interpolatedPtrIndex = 0;
395
+ for (let sample = 0; sample < nsamples; ++sample) {
441
396
  if (nsamples > 1) {
442
- var s = sample - 0.5 * (nsamples - 1);
397
+ let s = sample - 0.5 * (nsamples - 1);
443
398
  s *= slabSampleSpacing;
444
399
  inPoint3[0] = inPoint2[0] + s * zAxis[0];
445
400
  inPoint3[1] = inPoint2[1] + s * zAxis[1];
@@ -447,148 +402,126 @@ function vtkImageReslice(publicAPI, model) {
447
402
  inPoint3[3] = inPoint2[3] + s * zAxis[3];
448
403
  inPoint = inPoint3;
449
404
  }
450
-
451
405
  if (perspective) {
452
406
  // only do perspective if necessary
453
- var f = 1 / inPoint[3];
407
+ const f = 1 / inPoint[3];
454
408
  inPoint[0] *= f;
455
409
  inPoint[1] *= f;
456
410
  inPoint[2] *= f;
457
411
  }
458
-
459
412
  if (model.interpolator.checkBoundsIJK(inPoint)) {
460
413
  // do the interpolation
461
414
  isInBounds = 1;
462
415
  model.interpolator.interpolateIJK(inPoint, interpolatedPoint);
463
-
464
- for (var _i2 = 0; _i2 < inComponents; ++_i2) {
465
- interpolatedPtr[interpolatedPtrIndex++] = interpolatedPoint[_i2];
416
+ for (let i = 0; i < inComponents; ++i) {
417
+ interpolatedPtr[interpolatedPtrIndex++] = interpolatedPoint[i];
466
418
  }
467
419
  }
468
420
  }
469
-
470
421
  if (interpolatedPtrIndex > inComponents) {
471
422
  composite(interpolatedPtr, inComponents, interpolatedPtrIndex / inComponents);
472
423
  }
424
+ for (let i = 0; i < inComponents; ++i) {
425
+ tmpPtr[pixelIndex++] = interpolatedPtr[i];
426
+ }
473
427
 
474
- for (var _i3 = 0; _i3 < inComponents; ++_i3) {
475
- tmpPtr[pixelIndex++] = interpolatedPtr[_i3];
476
- } // set "was in" to "is in" if first pixel
477
-
478
-
428
+ // set "was in" to "is in" if first pixel
479
429
  wasInBounds = idX > idXmin ? wasInBounds : isInBounds;
480
- } // write a segment to the output
481
-
482
-
483
- var endIdX = idX - 1 - (isInBounds !== wasInBounds);
484
- var numpixels = endIdX - startIdX + 1;
485
- var _n = 0;
430
+ }
486
431
 
432
+ // write a segment to the output
433
+ const endIdX = idX - 1 - (isInBounds !== wasInBounds);
434
+ const numpixels = endIdX - startIdX + 1;
435
+ let n = 0;
487
436
  if (wasInBounds) {
488
-
489
437
  if (rescaleScalars) {
490
438
  publicAPI.rescaleScalars(floatPtr, inComponents, idXmax - idXmin + 1, model.scalarShift, model.scalarScale);
491
439
  }
492
-
493
440
  {
494
- _n = convertpixels(outTmp, floatPtr.subarray(startIdX * inComponents), outComponents, numpixels);
441
+ n = convertpixels(outTmp, floatPtr.subarray(startIdX * inComponents), outComponents, numpixels);
495
442
  }
496
443
  } else {
497
- _n = setpixels(outTmp, background, outComponents, numpixels);
444
+ n = setpixels(outTmp, background, outComponents, numpixels);
498
445
  }
499
-
500
- for (var _i4 = 0; _i4 < _n; ++_i4) {
501
- outPtr0[outPtrIndex++] = outTmp[_i4];
446
+ for (let i = 0; i < n; ++i) {
447
+ outPtr0[outPtrIndex++] = outTmp[i];
502
448
  }
503
-
504
449
  startIdX += numpixels;
505
450
  wasInBounds = isInBounds;
506
451
  }
507
452
  } else {
508
453
  // optimize for nearest-neighbor interpolation
509
- var inPtrTmp0 = inPtr;
510
- var outPtrTmp = outPtr;
511
- var inIncX = inInc[0] * inputScalarSize;
512
- var inIncY = inInc[1] * inputScalarSize;
513
- var inIncZ = inInc[2] * inputScalarSize;
514
- var inExtX = inExt[1] - inExt[0] + 1;
515
- var inExtY = inExt[3] - inExt[2] + 1;
516
- var inExtZ = inExt[5] - inExt[4] + 1;
517
- var _startIdX = idXmin;
518
-
519
- var _endIdX = idXmin - 1;
520
-
521
- var _isInBounds = false;
522
- var bytesPerPixel = inputScalarSize * inComponents;
523
-
524
- for (var iidX = idXmin; iidX <= idXmax; iidX++) {
525
- var _inPoint = [inPoint1[0] + iidX * xAxis[0], inPoint1[1] + iidX * xAxis[1], inPoint1[2] + iidX * xAxis[2]];
526
- var inIdX = vtkInterpolationMathRound(_inPoint[0]) - inExt[0];
527
- var inIdY = vtkInterpolationMathRound(_inPoint[1]) - inExt[2];
528
- var inIdZ = vtkInterpolationMathRound(_inPoint[2]) - inExt[4];
529
-
454
+ const inPtrTmp0 = inPtr;
455
+ const outPtrTmp = outPtr;
456
+ const inIncX = inInc[0] * inputScalarSize;
457
+ const inIncY = inInc[1] * inputScalarSize;
458
+ const inIncZ = inInc[2] * inputScalarSize;
459
+ const inExtX = inExt[1] - inExt[0] + 1;
460
+ const inExtY = inExt[3] - inExt[2] + 1;
461
+ const inExtZ = inExt[5] - inExt[4] + 1;
462
+ let startIdX = idXmin;
463
+ let endIdX = idXmin - 1;
464
+ let isInBounds = false;
465
+ const bytesPerPixel = inputScalarSize * inComponents;
466
+ for (let iidX = idXmin; iidX <= idXmax; iidX++) {
467
+ const inPoint = [inPoint1[0] + iidX * xAxis[0], inPoint1[1] + iidX * xAxis[1], inPoint1[2] + iidX * xAxis[2]];
468
+ const inIdX = vtkInterpolationMathRound(inPoint[0]) - inExt[0];
469
+ const inIdY = vtkInterpolationMathRound(inPoint[1]) - inExt[2];
470
+ const inIdZ = vtkInterpolationMathRound(inPoint[2]) - inExt[4];
530
471
  if (inIdX >= 0 && inIdX < inExtX && inIdY >= 0 && inIdY < inExtY && inIdZ >= 0 && inIdZ < inExtZ) {
531
- if (!_isInBounds) {
472
+ if (!isInBounds) {
532
473
  // clear leading out-of-bounds pixels
533
- _startIdX = iidX;
534
- _isInBounds = true;
535
-
536
- var _n3 = setpixels(outTmp, background, outComponents, _startIdX - idXmin);
537
-
538
- for (var _i5 = 0; _i5 < _n3; ++_i5) {
539
- outPtr0[outPtrIndex++] = outTmp[_i5];
474
+ startIdX = iidX;
475
+ isInBounds = true;
476
+ const n = setpixels(outTmp, background, outComponents, startIdX - idXmin);
477
+ for (let i = 0; i < n; ++i) {
478
+ outPtr0[outPtrIndex++] = outTmp[i];
540
479
  }
541
- } // set the final index that was within input bounds
542
-
480
+ }
481
+ // set the final index that was within input bounds
482
+ endIdX = iidX;
543
483
 
544
- _endIdX = iidX; // perform nearest-neighbor interpolation via pixel copy
484
+ // perform nearest-neighbor interpolation via pixel copy
485
+ let offset = inIdX * inIncX + inIdY * inIncY + inIdZ * inIncZ;
545
486
 
546
- var offset = inIdX * inIncX + inIdY * inIncY + inIdZ * inIncZ; // when memcpy is used with a constant size, the compiler will
487
+ // when memcpy is used with a constant size, the compiler will
547
488
  // optimize away the function call and use the minimum number
548
489
  // of instructions necessary to perform the copy
549
-
550
490
  switch (bytesPerPixel) {
551
491
  case 1:
552
492
  outPtr0[outPtrIndex++] = inPtrTmp0[offset];
553
493
  break;
554
-
555
494
  case 2:
556
495
  case 3:
557
496
  case 4:
558
497
  case 8:
559
498
  case 12:
560
499
  case 16:
561
- for (var _i6 = 0; _i6 < bytesPerPixel; ++_i6) {
562
- outPtr0[outPtrIndex++] = inPtrTmp0[offset + _i6];
500
+ for (let i = 0; i < bytesPerPixel; ++i) {
501
+ outPtr0[outPtrIndex++] = inPtrTmp0[offset + i];
563
502
  }
564
-
565
503
  break;
566
-
567
504
  default:
568
505
  {
569
506
  // TODO: check bytes
570
- var oc = 0;
571
-
507
+ let oc = 0;
572
508
  do {
573
509
  outPtr0[outPtrIndex++] = inPtrTmp0[offset++];
574
510
  } while (++oc !== bytesPerPixel);
575
-
576
511
  break;
577
512
  }
578
513
  }
579
- } else if (_isInBounds) {
514
+ } else if (isInBounds) {
580
515
  // leaving input bounds
581
516
  break;
582
517
  }
583
- } // clear trailing out-of-bounds pixels
584
-
518
+ }
585
519
 
520
+ // clear trailing out-of-bounds pixels
586
521
  outPtr = outPtrTmp;
587
-
588
- var _n2 = setpixels(outTmp, background, outComponents, idXmax - _endIdX);
589
-
590
- for (var _i7 = 0; _i7 < _n2; ++_i7) {
591
- outPtr0[outPtrIndex++] = outTmp[_i7];
522
+ const n = setpixels(outTmp, background, outComponents, idXmax - endIdX);
523
+ for (let i = 0; i < n; ++i) {
524
+ outPtr0[outPtrIndex++] = outTmp[i];
592
525
  }
593
526
  }
594
527
  }
@@ -607,27 +540,22 @@ function vtkImageReslice(publicAPI, model) {
607
540
  * @param {vtkPolyData} output
608
541
  * @returns
609
542
  */
610
-
611
-
612
- publicAPI.getIndexMatrix = function (input, output) {
543
+ publicAPI.getIndexMatrix = (input, output) => {
613
544
  // first verify that we have to update the matrix
614
545
  if (indexMatrix === null) {
615
546
  indexMatrix = mat4.identity(new Float64Array(16));
616
547
  }
617
-
618
- var inOrigin = input.getOrigin();
619
- var inSpacing = input.getSpacing();
620
- var inDirection = input.getDirection();
621
- var outOrigin = output.getOrigin();
622
- var outSpacing = output.getSpacing();
623
- var transform = mat4.identity(new Float64Array(16));
624
- var inMatrix = mat4.identity(new Float64Array(16));
625
- var outMatrix = mat4.identity(new Float64Array(16));
626
-
548
+ const inOrigin = input.getOrigin();
549
+ const inSpacing = input.getSpacing();
550
+ const inDirection = input.getDirection();
551
+ const outOrigin = output.getOrigin();
552
+ const outSpacing = output.getSpacing();
553
+ const transform = mat4.identity(new Float64Array(16));
554
+ const inMatrix = mat4.identity(new Float64Array(16));
555
+ const outMatrix = mat4.identity(new Float64Array(16));
627
556
  if (model.resliceAxes) {
628
557
  mat4.copy(transform, model.resliceAxes);
629
558
  }
630
-
631
559
  if (model.resliceTransform) {
632
560
  if (model.resliceTransform.isA('vtkHomogeneousTransform')) {
633
561
  // transform->PostMultiply();
@@ -639,151 +567,127 @@ function vtkImageReslice(publicAPI, model) {
639
567
  vtkWarningMacro('Non homogeneous transform have not yet been ported');
640
568
  }
641
569
  }
642
-
643
570
  if (!vtkMath.isIdentity3x3(inDirection)) {
644
- var imageTransform = vtkMatrixBuilder.buildFromRadian().translate(inOrigin[0], inOrigin[1], inOrigin[2]).multiply3x3(inDirection).translate(-inOrigin[0], -inOrigin[1], -inOrigin[2]);
571
+ const imageTransform = vtkMatrixBuilder.buildFromRadian().translate(inOrigin[0], inOrigin[1], inOrigin[2]).multiply3x3(inDirection).translate(-inOrigin[0], -inOrigin[1], -inOrigin[2]);
645
572
  mat4.multiply(transform, imageTransform.getMatrix(), transform);
646
- } // check to see if we have an identity matrix
573
+ }
647
574
 
575
+ // check to see if we have an identity matrix
576
+ let isIdentity = vtkMath.isIdentity(transform);
648
577
 
649
- var isIdentity = vtkMath.isIdentity(transform); // the outMatrix takes OutputData indices to OutputData coordinates,
578
+ // the outMatrix takes OutputData indices to OutputData coordinates,
650
579
  // the inMatrix takes InputData coordinates to InputData indices
651
-
652
- for (var i = 0; i < 3; i++) {
580
+ for (let i = 0; i < 3; i++) {
653
581
  if ((inSpacing[i] !== outSpacing[i] || inOrigin[i] !== outOrigin[i]) || optimizedTransform != null ) {
654
582
  isIdentity = false;
655
583
  }
656
-
657
584
  inMatrix[4 * i + i] = 1.0 / inSpacing[i];
658
585
  inMatrix[4 * 3 + i] = -inOrigin[i] / inSpacing[i];
659
586
  outMatrix[4 * i + i] = outSpacing[i];
660
587
  outMatrix[4 * 3 + i] = outOrigin[i];
661
588
  }
662
-
663
589
  if (!isIdentity) {
664
590
  // transform.PreMultiply();
665
591
  // transform.Concatenate(outMatrix);
666
- mat4.multiply(transform, transform, outMatrix); // the optimizedTransform requires data coords, not
667
- // index coords, as its input
592
+ mat4.multiply(transform, transform, outMatrix);
668
593
 
594
+ // the optimizedTransform requires data coords, not
595
+ // index coords, as its input
669
596
  {
670
597
  // transform->PostMultiply();
671
598
  // transform->Concatenate(inMatrix);
672
599
  mat4.multiply(transform, inMatrix, transform);
673
600
  }
674
601
  }
675
-
676
602
  mat4.copy(indexMatrix, transform);
677
603
  return indexMatrix;
678
604
  };
679
-
680
- publicAPI.getAutoCroppedOutputBounds = function (input) {
681
- var inOrigin = input.getOrigin();
682
- var inSpacing = input.getSpacing();
683
- var inDirection = input.getDirection();
684
- var dims = input.getDimensions();
685
- var inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];
686
- var matrix = new Float64Array(16);
687
-
605
+ publicAPI.getAutoCroppedOutputBounds = input => {
606
+ const inOrigin = input.getOrigin();
607
+ const inSpacing = input.getSpacing();
608
+ const inDirection = input.getDirection();
609
+ const dims = input.getDimensions();
610
+ const inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];
611
+ const matrix = new Float64Array(16);
688
612
  if (model.resliceAxes) {
689
613
  mat4.invert(matrix, model.resliceAxes);
690
614
  } else {
691
615
  mat4.identity(matrix);
692
616
  }
693
-
694
- var transform = null;
695
-
617
+ let transform = null;
696
618
  if (model.resliceTransform) {
697
619
  transform = model.resliceTransform.getInverse();
698
620
  }
699
-
700
- var imageTransform = null;
701
-
621
+ let imageTransform = null;
702
622
  if (!vtkMath.isIdentity3x3(inDirection)) {
703
623
  imageTransform = vtkMatrixBuilder.buildFromRadian().translate(inOrigin[0], inOrigin[1], inOrigin[2]).multiply3x3(inDirection).translate(-inOrigin[0], -inOrigin[1], -inOrigin[2]).invert().getMatrix();
704
624
  }
705
-
706
- var bounds = [Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE];
707
- var point = [0, 0, 0, 0];
708
-
709
- for (var i = 0; i < 8; ++i) {
625
+ const bounds = [Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE];
626
+ const point = [0, 0, 0, 0];
627
+ for (let i = 0; i < 8; ++i) {
710
628
  point[0] = inOrigin[0] + inWholeExt[i % 2] * inSpacing[0];
711
629
  point[1] = inOrigin[1] + inWholeExt[2 + Math.floor(i / 2) % 2] * inSpacing[1];
712
630
  point[2] = inOrigin[2] + inWholeExt[4 + Math.floor(i / 4) % 2] * inSpacing[2];
713
631
  point[3] = 1.0;
714
-
715
632
  if (imageTransform) {
716
633
  vec4.transformMat4(point, point, imageTransform);
717
634
  }
718
-
719
635
  if (model.resliceTransform) {
720
636
  transform.transformPoint(point, point);
721
637
  }
722
-
723
638
  vec4.transformMat4(point, point, matrix);
724
- var f = 1.0 / point[3];
639
+ const f = 1.0 / point[3];
725
640
  point[0] *= f;
726
641
  point[1] *= f;
727
642
  point[2] *= f;
728
-
729
- for (var j = 0; j < 3; ++j) {
643
+ for (let j = 0; j < 3; ++j) {
730
644
  if (point[j] > bounds[2 * j + 1]) {
731
645
  bounds[2 * j + 1] = point[j];
732
646
  }
733
-
734
647
  if (point[j] < bounds[2 * j]) {
735
648
  bounds[2 * j] = point[j];
736
649
  }
737
650
  }
738
651
  }
739
-
740
652
  return bounds;
741
653
  };
742
-
743
- publicAPI.getDataTypeMinMax = function (dataType) {
654
+ publicAPI.getDataTypeMinMax = dataType => {
744
655
  switch (dataType) {
745
656
  case 'Int8Array':
746
657
  return {
747
658
  min: -128,
748
659
  max: 127
749
660
  };
750
-
751
661
  case 'Int16Array':
752
662
  return {
753
663
  min: -32768,
754
664
  max: 32767
755
665
  };
756
-
757
666
  case 'Uint16Array':
758
667
  return {
759
668
  min: 0,
760
669
  max: 65535
761
670
  };
762
-
763
671
  case 'Int32Array':
764
672
  return {
765
673
  min: -2147483648,
766
674
  max: 2147483647
767
675
  };
768
-
769
676
  case 'Uint32Array':
770
677
  return {
771
678
  min: 0,
772
679
  max: 4294967295
773
680
  };
774
-
775
681
  case 'Float32Array':
776
682
  return {
777
683
  min: -1.2e38,
778
684
  max: 1.2e38
779
685
  };
780
-
781
686
  case 'Float64Array':
782
687
  return {
783
688
  min: -1.2e38,
784
689
  max: 1.2e38
785
690
  };
786
-
787
691
  case 'Uint8Array':
788
692
  case 'Uint8ClampedArray':
789
693
  default:
@@ -793,114 +697,83 @@ function vtkImageReslice(publicAPI, model) {
793
697
  };
794
698
  }
795
699
  };
796
-
797
- publicAPI.clamp = function (outPtr, inPtr, numscalars, n, min, max) {
798
- var count = n * numscalars;
799
-
800
- for (var i = 0; i < count; ++i) {
700
+ publicAPI.clamp = (outPtr, inPtr, numscalars, n, min, max) => {
701
+ const count = n * numscalars;
702
+ for (let i = 0; i < count; ++i) {
801
703
  outPtr[i] = vtkInterpolationMathClamp(inPtr[i], min, max);
802
704
  }
803
-
804
705
  return count;
805
706
  };
806
-
807
- publicAPI.convert = function (outPtr, inPtr, numscalars, n) {
808
- var count = n * numscalars;
809
-
810
- for (var i = 0; i < count; ++i) {
707
+ publicAPI.convert = (outPtr, inPtr, numscalars, n) => {
708
+ const count = n * numscalars;
709
+ for (let i = 0; i < count; ++i) {
811
710
  outPtr[i] = Math.round(inPtr[i]);
812
711
  }
813
-
814
712
  return count;
815
713
  };
816
-
817
- publicAPI.getConversionFunc = function (inputType, dataType, scalarShift, scalarScale, forceClamping) {
818
- var useClamping = forceClamping;
819
-
714
+ publicAPI.getConversionFunc = (inputType, dataType, scalarShift, scalarScale, forceClamping) => {
715
+ let useClamping = forceClamping;
820
716
  if (dataType !== VtkDataTypes.FLOAT && dataType !== VtkDataTypes.DOUBLE && !forceClamping) {
821
- var inMinMax = publicAPI.getDataTypeMinMax(inputType);
822
- var checkMin = (inMinMax.min + scalarShift) * scalarScale;
823
- var checkMax = (inMinMax.max + scalarShift) * scalarScale;
824
- var outMinMax = publicAPI.getDataTypeMinMax(dataType);
825
- var outputMin = outMinMax.min;
826
- var outputMax = outMinMax.max;
827
-
717
+ const inMinMax = publicAPI.getDataTypeMinMax(inputType);
718
+ let checkMin = (inMinMax.min + scalarShift) * scalarScale;
719
+ let checkMax = (inMinMax.max + scalarShift) * scalarScale;
720
+ const outMinMax = publicAPI.getDataTypeMinMax(dataType);
721
+ const outputMin = outMinMax.min;
722
+ const outputMax = outMinMax.max;
828
723
  if (checkMin > checkMax) {
829
- var tmp = checkMax;
724
+ const tmp = checkMax;
830
725
  checkMax = checkMin;
831
726
  checkMin = tmp;
832
727
  }
833
-
834
728
  useClamping = checkMin < outputMin || checkMax > outputMax;
835
729
  }
836
-
837
730
  if (useClamping && dataType !== VtkDataTypes.FLOAT && dataType !== VtkDataTypes.DOUBLE) {
838
- var minMax = publicAPI.getDataTypeMinMax(dataType);
839
-
840
- var clamp = function clamp(outPtr, inPtr, numscalars, n) {
841
- return publicAPI.clamp(outPtr, inPtr, numscalars, n, minMax.min, minMax.max);
842
- };
843
-
731
+ const minMax = publicAPI.getDataTypeMinMax(dataType);
732
+ const clamp = (outPtr, inPtr, numscalars, n) => publicAPI.clamp(outPtr, inPtr, numscalars, n, minMax.min, minMax.max);
844
733
  return clamp;
845
734
  }
846
-
847
735
  return publicAPI.convert;
848
736
  };
849
-
850
- publicAPI.set = function (outPtr, inPtr, numscalars, n) {
851
- var count = numscalars * n;
852
-
853
- for (var i = 0; i < n; ++i) {
737
+ publicAPI.set = (outPtr, inPtr, numscalars, n) => {
738
+ const count = numscalars * n;
739
+ for (let i = 0; i < n; ++i) {
854
740
  outPtr[i] = inPtr[i];
855
741
  }
856
-
857
742
  return count;
858
743
  };
859
-
860
- publicAPI.set1 = function (outPtr, inPtr, numscalars, n) {
744
+ publicAPI.set1 = (outPtr, inPtr, numscalars, n) => {
861
745
  outPtr.fill(inPtr[0], 0, n);
862
746
  return n;
863
747
  };
864
-
865
- publicAPI.getSetPixelsFunc = function (dataType, dataSize, numscalars, dataPtr) {
866
- return numscalars === 1 ? publicAPI.set1 : publicAPI.set;
867
- };
868
-
869
- publicAPI.getCompositeFunc = function (slabMode, slabTrapezoidIntegration) {
870
- var composite = null; // eslint-disable-next-line default-case
871
-
748
+ publicAPI.getSetPixelsFunc = (dataType, dataSize, numscalars, dataPtr) => numscalars === 1 ? publicAPI.set1 : publicAPI.set;
749
+ publicAPI.getCompositeFunc = (slabMode, slabTrapezoidIntegration) => {
750
+ let composite = null;
751
+ // eslint-disable-next-line default-case
872
752
  switch (slabMode) {
873
753
  case SlabMode.MIN:
874
754
  composite = getImageResliceCompositeMinValue;
875
755
  break;
876
-
877
756
  case SlabMode.MAX:
878
757
  composite = getImageResliceCompositeMaxValue;
879
758
  break;
880
-
881
759
  case SlabMode.MEAN:
882
760
  if (slabTrapezoidIntegration) {
883
761
  composite = getImageResliceCompositeMeanTrap;
884
762
  } else {
885
763
  composite = getImageResliceCompositeMeanValue;
886
764
  }
887
-
888
765
  break;
889
-
890
766
  case SlabMode.SUM:
891
767
  if (slabTrapezoidIntegration) {
892
768
  composite = getImageResliceCompositeSumTrap;
893
769
  } else {
894
770
  composite = getImageResliceCompositeSumValue;
895
771
  }
896
-
897
772
  break;
898
773
  }
899
-
900
774
  return composite;
901
775
  };
902
-
903
- publicAPI.applyTransform = function (newTrans, inPoint, inOrigin, inInvSpacing) {
776
+ publicAPI.applyTransform = (newTrans, inPoint, inOrigin, inInvSpacing) => {
904
777
  inPoint[3] = 1;
905
778
  vec4.transformMat4(inPoint, inPoint, newTrans);
906
779
  inPoint[0] -= inOrigin[0];
@@ -910,99 +783,80 @@ function vtkImageReslice(publicAPI, model) {
910
783
  inPoint[1] *= inInvSpacing[1];
911
784
  inPoint[2] *= inInvSpacing[2];
912
785
  };
913
-
914
- publicAPI.rescaleScalars = function (floatData, components, n, scalarShift, scalarScale) {
915
- var m = n * components;
916
-
917
- for (var i = 0; i < m; ++i) {
786
+ publicAPI.rescaleScalars = (floatData, components, n, scalarShift, scalarScale) => {
787
+ const m = n * components;
788
+ for (let i = 0; i < m; ++i) {
918
789
  floatData[i] = (floatData[i] + scalarShift) * scalarScale;
919
790
  }
920
791
  };
921
-
922
- publicAPI.isPermutationMatrix = function (matrix) {
923
- for (var i = 0; i < 3; i++) {
792
+ publicAPI.isPermutationMatrix = matrix => {
793
+ for (let i = 0; i < 3; i++) {
924
794
  if (matrix[4 * i + 3] !== 0) {
925
795
  return false;
926
796
  }
927
797
  }
928
-
929
798
  if (matrix[4 * 3 + 3] !== 1) {
930
799
  return false;
931
800
  }
932
-
933
- for (var j = 0; j < 3; j++) {
934
- var k = 0;
935
-
936
- for (var _i8 = 0; _i8 < 3; _i8++) {
937
- if (matrix[4 * j + _i8] !== 0) {
801
+ for (let j = 0; j < 3; j++) {
802
+ let k = 0;
803
+ for (let i = 0; i < 3; i++) {
804
+ if (matrix[4 * j + i] !== 0) {
938
805
  k++;
939
806
  }
940
807
  }
941
-
942
808
  if (k !== 1) {
943
809
  return 0;
944
810
  }
945
811
  }
946
-
947
812
  return 1;
948
- }; // TODO: to move in vtkMath and add tolerance
949
-
813
+ };
950
814
 
951
- publicAPI.isIdentityMatrix = function (matrix) {
952
- for (var i = 0; i < 4; ++i) {
953
- for (var j = 0; j < 4; ++j) {
815
+ // TODO: to move in vtkMath and add tolerance
816
+ publicAPI.isIdentityMatrix = matrix => {
817
+ for (let i = 0; i < 4; ++i) {
818
+ for (let j = 0; j < 4; ++j) {
954
819
  if ((i === j ? 1.0 : 0.0) !== matrix[4 * j + i]) {
955
820
  return false;
956
821
  }
957
822
  }
958
823
  }
959
-
960
824
  return true;
961
825
  };
962
-
963
- publicAPI.isPerspectiveMatrix = function (matrix) {
964
- return matrix[4 * 0 + 3] !== 0 || matrix[4 * 1 + 3] !== 0 || matrix[4 * 2 + 3] !== 0 || matrix[4 * 3 + 3] !== 1;
965
- };
966
-
967
- publicAPI.canUseNearestNeighbor = function (matrix, outExt) {
826
+ publicAPI.isPerspectiveMatrix = matrix => matrix[4 * 0 + 3] !== 0 || matrix[4 * 1 + 3] !== 0 || matrix[4 * 2 + 3] !== 0 || matrix[4 * 3 + 3] !== 1;
827
+ publicAPI.canUseNearestNeighbor = (matrix, outExt) => {
968
828
  // loop through dimensions
969
- for (var i = 0; i < 3; i++) {
970
- var j = void 0;
971
-
829
+ for (let i = 0; i < 3; i++) {
830
+ let j;
972
831
  for (j = 0; j < 3; j++) {
973
832
  if (matrix[4 * j + i] !== 0) {
974
833
  break;
975
834
  }
976
835
  }
977
-
978
836
  if (j >= 3) {
979
837
  return 0;
980
838
  }
981
-
982
- var x = matrix[4 * j + i];
983
- var y = matrix[4 * 3 + i];
984
-
839
+ let x = matrix[4 * j + i];
840
+ let y = matrix[4 * 3 + i];
985
841
  if (outExt[2 * j] === outExt[2 * j + 1]) {
986
842
  y += x * outExt[2 * i];
987
843
  x = 0;
988
844
  }
989
-
990
- var fx = vtkInterpolationMathFloor(x).error;
991
- var fy = vtkInterpolationMathFloor(y).error;
992
-
845
+ const fx = vtkInterpolationMathFloor(x).error;
846
+ const fy = vtkInterpolationMathFloor(y).error;
993
847
  if (fx !== 0 || fy !== 0) {
994
848
  return 0;
995
849
  }
996
850
  }
997
-
998
851
  return 1;
999
852
  };
1000
- } // ----------------------------------------------------------------------------
853
+ }
854
+
855
+ // ----------------------------------------------------------------------------
1001
856
  // Object factory
1002
857
  // ----------------------------------------------------------------------------
1003
858
 
1004
-
1005
- var DEFAULT_VALUES = {
859
+ const DEFAULT_VALUES = {
1006
860
  transformInputSampling: true,
1007
861
  autoCropOutput: false,
1008
862
  outputDimensionality: 3,
@@ -1037,32 +891,41 @@ var DEFAULT_VALUES = {
1037
891
  // resliceTransform: null,
1038
892
  interpolator: vtkImageInterpolator.newInstance(),
1039
893
  usePermuteExecute: false // no supported yet
894
+ };
1040
895
 
1041
- }; // ----------------------------------------------------------------------------
896
+ // ----------------------------------------------------------------------------
1042
897
 
1043
898
  function extend(publicAPI, model) {
1044
- var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1045
- Object.assign(model, DEFAULT_VALUES, initialValues); // Make this a VTK object
899
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
900
+ Object.assign(model, DEFAULT_VALUES, initialValues);
1046
901
 
1047
- macro.obj(publicAPI, model); // Also make it an algorithm with one input and one output
902
+ // Make this a VTK object
903
+ macro.obj(publicAPI, model);
1048
904
 
905
+ // Also make it an algorithm with one input and one output
1049
906
  macro.algo(publicAPI, model, 1, 1);
1050
907
  macro.setGet(publicAPI, model, ['outputDimensionality', 'outputScalarType', 'scalarShift', 'scalarScale', 'transformInputSampling', 'autoCropOutput', 'wrap', 'mirror', 'border', 'interpolationMode', 'resliceTransform', 'slabMode', 'slabTrapezoidIntegration', 'slabNumberOfSlices', 'slabSliceSpacingFraction']);
1051
908
  macro.setGetArray(publicAPI, model, ['outputOrigin', 'outputSpacing'], 3);
1052
909
  macro.setGetArray(publicAPI, model, ['outputExtent'], 6);
1053
910
  macro.setGetArray(publicAPI, model, ['outputDirection'], 9);
1054
911
  macro.setGetArray(publicAPI, model, ['backgroundColor'], 4);
1055
- macro.get(publicAPI, model, ['resliceAxes']); // Object specific methods
912
+ macro.get(publicAPI, model, ['resliceAxes']);
1056
913
 
914
+ // Object specific methods
1057
915
  macro.algo(publicAPI, model, 1, 1);
1058
916
  vtkImageReslice(publicAPI, model);
1059
- } // ----------------------------------------------------------------------------
917
+ }
918
+
919
+ // ----------------------------------------------------------------------------
920
+
921
+ const newInstance = macro.newInstance(extend, 'vtkImageReslice');
1060
922
 
1061
- var newInstance = macro.newInstance(extend, 'vtkImageReslice'); // ----------------------------------------------------------------------------
923
+ // ----------------------------------------------------------------------------
1062
924
 
1063
- var vtkImageReslice$1 = _objectSpread({
1064
- newInstance: newInstance,
1065
- extend: extend
1066
- }, Constants);
925
+ var vtkImageReslice$1 = {
926
+ newInstance,
927
+ extend,
928
+ ...Constants
929
+ };
1067
930
 
1068
931
  export { vtkImageReslice$1 as default, extend, newInstance };