@kitware/vtk.js 28.10.2 → 28.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Core/Base64.js +53 -82
- package/Common/Core/CellArray.js +52 -60
- package/Common/Core/ClassHierarchy.js +8 -36
- package/Common/Core/DataArray/Constants.js +6 -6
- package/Common/Core/DataArray.js +193 -277
- package/Common/Core/Endian.js +14 -17
- package/Common/Core/HalfFloat.js +17 -34
- package/Common/Core/ImageHelper.js +17 -25
- package/Common/Core/LookupTable.js +131 -144
- package/Common/Core/Math/Constants.js +8 -8
- package/Common/Core/Math/index.js +754 -942
- package/Common/Core/Math.js +2 -4
- package/Common/Core/MatrixBuilder.js +99 -151
- package/Common/Core/Points.js +43 -43
- package/Common/Core/PriorityQueue.js +30 -28
- package/Common/Core/ProgressHandler.js +31 -32
- package/Common/Core/ScalarsToColors/Constants.js +4 -4
- package/Common/Core/ScalarsToColors.js +196 -253
- package/Common/Core/StringArray.js +48 -73
- package/Common/Core/URLExtract.js +10 -29
- package/Common/Core/VariantArray.js +48 -73
- package/Common/Core.js +11 -11
- package/Common/DataModel/AbstractPointLocator.js +19 -17
- package/Common/DataModel/BoundingBox.js +322 -490
- package/Common/DataModel/Box.js +46 -63
- package/Common/DataModel/CardinalSpline1D.js +92 -102
- package/Common/DataModel/Cell.js +41 -61
- package/Common/DataModel/CellLinks.js +91 -127
- package/Common/DataModel/CellTypes/Constants.js +7 -6
- package/Common/DataModel/CellTypes.js +55 -74
- package/Common/DataModel/Collection.js +45 -61
- package/Common/DataModel/Cone.js +28 -20
- package/Common/DataModel/Cylinder.js +41 -35
- package/Common/DataModel/DataSet/Constants.js +11 -5
- package/Common/DataModel/DataSet.js +37 -25
- package/Common/DataModel/DataSetAttributes/Constants.js +18 -18
- package/Common/DataModel/DataSetAttributes/FieldData.js +103 -194
- package/Common/DataModel/DataSetAttributes.js +96 -138
- package/Common/DataModel/EdgeLocator.js +45 -70
- package/Common/DataModel/ITKHelper.js +67 -137
- package/Common/DataModel/ImageData.js +115 -172
- package/Common/DataModel/ImplicitBoolean/Constants.js +2 -2
- package/Common/DataModel/ImplicitBoolean.js +66 -96
- package/Common/DataModel/IncrementalOctreeNode.js +201 -231
- package/Common/DataModel/IncrementalOctreePointLocator.js +160 -198
- package/Common/DataModel/KochanekSpline1D.js +78 -81
- package/Common/DataModel/Line/Constants.js +2 -2
- package/Common/DataModel/Line.js +82 -105
- package/Common/DataModel/Locator.js +17 -10
- package/Common/DataModel/Molecule.js +26 -17
- package/Common/DataModel/PiecewiseFunction.js +218 -239
- package/Common/DataModel/Plane.js +90 -113
- package/Common/DataModel/PointSet.js +30 -26
- package/Common/DataModel/PolyData/Constants.js +2 -2
- package/Common/DataModel/PolyData.js +95 -120
- package/Common/DataModel/PolyLine.js +44 -61
- package/Common/DataModel/Polygon/Constants.js +4 -4
- package/Common/DataModel/Polygon.js +128 -169
- package/Common/DataModel/Quad/Constants.js +2 -2
- package/Common/DataModel/Quad.js +61 -100
- package/Common/DataModel/SelectionNode/Constants.js +5 -4
- package/Common/DataModel/SelectionNode.js +25 -21
- package/Common/DataModel/Sphere.js +40 -35
- package/Common/DataModel/Spline1D/Constants.js +3 -2
- package/Common/DataModel/Spline1D.js +34 -18
- package/Common/DataModel/Spline3D/Constants.js +2 -2
- package/Common/DataModel/Spline3D.js +46 -41
- package/Common/DataModel/StructuredData/Constants.js +2 -2
- package/Common/DataModel/StructuredData.js +9 -20
- package/Common/DataModel/Triangle.js +207 -250
- package/Common/DataModel.js +19 -19
- package/Common/System/MobileVR.js +56 -61
- package/Common/System/TimerLog.js +1 -1
- package/Common/System.js +2 -2
- package/Common/Transform/LandmarkTransform/Constants.js +2 -2
- package/Common/Transform/LandmarkTransform.js +133 -117
- package/Common/Transform/Transform.js +42 -57
- package/Common/Transform.js +2 -2
- package/Common/index.js +4 -4
- package/Filters/Core/Cutter.js +134 -146
- package/Filters/Core/PolyDataNormals.js +44 -50
- package/Filters/Core.js +2 -2
- package/Filters/Cornerstone/ImageDataToCornerstoneImage.js +45 -33
- package/Filters/Cornerstone.js +1 -1
- package/Filters/General/AppendPolyData.js +84 -100
- package/Filters/General/Calculator.js +95 -163
- package/Filters/General/ClipClosedSurface/Constants.js +2 -2
- package/Filters/General/ClipClosedSurface.js +341 -416
- package/Filters/General/ClosedPolyLineToSurfaceFilter.js +141 -156
- package/Filters/General/ContourTriangulator/Constants.js +2 -2
- package/Filters/General/ContourTriangulator/helper.js +684 -812
- package/Filters/General/ContourTriangulator.js +92 -89
- package/Filters/General/ImageCropFilter.js +77 -78
- package/Filters/General/ImageDataOutlineFilter.js +42 -36
- package/Filters/General/ImageMarchingCubes/caseTable.js +9 -521
- package/Filters/General/ImageMarchingCubes.js +99 -112
- package/Filters/General/ImageMarchingSquares/caseTable.js +9 -41
- package/Filters/General/ImageMarchingSquares.js +93 -118
- package/Filters/General/ImageOutlineFilter.js +53 -54
- package/Filters/General/ImageSliceFilter.js +39 -30
- package/Filters/General/ImageStreamline.js +107 -124
- package/Filters/General/LineFilter.js +26 -15
- package/Filters/General/MoleculeToRepresentation.js +136 -149
- package/Filters/General/OBBTree/OBBNode.js +36 -34
- package/Filters/General/OBBTree/helper.js +19 -24
- package/Filters/General/OBBTree.js +396 -488
- package/Filters/General/OutlineFilter.js +52 -34
- package/Filters/General/PaintFilter/PaintFilter.worker.js +93 -130
- package/Filters/General/PaintFilter.js +150 -162
- package/Filters/General/ScalarToRGBA.js +38 -33
- package/Filters/General/TriangleFilter.js +65 -62
- package/Filters/General/TubeFilter/Constants.js +4 -4
- package/Filters/General/TubeFilter.js +376 -496
- package/Filters/General/WarpScalar.js +58 -60
- package/Filters/General/WindowedSincPolyDataFilter.js +258 -330
- package/Filters/General.js +21 -21
- package/Filters/Sources/Arrow2DSource/Constants.js +2 -2
- package/Filters/Sources/Arrow2DSource.js +56 -56
- package/Filters/Sources/ArrowSource.js +39 -29
- package/Filters/Sources/CircleSource.js +43 -43
- package/Filters/Sources/ConcentricCylinderSource.js +151 -174
- package/Filters/Sources/ConeSource.js +51 -42
- package/Filters/Sources/CubeSource.js +75 -96
- package/Filters/Sources/Cursor3D.js +94 -109
- package/Filters/Sources/CylinderSource.js +90 -90
- package/Filters/Sources/ImageGridSource.js +43 -43
- package/Filters/Sources/LineSource.js +49 -39
- package/Filters/Sources/PlaneSource.js +97 -104
- package/Filters/Sources/PointSource.js +46 -37
- package/Filters/Sources/RTAnalyticSource.js +50 -48
- package/Filters/Sources/SLICSource.js +63 -73
- package/Filters/Sources/SphereSource.js +88 -78
- package/Filters/Sources/ViewFinderSource.js +26 -23
- package/Filters/Sources.js +14 -14
- package/Filters/Texture/TextureMapToPlane.js +95 -97
- package/Filters/Texture/TextureMapToSphere.js +46 -54
- package/Filters/Texture.js +2 -2
- package/Filters/index.js +5 -5
- package/IO/Core/BinaryHelper.js +12 -18
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +43 -59
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +76 -113
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +62 -112
- package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +76 -113
- package/IO/Core/DataAccessHelper.js +6 -6
- package/IO/Core/HttpDataSetReader.js +136 -139
- package/IO/Core/HttpDataSetSeriesReader.js +64 -75
- package/IO/Core/HttpSceneLoader.js +130 -179
- package/IO/Core/ImageStream/DefaultProtocol.js +29 -43
- package/IO/Core/ImageStream/ViewStream.js +100 -103
- package/IO/Core/ImageStream.js +62 -54
- package/IO/Core/ResourceLoader.js +10 -9
- package/IO/Core/Serializer/ArraySerializer.js +40 -40
- package/IO/Core/Serializer/FieldDataSerializer.js +18 -28
- package/IO/Core/Serializer/ImageDataSerializer.js +22 -23
- package/IO/Core/Serializer/PolyDataSerializer.js +17 -21
- package/IO/Core/Serializer.js +6 -13
- package/IO/Core/WSLinkClient.js +90 -76
- package/IO/Core/ZipMultiDataSetReader.js +46 -44
- package/IO/Core/ZipMultiDataSetWriter.js +43 -34
- package/IO/Core.js +7 -7
- package/IO/Geometry/DracoReader.js +118 -121
- package/IO/Geometry/PLYReader.js +163 -223
- package/IO/Geometry/PLYWriter/Constants.js +5 -5
- package/IO/Geometry/PLYWriter.js +139 -154
- package/IO/Geometry/STLReader.js +123 -146
- package/IO/Geometry/STLWriter/Constants.js +2 -2
- package/IO/Geometry/STLWriter.js +83 -82
- package/IO/Geometry.js +5 -5
- package/IO/Legacy/LegacyAsciiParser.js +78 -139
- package/IO/Legacy/PolyDataReader.js +48 -36
- package/IO/Legacy.js +2 -2
- package/IO/Misc/ElevationReader.js +67 -60
- package/IO/Misc/HttpDataSetLODsLoader.js +41 -38
- package/IO/Misc/ITKImageReader.js +58 -45
- package/IO/Misc/ITKPolyDataReader.js +50 -38
- package/IO/Misc/JSONNucleoReader.js +49 -42
- package/IO/Misc/JSONReader.js +38 -33
- package/IO/Misc/MTLReader.js +74 -119
- package/IO/Misc/OBJReader.js +153 -206
- package/IO/Misc/PDBReader.js +70 -68
- package/IO/Misc/SkyboxReader.js +77 -82
- package/IO/Misc.js +9 -9
- package/IO/XML/XMLImageDataReader.js +36 -38
- package/IO/XML/XMLImageDataWriter.js +28 -21
- package/IO/XML/XMLPolyDataReader.js +49 -46
- package/IO/XML/XMLPolyDataWriter.js +43 -42
- package/IO/XML/XMLReader.js +262 -304
- package/IO/XML/XMLWriter/Constants.js +3 -3
- package/IO/XML/XMLWriter.js +70 -84
- package/IO/XML.js +6 -6
- package/IO/index.js +5 -5
- package/Imaging/Core/AbstractImageInterpolator/Constants.js +4 -4
- package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +30 -27
- package/Imaging/Core/AbstractImageInterpolator.js +74 -87
- package/Imaging/Core/ImageInterpolator.js +201 -252
- package/Imaging/Core/ImagePointDataIterator.js +96 -122
- package/Imaging/Core/ImageReslice/Constants.js +2 -2
- package/Imaging/Core/ImageReslice.js +327 -464
- package/Imaging/Core.js +4 -4
- package/Imaging/Hybrid/SampleFunction.js +58 -51
- package/Imaging/Hybrid.js +1 -1
- package/Imaging/index.js +2 -2
- package/Interaction/Animations/TimeStepBasedAnimationHandler.js +39 -54
- package/Interaction/Manipulators/CompositeCameraManipulator.js +22 -13
- package/Interaction/Manipulators/CompositeGestureManipulator.js +31 -43
- package/Interaction/Manipulators/CompositeKeyboardManipulator.js +15 -11
- package/Interaction/Manipulators/CompositeMouseManipulator.js +27 -33
- package/Interaction/Manipulators/CompositeVRManipulator.js +22 -15
- package/Interaction/Manipulators/GestureCameraManipulator.js +54 -36
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +95 -97
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +70 -89
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +67 -54
- package/Interaction/Manipulators/MouseCameraSliceManipulator.js +40 -38
- package/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator.js +83 -68
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +32 -28
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +47 -40
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +55 -43
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +56 -46
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +41 -46
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.js +29 -27
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +123 -146
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +144 -166
- package/Interaction/Manipulators/MouseRangeManipulator.js +127 -132
- package/Interaction/Manipulators/VRButtonPanManipulator.js +33 -23
- package/Interaction/Manipulators.js +21 -21
- package/Interaction/Misc/DeviceOrientationToCamera.js +25 -47
- package/Interaction/Misc.js +1 -1
- package/Interaction/Style/InteractorStyleImage.js +101 -121
- package/Interaction/Style/InteractorStyleMPRSlice.js +111 -128
- package/Interaction/Style/InteractorStyleManipulator/Presets.js +9 -17
- package/Interaction/Style/InteractorStyleManipulator.js +254 -329
- package/Interaction/Style/InteractorStyleRemoteMouse.js +195 -180
- package/Interaction/Style/InteractorStyleTrackballCamera.js +154 -157
- package/Interaction/Style/InteractorStyleUnicam.js +30 -38
- package/Interaction/Style.js +5 -5
- package/Interaction/UI/CornerAnnotation/CornerAnnotation.module.css.js +1 -1
- package/Interaction/UI/CornerAnnotation.js +65 -48
- package/Interaction/UI/FPSMonitor.js +104 -105
- package/Interaction/UI/Icons.js +1 -1
- package/Interaction/UI/Slider/Constants.js +2 -2
- package/Interaction/UI/Slider.js +78 -95
- package/Interaction/UI/VolumeController.js +104 -97
- package/Interaction/UI.js +5 -5
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +2 -2
- package/Interaction/Widgets/OrientationMarkerWidget.js +90 -135
- package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +381 -498
- package/Interaction/Widgets.js +2 -2
- package/Interaction/index.js +5 -5
- package/Proxy/Animation/AbstractAnimationProxy.js +22 -15
- package/Proxy/Animation/AnimationProxyManager.js +43 -51
- package/Proxy/Animation/TimeStepBasedAnimationHandlerProxy.js +26 -19
- package/Proxy/Core/AbstractRepresentationProxy.js +97 -151
- package/Proxy/Core/LookupTableProxy/Constants.js +4 -4
- package/Proxy/Core/LookupTableProxy.js +49 -52
- package/Proxy/Core/PiecewiseFunctionProxy/Constants.js +4 -4
- package/Proxy/Core/PiecewiseFunctionProxy.js +63 -72
- package/Proxy/Core/ProxyManager/core.js +83 -106
- package/Proxy/Core/ProxyManager/properties.js +53 -76
- package/Proxy/Core/ProxyManager/state.js +100 -110
- package/Proxy/Core/ProxyManager/view.js +45 -55
- package/Proxy/Core/ProxyManager.js +16 -8
- package/Proxy/Core/SourceProxy.js +41 -38
- package/Proxy/Core/View2DProxy.js +143 -199
- package/Proxy/Core/ViewProxy.js +223 -269
- package/Proxy/Core.js +7 -7
- package/Proxy/Representations/GeometryRepresentationProxy.js +34 -20
- package/Proxy/Representations/GlyphRepresentationProxy.js +42 -41
- package/Proxy/Representations/MoleculeRepresentationProxy.js +32 -22
- package/Proxy/Representations/ResliceRepresentationProxy.js +48 -32
- package/Proxy/Representations/SkyboxRepresentationProxy.js +30 -29
- package/Proxy/Representations/SliceRepresentationProxy.js +93 -112
- package/Proxy/Representations/SlicedGeometryRepresentationProxy.js +46 -42
- package/Proxy/Representations/VolumeRepresentationProxy.js +108 -133
- package/Proxy/Representations.js +7 -7
- package/Proxy/index.js +2 -2
- package/README.md +1 -1
- package/Rendering/Core/AbstractImageMapper/helper.js +44 -49
- package/Rendering/Core/AbstractImageMapper.js +18 -19
- package/Rendering/Core/AbstractMapper.js +39 -55
- package/Rendering/Core/AbstractMapper3D.js +26 -31
- package/Rendering/Core/AbstractPicker.js +25 -21
- package/Rendering/Core/Actor.js +71 -93
- package/Rendering/Core/Actor2D.js +64 -78
- package/Rendering/Core/AnnotatedCubeActor/Presets.js +5 -11
- package/Rendering/Core/AnnotatedCubeActor.js +94 -79
- package/Rendering/Core/AxesActor.js +65 -87
- package/Rendering/Core/Camera.js +246 -271
- package/Rendering/Core/CellPicker.js +125 -148
- package/Rendering/Core/ColorTransferFunction/ColorMaps.js +20 -21
- package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +20 -21
- package/Rendering/Core/ColorTransferFunction/Constants.js +4 -4
- package/Rendering/Core/ColorTransferFunction.js +460 -546
- package/Rendering/Core/Coordinate/Constants.js +2 -2
- package/Rendering/Core/Coordinate.js +119 -198
- package/Rendering/Core/CubeAxesActor.js +294 -320
- package/Rendering/Core/Follower.js +46 -45
- package/Rendering/Core/Glyph3DMapper/Constants.js +4 -4
- package/Rendering/Core/Glyph3DMapper.js +96 -148
- package/Rendering/Core/HardwareSelector.js +36 -69
- package/Rendering/Core/ImageArrayMapper.js +87 -126
- package/Rendering/Core/ImageCPRMapper.js +134 -209
- package/Rendering/Core/ImageMapper/Constants.js +2 -2
- package/Rendering/Core/ImageMapper.js +85 -144
- package/Rendering/Core/ImageProperty/Constants.js +2 -2
- package/Rendering/Core/ImageProperty.js +66 -81
- package/Rendering/Core/ImageResliceMapper/Constants.js +2 -2
- package/Rendering/Core/ImageResliceMapper.js +36 -29
- package/Rendering/Core/ImageSlice.js +85 -127
- package/Rendering/Core/InteractorObserver.js +82 -73
- package/Rendering/Core/InteractorStyle/Constants.js +2 -2
- package/Rendering/Core/InteractorStyle.js +56 -58
- package/Rendering/Core/Light.js +43 -49
- package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +37 -48
- package/Rendering/Core/Mapper/Constants.js +6 -6
- package/Rendering/Core/Mapper/Static.js +15 -12
- package/Rendering/Core/Mapper.js +194 -259
- package/Rendering/Core/Mapper2D.js +61 -100
- package/Rendering/Core/Picker.js +124 -143
- package/Rendering/Core/PixelSpaceCallbackMapper.js +40 -37
- package/Rendering/Core/PointPicker.js +68 -79
- package/Rendering/Core/Prop/Constants.js +2 -2
- package/Rendering/Core/Prop.js +58 -106
- package/Rendering/Core/Prop3D.js +54 -83
- package/Rendering/Core/Property/Constants.js +6 -6
- package/Rendering/Core/Property.js +45 -74
- package/Rendering/Core/Property2D/Constants.js +2 -2
- package/Rendering/Core/Property2D.js +33 -42
- package/Rendering/Core/RenderWindow.js +70 -82
- package/Rendering/Core/RenderWindowInteractor/Constants.js +7 -7
- package/Rendering/Core/RenderWindowInteractor.js +324 -439
- package/Rendering/Core/Renderer.js +192 -256
- package/Rendering/Core/ScalarBarActor.js +267 -272
- package/Rendering/Core/Skybox.js +26 -24
- package/Rendering/Core/SphereMapper.js +22 -12
- package/Rendering/Core/StickMapper.js +22 -12
- package/Rendering/Core/SurfaceLICInterface/Constants.js +6 -6
- package/Rendering/Core/SurfaceLICInterface.js +13 -9
- package/Rendering/Core/SurfaceLICMapper.js +23 -15
- package/Rendering/Core/Texture.js +99 -141
- package/Rendering/Core/Viewport.js +60 -88
- package/Rendering/Core/Volume.js +55 -77
- package/Rendering/Core/VolumeMapper/Constants.js +4 -4
- package/Rendering/Core/VolumeMapper.js +59 -91
- package/Rendering/Core/VolumeProperty/Constants.js +4 -4
- package/Rendering/Core/VolumeProperty.js +78 -115
- package/Rendering/Core.js +47 -49
- package/Rendering/Misc/CanvasView.js +62 -61
- package/Rendering/Misc/FullScreenRenderWindow.js +60 -62
- package/Rendering/Misc/GenericRenderWindow.js +48 -37
- package/Rendering/Misc/RemoteView.js +86 -80
- package/Rendering/Misc/RenderWindowWithControlBar.js +54 -48
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +43 -51
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +52 -82
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +258 -308
- package/Rendering/Misc/SynchronizableRenderWindow.js +133 -163
- package/Rendering/Misc/TextureLODsDownloader.js +72 -74
- package/Rendering/Misc.js +7 -7
- package/Rendering/OpenGL/Actor.js +57 -68
- package/Rendering/OpenGL/Actor2D.js +56 -56
- package/Rendering/OpenGL/BufferObject/Constants.js +2 -2
- package/Rendering/OpenGL/BufferObject.js +50 -65
- package/Rendering/OpenGL/Camera.js +35 -29
- package/Rendering/OpenGL/CellArrayBufferObject.js +119 -149
- package/Rendering/OpenGL/Convolution2DPass.js +87 -81
- package/Rendering/OpenGL/CubeAxesActor.js +28 -21
- package/Rendering/OpenGL/ForwardPass.js +53 -64
- package/Rendering/OpenGL/Framebuffer.js +61 -101
- package/Rendering/OpenGL/Glyph3DMapper.js +165 -196
- package/Rendering/OpenGL/HardwareSelector/Constants.js +2 -2
- package/Rendering/OpenGL/HardwareSelector.js +272 -397
- package/Rendering/OpenGL/Helper.js +58 -73
- package/Rendering/OpenGL/ImageCPRMapper.js +339 -421
- package/Rendering/OpenGL/ImageMapper.js +268 -361
- package/Rendering/OpenGL/ImageResliceMapper.js +306 -438
- package/Rendering/OpenGL/ImageSlice.js +48 -54
- package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +102 -84
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +43 -42
- package/Rendering/OpenGL/PolyDataMapper.js +358 -492
- package/Rendering/OpenGL/PolyDataMapper2D.js +153 -205
- package/Rendering/OpenGL/RadialDistortionPass.js +86 -89
- package/Rendering/OpenGL/RenderWindow/Constants.js +2 -2
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +20 -29
- package/Rendering/OpenGL/RenderWindow.js +356 -510
- package/Rendering/OpenGL/Renderer.js +77 -89
- package/Rendering/OpenGL/ReplacementShaderMapper.js +28 -46
- package/Rendering/OpenGL/ScalarBarActor.js +28 -21
- package/Rendering/OpenGL/Shader.js +37 -31
- package/Rendering/OpenGL/ShaderCache.js +67 -74
- package/Rendering/OpenGL/ShaderProgram.js +136 -248
- package/Rendering/OpenGL/Skybox.js +99 -60
- package/Rendering/OpenGL/SphereMapper.js +94 -108
- package/Rendering/OpenGL/StickMapper.js +110 -114
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +91 -157
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +142 -151
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +142 -216
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +79 -100
- package/Rendering/OpenGL/SurfaceLIC.js +2 -2
- package/Rendering/OpenGL/Texture/Constants.js +4 -4
- package/Rendering/OpenGL/Texture.js +443 -608
- package/Rendering/OpenGL/TextureUnitManager.js +47 -43
- package/Rendering/OpenGL/VertexArrayObject.js +92 -131
- package/Rendering/OpenGL/ViewNodeFactory.js +25 -13
- package/Rendering/OpenGL/Volume.js +38 -34
- package/Rendering/OpenGL/VolumeMapper.js +437 -547
- package/Rendering/OpenGL.js +28 -28
- package/Rendering/SceneGraph/RenderPass.js +34 -31
- package/Rendering/SceneGraph/RenderWindowViewNode.js +68 -94
- package/Rendering/SceneGraph/ViewNode.js +82 -111
- package/Rendering/SceneGraph/ViewNodeFactory.js +31 -26
- package/Rendering/SceneGraph.js +4 -4
- package/Rendering/WebGPU/Actor.js +49 -49
- package/Rendering/WebGPU/Actor2D.js +45 -44
- package/Rendering/WebGPU/BindGroup.js +43 -50
- package/Rendering/WebGPU/Buffer.js +41 -50
- package/Rendering/WebGPU/BufferManager/Constants.js +4 -4
- package/Rendering/WebGPU/BufferManager.js +111 -141
- package/Rendering/WebGPU/Camera.js +65 -67
- package/Rendering/WebGPU/CellArrayMapper.js +621 -388
- package/Rendering/WebGPU/CubeAxesActor.js +28 -19
- package/Rendering/WebGPU/Device.js +78 -133
- package/Rendering/WebGPU/ForwardPass.js +75 -72
- package/Rendering/WebGPU/FullScreenQuad.js +25 -18
- package/Rendering/WebGPU/Glyph3DMapper.js +62 -74
- package/Rendering/WebGPU/HardwareSelectionPass.js +45 -38
- package/Rendering/WebGPU/HardwareSelector.js +200 -276
- package/Rendering/WebGPU/ImageMapper.js +180 -171
- package/Rendering/WebGPU/ImageSlice.js +45 -44
- package/Rendering/WebGPU/IndexBuffer.js +166 -200
- package/Rendering/WebGPU/OpaquePass.js +37 -36
- package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +72 -45
- package/Rendering/WebGPU/Pipeline.js +37 -51
- package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +27 -19
- package/Rendering/WebGPU/PolyDataMapper.js +50 -53
- package/Rendering/WebGPU/PolyDataMapper2D.js +39 -39
- package/Rendering/WebGPU/RenderEncoder.js +68 -88
- package/Rendering/WebGPU/RenderWindow.js +262 -376
- package/Rendering/WebGPU/Renderer.js +224 -208
- package/Rendering/WebGPU/Sampler.js +27 -21
- package/Rendering/WebGPU/ScalarBarActor.js +28 -19
- package/Rendering/WebGPU/ShaderCache.js +43 -41
- package/Rendering/WebGPU/ShaderDescription.js +52 -59
- package/Rendering/WebGPU/ShaderModule.js +26 -17
- package/Rendering/WebGPU/SimpleMapper.js +185 -121
- package/Rendering/WebGPU/SphereMapper.js +200 -130
- package/Rendering/WebGPU/StickMapper.js +289 -152
- package/Rendering/WebGPU/StorageBuffer.js +100 -115
- package/Rendering/WebGPU/Texture.js +79 -99
- package/Rendering/WebGPU/TextureManager.js +52 -54
- package/Rendering/WebGPU/TextureView.js +40 -43
- package/Rendering/WebGPU/Types.js +53 -70
- package/Rendering/WebGPU/UniformBuffer.js +158 -184
- package/Rendering/WebGPU/VertexInput.js +64 -90
- package/Rendering/WebGPU/ViewNodeFactory.js +25 -13
- package/Rendering/WebGPU/Volume.js +52 -51
- package/Rendering/WebGPU/VolumePass.js +218 -239
- package/Rendering/WebGPU/VolumePassFSQ.js +625 -306
- package/Rendering/WebGPU.js +1 -1
- package/Rendering/index.js +5 -5
- package/Widgets/Core/AbstractWidget/Constants.js +2 -2
- package/Widgets/Core/AbstractWidget.js +49 -58
- package/Widgets/Core/AbstractWidgetFactory.js +101 -122
- package/Widgets/Core/StateBuilder/boundsMixin.js +23 -28
- package/Widgets/Core/StateBuilder/color3Mixin.js +10 -7
- package/Widgets/Core/StateBuilder/colorMixin.js +10 -6
- package/Widgets/Core/StateBuilder/cornerMixin.js +16 -15
- package/Widgets/Core/StateBuilder/directionMixin.js +20 -18
- package/Widgets/Core/StateBuilder/manipulatorMixin.js +26 -18
- package/Widgets/Core/StateBuilder/nameMixin.js +10 -6
- package/Widgets/Core/StateBuilder/orientationMixin.js +19 -16
- package/Widgets/Core/StateBuilder/originMixin.js +25 -32
- package/Widgets/Core/StateBuilder/scale1Mixin.js +10 -6
- package/Widgets/Core/StateBuilder/scale3Mixin.js +10 -6
- package/Widgets/Core/StateBuilder/shapeMixin.js +12 -6
- package/Widgets/Core/StateBuilder/textMixin.js +10 -6
- package/Widgets/Core/StateBuilder/visibleMixin.js +10 -6
- package/Widgets/Core/StateBuilder.js +120 -149
- package/Widgets/Core/WidgetManager/Constants.js +7 -7
- package/Widgets/Core/WidgetManager.js +249 -421
- package/Widgets/Core/WidgetState.js +48 -57
- package/Widgets/Core.js +5 -5
- package/Widgets/Manipulators/AbstractManipulator.js +20 -14
- package/Widgets/Manipulators/CPRManipulator.js +55 -71
- package/Widgets/Manipulators/LineManipulator.js +31 -28
- package/Widgets/Manipulators/PickerManipulator.d.ts +48 -0
- package/Widgets/Manipulators/PickerManipulator.js +65 -0
- package/Widgets/Manipulators/PlaneManipulator.js +26 -23
- package/Widgets/Manipulators/TrackballManipulator.js +39 -35
- package/Widgets/Manipulators.js +4 -2
- package/Widgets/Representations/ArrowHandleRepresentation.js +148 -162
- package/Widgets/Representations/CircleContextRepresentation.js +44 -38
- package/Widgets/Representations/ContextRepresentation.js +17 -14
- package/Widgets/Representations/ConvexFaceContextRepresentation.js +50 -47
- package/Widgets/Representations/CroppingOutlineRepresentation.js +38 -27
- package/Widgets/Representations/CubeHandleRepresentation.js +21 -18
- package/Widgets/Representations/GlyphRepresentation.js +107 -152
- package/Widgets/Representations/HandleRepresentation.js +17 -14
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +97 -91
- package/Widgets/Representations/LineHandleRepresentation.js +44 -41
- package/Widgets/Representations/OutlineContextRepresentation.js +42 -36
- package/Widgets/Representations/PolyLineRepresentation.js +60 -75
- package/Widgets/Representations/RectangleContextRepresentation.js +42 -37
- package/Widgets/Representations/SphereContextRepresentation.js +19 -27
- package/Widgets/Representations/SphereHandleRepresentation.js +31 -27
- package/Widgets/Representations/SplineContextRepresentation.js +46 -70
- package/Widgets/Representations/WidgetRepresentation/Constants.js +2 -2
- package/Widgets/Representations/WidgetRepresentation.js +99 -134
- package/Widgets/Representations.js +13 -13
- package/Widgets/Widgets3D/AngleWidget/behavior.js +41 -63
- package/Widgets/Widgets3D/AngleWidget.js +40 -38
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +40 -61
- package/Widgets/Widgets3D/DistanceWidget.js +38 -36
- package/Widgets/Widgets3D/EllipseWidget/behavior.js +14 -19
- package/Widgets/Widgets3D/EllipseWidget/state.js +4 -2
- package/Widgets/Widgets3D/EllipseWidget.js +37 -26
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +26 -56
- package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +14 -17
- package/Widgets/Widgets3D/ImageCroppingWidget/state.js +20 -16
- package/Widgets/Widgets3D/ImageCroppingWidget.js +80 -98
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +55 -77
- package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +17 -18
- package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +15 -7
- package/Widgets/Widgets3D/InteractiveOrientationWidget.js +30 -29
- package/Widgets/Widgets3D/LabelWidget/behavior.js +37 -62
- package/Widgets/Widgets3D/LabelWidget.js +31 -25
- package/Widgets/Widgets3D/LineWidget/Constants.js +8 -8
- package/Widgets/Widgets3D/LineWidget/behavior.js +77 -114
- package/Widgets/Widgets3D/LineWidget/helpers.js +13 -20
- package/Widgets/Widgets3D/LineWidget/state.js +2 -1
- package/Widgets/Widgets3D/LineWidget.js +39 -35
- package/Widgets/Widgets3D/PaintWidget/behavior.js +24 -59
- package/Widgets/Widgets3D/PaintWidget.js +39 -37
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +44 -68
- package/Widgets/Widgets3D/PolyLineWidget.js +36 -31
- package/Widgets/Widgets3D/RectangleWidget/behavior.js +6 -11
- package/Widgets/Widgets3D/RectangleWidget/state.js +4 -2
- package/Widgets/Widgets3D/RectangleWidget.js +37 -25
- package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +35 -21
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +133 -209
- package/Widgets/Widgets3D/ResliceCursorWidget/cprBehavior.js +26 -41
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +89 -116
- package/Widgets/Widgets3D/ResliceCursorWidget/state.js +33 -40
- package/Widgets/Widgets3D/ResliceCursorWidget.js +186 -227
- package/Widgets/Widgets3D/SeedWidget/behavior.js +82 -0
- package/Widgets/Widgets3D/SeedWidget/state.js +18 -0
- package/Widgets/Widgets3D/SeedWidget.d.ts +44 -0
- package/Widgets/Widgets3D/SeedWidget.js +43 -0
- package/Widgets/Widgets3D/ShapeWidget/Constants.js +19 -19
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +150 -252
- package/Widgets/Widgets3D/ShapeWidget.js +24 -27
- package/Widgets/Widgets3D/SphereWidget/behavior.js +35 -69
- package/Widgets/Widgets3D/SphereWidget/state.js +9 -5
- package/Widgets/Widgets3D/SphereWidget.js +34 -44
- package/Widgets/Widgets3D/SplineWidget/behavior.js +85 -120
- package/Widgets/Widgets3D/SplineWidget.js +43 -39
- package/Widgets/Widgets3D.js +15 -15
- package/Widgets/index.js +4 -4
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +95 -207
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +0 -3
- package/favicon.js +5 -6
- package/index.d.ts +4 -2
- package/index.js +4 -3
- package/macros.js +4 -1931
- package/macros2.js +1684 -0
- package/package.json +6 -6
- package/vtk.js +18 -31
|
@@ -1,103 +1,98 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { h as hsv2rgb, i as isNan, G as isInf, H as rgb2hsv, I as rgb2lab, J as lab2rgb, K as floor } from '../../Common/Core/Math/index.js';
|
|
1
|
+
import { m as macro } from '../../macros2.js';
|
|
2
|
+
import { h as hsv2rgb, i as isNan, G as floor, H as isInf, I as rgb2hsv, J as rgb2lab, K as lab2rgb } from '../../Common/Core/Math/index.js';
|
|
4
3
|
import vtkScalarsToColors from '../../Common/Core/ScalarsToColors.js';
|
|
5
4
|
import Constants from './ColorTransferFunction/Constants.js';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const {
|
|
7
|
+
ColorSpace,
|
|
8
|
+
Scale
|
|
9
|
+
} = Constants;
|
|
10
|
+
const {
|
|
11
|
+
ScalarMappingTarget
|
|
12
|
+
} = vtkScalarsToColors;
|
|
13
|
+
const {
|
|
14
|
+
vtkDebugMacro,
|
|
15
|
+
vtkErrorMacro,
|
|
16
|
+
vtkWarningMacro
|
|
17
|
+
} = macro;
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
var ColorSpace = Constants.ColorSpace,
|
|
11
|
-
Scale = Constants.Scale;
|
|
12
|
-
var ScalarMappingTarget = vtkScalarsToColors.ScalarMappingTarget;
|
|
13
|
-
var vtkDebugMacro = macro.vtkDebugMacro,
|
|
14
|
-
vtkErrorMacro = macro.vtkErrorMacro,
|
|
15
|
-
vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
16
20
|
// Global methods
|
|
17
21
|
// ----------------------------------------------------------------------------
|
|
18
|
-
|
|
19
22
|
/* eslint-disable no-continue */
|
|
23
|
+
|
|
20
24
|
// Convert to and from a special polar version of CIELAB (useful for creating
|
|
21
25
|
// continuous diverging color maps).
|
|
22
|
-
|
|
23
26
|
function vtkColorTransferFunctionLabToMsh(lab, msh) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const L = lab[0];
|
|
28
|
+
const a = lab[1];
|
|
29
|
+
const b = lab[2];
|
|
30
|
+
const M = Math.sqrt(L * L + a * a + b * b);
|
|
31
|
+
const s = M > 0.001 ? Math.acos(L / M) : 0.0;
|
|
32
|
+
const h = s > 0.001 ? Math.atan2(b, a) : 0.0;
|
|
30
33
|
msh[0] = M;
|
|
31
34
|
msh[1] = s;
|
|
32
35
|
msh[2] = h;
|
|
33
36
|
}
|
|
34
|
-
|
|
35
37
|
function vtkColorTransferFunctionMshToLab(msh, lab) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const M = msh[0];
|
|
39
|
+
const s = msh[1];
|
|
40
|
+
const h = msh[2];
|
|
39
41
|
lab[0] = M * Math.cos(s);
|
|
40
42
|
lab[1] = M * Math.sin(s) * Math.cos(h);
|
|
41
43
|
lab[2] = M * Math.sin(s) * Math.sin(h);
|
|
42
|
-
}
|
|
43
|
-
// color, find a hue for the unsaturated color that makes sense.
|
|
44
|
-
|
|
44
|
+
}
|
|
45
45
|
|
|
46
|
+
// For the case when interpolating from a saturated color to an unsaturated
|
|
47
|
+
// color, find a hue for the unsaturated color that makes sense.
|
|
46
48
|
function vtkColorTransferFunctionAdjustHue(msh, unsatM) {
|
|
47
49
|
if (msh[0] >= unsatM - 0.1) {
|
|
48
50
|
// The best we can do is hold hue constant.
|
|
49
51
|
return msh[2];
|
|
50
|
-
}
|
|
51
|
-
// interpolation to be close to constant.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var hueSpin = msh[1] * Math.sqrt(unsatM * unsatM - msh[0] * msh[0]) / (msh[0] * Math.sin(msh[1])); // Spin hue away from 0 except in purple hues.
|
|
52
|
+
}
|
|
55
53
|
|
|
54
|
+
// This equation is designed to make the perceptual change of the
|
|
55
|
+
// interpolation to be close to constant.
|
|
56
|
+
const hueSpin = msh[1] * Math.sqrt(unsatM * unsatM - msh[0] * msh[0]) / (msh[0] * Math.sin(msh[1]));
|
|
57
|
+
// Spin hue away from 0 except in purple hues.
|
|
56
58
|
if (msh[2] > -0.3 * Math.PI) {
|
|
57
59
|
return msh[2] + hueSpin;
|
|
58
60
|
}
|
|
59
|
-
|
|
60
61
|
return msh[2] - hueSpin;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
63
|
function vtkColorTransferFunctionAngleDiff(a1, a2) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
let adiff = a1 - a2;
|
|
66
65
|
if (adiff < 0.0) {
|
|
67
66
|
adiff = -adiff;
|
|
68
67
|
}
|
|
69
|
-
|
|
70
68
|
while (adiff >= 2.0 * Math.PI) {
|
|
71
69
|
adiff -= 2.0 * Math.PI;
|
|
72
70
|
}
|
|
73
|
-
|
|
74
71
|
if (adiff > Math.PI) {
|
|
75
72
|
adiff = 2.0 * Math.PI - adiff;
|
|
76
73
|
}
|
|
77
|
-
|
|
78
74
|
return adiff;
|
|
79
|
-
}
|
|
80
|
-
|
|
75
|
+
}
|
|
81
76
|
|
|
77
|
+
// Interpolate a diverging color map.
|
|
82
78
|
function vtkColorTransferFunctionInterpolateDiverging(s, rgb1, rgb2, result) {
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
const lab1 = [];
|
|
80
|
+
const lab2 = [];
|
|
85
81
|
rgb2lab(rgb1, lab1);
|
|
86
82
|
rgb2lab(rgb2, lab2);
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
const msh1 = [];
|
|
84
|
+
const msh2 = [];
|
|
89
85
|
vtkColorTransferFunctionLabToMsh(lab1, msh1);
|
|
90
|
-
vtkColorTransferFunctionLabToMsh(lab2, msh2);
|
|
91
|
-
// them.
|
|
92
|
-
|
|
93
|
-
var localS = s;
|
|
86
|
+
vtkColorTransferFunctionLabToMsh(lab2, msh2);
|
|
94
87
|
|
|
88
|
+
// If the endpoints are distinct saturated colors, then place white in between
|
|
89
|
+
// them.
|
|
90
|
+
let localS = s;
|
|
95
91
|
if (msh1[1] > 0.05 && msh2[1] > 0.05 && vtkColorTransferFunctionAngleDiff(msh1[2], msh2[2]) > 0.33 * Math.PI) {
|
|
96
92
|
// Insert the white midpoint by setting one end to white and adjusting the
|
|
97
93
|
// scalar value.
|
|
98
|
-
|
|
94
|
+
let Mmid = Math.max(msh1[0], msh2[0]);
|
|
99
95
|
Mmid = Math.max(88.0, Mmid);
|
|
100
|
-
|
|
101
96
|
if (s < 0.5) {
|
|
102
97
|
msh2[0] = Mmid;
|
|
103
98
|
msh2[1] = 0.0;
|
|
@@ -109,473 +104,443 @@ function vtkColorTransferFunctionInterpolateDiverging(s, rgb1, rgb2, result) {
|
|
|
109
104
|
msh1[2] = 0.0;
|
|
110
105
|
localS = 2.0 * localS - 1.0;
|
|
111
106
|
}
|
|
112
|
-
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// If one color has no saturation, then its hue value is invalid. In this
|
|
113
110
|
// case, we want to set it to something logical so that the interpolation of
|
|
114
111
|
// hue makes sense.
|
|
115
|
-
|
|
116
|
-
|
|
117
112
|
if (msh1[1] < 0.05 && msh2[1] > 0.05) {
|
|
118
113
|
msh1[2] = vtkColorTransferFunctionAdjustHue(msh2, msh1[0]);
|
|
119
114
|
} else if (msh2[1] < 0.05 && msh1[1] > 0.05) {
|
|
120
115
|
msh2[2] = vtkColorTransferFunctionAdjustHue(msh1, msh2[0]);
|
|
121
116
|
}
|
|
122
|
-
|
|
123
|
-
var mshTmp = [];
|
|
117
|
+
const mshTmp = [];
|
|
124
118
|
mshTmp[0] = (1 - localS) * msh1[0] + localS * msh2[0];
|
|
125
119
|
mshTmp[1] = (1 - localS) * msh1[1] + localS * msh2[1];
|
|
126
|
-
mshTmp[2] = (1 - localS) * msh1[2] + localS * msh2[2];
|
|
120
|
+
mshTmp[2] = (1 - localS) * msh1[2] + localS * msh2[2];
|
|
127
121
|
|
|
128
|
-
|
|
122
|
+
// Now convert back to RGB
|
|
123
|
+
const labTmp = [];
|
|
129
124
|
vtkColorTransferFunctionMshToLab(mshTmp, labTmp);
|
|
130
125
|
lab2rgb(labTmp, result);
|
|
131
|
-
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ----------------------------------------------------------------------------
|
|
132
129
|
// vtkColorTransferFunction methods
|
|
133
130
|
// ----------------------------------------------------------------------------
|
|
134
131
|
|
|
135
|
-
|
|
136
132
|
function vtkColorTransferFunction(publicAPI, model) {
|
|
137
133
|
// Set our className
|
|
138
|
-
model.classHierarchy.push('vtkColorTransferFunction');
|
|
139
|
-
|
|
140
|
-
publicAPI.getSize = function () {
|
|
141
|
-
return model.nodes.length;
|
|
142
|
-
}; //----------------------------------------------------------------------------
|
|
143
|
-
// Add a point defined in RGB
|
|
134
|
+
model.classHierarchy.push('vtkColorTransferFunction');
|
|
144
135
|
|
|
136
|
+
// Return the number of points which specify this function
|
|
137
|
+
publicAPI.getSize = () => model.nodes.length;
|
|
145
138
|
|
|
146
|
-
|
|
147
|
-
return publicAPI.addRGBPointLong(x, r, g, b, 0.5, 0.0);
|
|
148
|
-
}; //----------------------------------------------------------------------------
|
|
139
|
+
//----------------------------------------------------------------------------
|
|
149
140
|
// Add a point defined in RGB
|
|
141
|
+
publicAPI.addRGBPoint = (x, r, g, b) => publicAPI.addRGBPointLong(x, r, g, b, 0.5, 0.0);
|
|
150
142
|
|
|
151
|
-
|
|
143
|
+
//----------------------------------------------------------------------------
|
|
144
|
+
// Add a point defined in RGB
|
|
152
145
|
publicAPI.addRGBPointLong = function (x, r, g, b) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
let midpoint = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.5;
|
|
147
|
+
let sharpness = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0.0;
|
|
156
148
|
// Error check
|
|
157
149
|
if (midpoint < 0.0 || midpoint > 1.0) {
|
|
158
150
|
vtkErrorMacro('Midpoint outside range [0.0, 1.0]');
|
|
159
151
|
return -1;
|
|
160
152
|
}
|
|
161
|
-
|
|
162
153
|
if (sharpness < 0.0 || sharpness > 1.0) {
|
|
163
154
|
vtkErrorMacro('Sharpness outside range [0.0, 1.0]');
|
|
164
155
|
return -1;
|
|
165
|
-
}
|
|
166
|
-
|
|
156
|
+
}
|
|
167
157
|
|
|
158
|
+
// remove any node already at this X location
|
|
168
159
|
if (!model.allowDuplicateScalars) {
|
|
169
160
|
publicAPI.removePoint(x);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
var node = {
|
|
174
|
-
x: x,
|
|
175
|
-
r: r,
|
|
176
|
-
g: g,
|
|
177
|
-
b: b,
|
|
178
|
-
midpoint: midpoint,
|
|
179
|
-
sharpness: sharpness
|
|
180
|
-
}; // Add it, then sort to get everything in order
|
|
161
|
+
}
|
|
181
162
|
|
|
163
|
+
// Create the new node
|
|
164
|
+
const node = {
|
|
165
|
+
x,
|
|
166
|
+
r,
|
|
167
|
+
g,
|
|
168
|
+
b,
|
|
169
|
+
midpoint,
|
|
170
|
+
sharpness
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Add it, then sort to get everything in order
|
|
182
174
|
model.nodes.push(node);
|
|
183
|
-
publicAPI.sortAndUpdateRange();
|
|
184
|
-
// to return this value
|
|
185
|
-
|
|
186
|
-
var i = 0;
|
|
175
|
+
publicAPI.sortAndUpdateRange();
|
|
187
176
|
|
|
177
|
+
// We need to find the index of the node we just added in order
|
|
178
|
+
// to return this value
|
|
179
|
+
let i = 0;
|
|
188
180
|
for (; i < model.nodes.length; i++) {
|
|
189
181
|
if (model.nodes[i].x === x) {
|
|
190
182
|
break;
|
|
191
183
|
}
|
|
192
|
-
}
|
|
193
|
-
// return -1
|
|
194
|
-
|
|
184
|
+
}
|
|
195
185
|
|
|
186
|
+
// If we didn't find it, something went horribly wrong so
|
|
187
|
+
// return -1
|
|
196
188
|
if (i < model.nodes.length) {
|
|
197
189
|
return i;
|
|
198
190
|
}
|
|
199
|
-
|
|
200
191
|
return -1;
|
|
201
|
-
};
|
|
202
|
-
// Add a point defined in HSV
|
|
203
|
-
|
|
192
|
+
};
|
|
204
193
|
|
|
205
|
-
|
|
206
|
-
return publicAPI.addHSVPointLong(x, h, s, v, 0.5, 0.0);
|
|
207
|
-
}; //----------------------------------------------------------------------------
|
|
194
|
+
//----------------------------------------------------------------------------
|
|
208
195
|
// Add a point defined in HSV
|
|
196
|
+
publicAPI.addHSVPoint = (x, h, s, v) => publicAPI.addHSVPointLong(x, h, s, v, 0.5, 0.0);
|
|
209
197
|
|
|
210
|
-
|
|
198
|
+
//----------------------------------------------------------------------------
|
|
199
|
+
// Add a point defined in HSV
|
|
211
200
|
publicAPI.addHSVPointLong = function (x, h, s, v) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
201
|
+
let midpoint = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.5;
|
|
202
|
+
let sharpness = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0.0;
|
|
203
|
+
const rgb = [];
|
|
204
|
+
const hsv = [h, s, v];
|
|
216
205
|
hsv2rgb(hsv, rgb);
|
|
217
206
|
return publicAPI.addRGBPoint(x, rgb[0], rgb[1], rgb[2], midpoint, sharpness);
|
|
218
|
-
};
|
|
219
|
-
// Set nodes directly
|
|
220
|
-
|
|
207
|
+
};
|
|
221
208
|
|
|
222
|
-
|
|
209
|
+
//----------------------------------------------------------------------------
|
|
210
|
+
// Set nodes directly
|
|
211
|
+
publicAPI.setNodes = nodes => {
|
|
223
212
|
if (model.nodes !== nodes) {
|
|
224
|
-
|
|
213
|
+
const before = JSON.stringify(model.nodes);
|
|
225
214
|
model.nodes = nodes;
|
|
226
|
-
|
|
227
|
-
|
|
215
|
+
const after = JSON.stringify(model.nodes);
|
|
228
216
|
if (publicAPI.sortAndUpdateRange() || before !== after) {
|
|
229
217
|
publicAPI.modified();
|
|
230
218
|
return true;
|
|
231
219
|
}
|
|
232
220
|
}
|
|
233
|
-
|
|
234
221
|
return false;
|
|
235
|
-
};
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
//----------------------------------------------------------------------------
|
|
236
225
|
// Sort the vector in increasing order, then fill in
|
|
237
226
|
// the Range
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
});
|
|
245
|
-
var after = JSON.stringify(model.nodes);
|
|
246
|
-
var modifiedInvoked = publicAPI.updateRange(); // If range is updated, Modified() has been called, don't call it again.
|
|
247
|
-
|
|
227
|
+
publicAPI.sortAndUpdateRange = () => {
|
|
228
|
+
const before = JSON.stringify(model.nodes);
|
|
229
|
+
model.nodes.sort((a, b) => a.x - b.x);
|
|
230
|
+
const after = JSON.stringify(model.nodes);
|
|
231
|
+
const modifiedInvoked = publicAPI.updateRange();
|
|
232
|
+
// If range is updated, Modified() has been called, don't call it again.
|
|
248
233
|
if (!modifiedInvoked && before !== after) {
|
|
249
234
|
publicAPI.modified();
|
|
250
235
|
return true;
|
|
251
236
|
}
|
|
252
|
-
|
|
253
237
|
return modifiedInvoked;
|
|
254
|
-
};
|
|
255
|
-
|
|
238
|
+
};
|
|
256
239
|
|
|
257
|
-
|
|
258
|
-
|
|
240
|
+
//----------------------------------------------------------------------------
|
|
241
|
+
publicAPI.updateRange = () => {
|
|
242
|
+
const oldRange = [2];
|
|
259
243
|
oldRange[0] = model.mappingRange[0];
|
|
260
244
|
oldRange[1] = model.mappingRange[1];
|
|
261
|
-
|
|
262
|
-
|
|
245
|
+
const size = model.nodes.length;
|
|
263
246
|
if (size) {
|
|
264
247
|
model.mappingRange[0] = model.nodes[0].x;
|
|
265
248
|
model.mappingRange[1] = model.nodes[size - 1].x;
|
|
266
249
|
} else {
|
|
267
250
|
model.mappingRange[0] = 0;
|
|
268
251
|
model.mappingRange[1] = 0;
|
|
269
|
-
}
|
|
270
|
-
|
|
252
|
+
}
|
|
271
253
|
|
|
254
|
+
// If the range is the same, then no need to call Modified()
|
|
272
255
|
if (oldRange[0] === model.mappingRange[0] && oldRange[1] === model.mappingRange[1]) {
|
|
273
256
|
return false;
|
|
274
257
|
}
|
|
275
|
-
|
|
276
258
|
publicAPI.modified();
|
|
277
259
|
return true;
|
|
278
|
-
};
|
|
279
|
-
// Remove a point
|
|
280
|
-
|
|
260
|
+
};
|
|
281
261
|
|
|
282
|
-
|
|
262
|
+
//----------------------------------------------------------------------------
|
|
263
|
+
// Remove a point
|
|
264
|
+
publicAPI.removePoint = x => {
|
|
283
265
|
// First find the node since we need to know its
|
|
284
266
|
// index as our return value
|
|
285
|
-
|
|
286
|
-
|
|
267
|
+
let i = 0;
|
|
287
268
|
for (; i < model.nodes.length; i++) {
|
|
288
269
|
if (model.nodes[i].x === x) {
|
|
289
270
|
break;
|
|
290
271
|
}
|
|
291
272
|
}
|
|
273
|
+
const retVal = i;
|
|
292
274
|
|
|
293
|
-
|
|
294
|
-
|
|
275
|
+
// If the node doesn't exist, we return -1
|
|
295
276
|
if (i >= model.nodes.length) {
|
|
296
277
|
return -1;
|
|
297
|
-
}
|
|
298
|
-
// No need to sort here as the order of points hasn't changed.
|
|
299
|
-
|
|
278
|
+
}
|
|
300
279
|
|
|
301
|
-
|
|
280
|
+
// If the first or last point has been removed, then we update the range
|
|
281
|
+
// No need to sort here as the order of points hasn't changed.
|
|
282
|
+
let modifiedInvoked = false;
|
|
302
283
|
model.nodes.splice(i, 1);
|
|
303
|
-
|
|
304
284
|
if (i === 0 || i === model.nodes.length) {
|
|
305
285
|
modifiedInvoked = publicAPI.updateRange();
|
|
306
286
|
}
|
|
307
|
-
|
|
308
287
|
if (!modifiedInvoked) {
|
|
309
288
|
publicAPI.modified();
|
|
310
289
|
}
|
|
311
|
-
|
|
312
290
|
return retVal;
|
|
313
|
-
};
|
|
314
|
-
|
|
291
|
+
};
|
|
315
292
|
|
|
316
|
-
|
|
293
|
+
//----------------------------------------------------------------------------
|
|
294
|
+
publicAPI.movePoint = (oldX, newX) => {
|
|
317
295
|
if (oldX === newX) {
|
|
318
296
|
// Nothing to do.
|
|
319
297
|
return;
|
|
320
298
|
}
|
|
321
|
-
|
|
322
299
|
publicAPI.removePoint(newX);
|
|
323
|
-
|
|
324
|
-
for (var i = 0; i < model.nodes.length; i++) {
|
|
300
|
+
for (let i = 0; i < model.nodes.length; i++) {
|
|
325
301
|
if (model.nodes[i].x === oldX) {
|
|
326
302
|
model.nodes[i].x = newX;
|
|
327
303
|
publicAPI.sortAndUpdateRange();
|
|
328
304
|
break;
|
|
329
305
|
}
|
|
330
306
|
}
|
|
331
|
-
};
|
|
332
|
-
// Remove all points
|
|
333
|
-
|
|
307
|
+
};
|
|
334
308
|
|
|
335
|
-
|
|
309
|
+
//----------------------------------------------------------------------------
|
|
310
|
+
// Remove all points
|
|
311
|
+
publicAPI.removeAllPoints = () => {
|
|
336
312
|
model.nodes = [];
|
|
337
313
|
publicAPI.sortAndUpdateRange();
|
|
338
|
-
};
|
|
339
|
-
// Add a line defined in RGB
|
|
340
|
-
|
|
314
|
+
};
|
|
341
315
|
|
|
342
|
-
|
|
316
|
+
//----------------------------------------------------------------------------
|
|
317
|
+
// Add a line defined in RGB
|
|
318
|
+
publicAPI.addRGBSegment = (x1, r1, g1, b1, x2, r2, g2, b2) => {
|
|
343
319
|
// First, find all points in this range and remove them
|
|
344
320
|
publicAPI.sortAndUpdateRange();
|
|
345
|
-
|
|
346
|
-
for (var i = 0; i < model.nodes.length;) {
|
|
321
|
+
for (let i = 0; i < model.nodes.length;) {
|
|
347
322
|
if (model.nodes[i].x >= x1 && model.nodes[i].x <= x2) {
|
|
348
323
|
model.nodes.splice(i, 1);
|
|
349
324
|
} else {
|
|
350
325
|
i++;
|
|
351
326
|
}
|
|
352
|
-
}
|
|
353
|
-
|
|
327
|
+
}
|
|
354
328
|
|
|
329
|
+
// Now add the points
|
|
355
330
|
publicAPI.addRGBPointLong(x1, r1, g1, b1, 0.5, 0.0);
|
|
356
331
|
publicAPI.addRGBPointLong(x2, r2, g2, b2, 0.5, 0.0);
|
|
357
332
|
publicAPI.modified();
|
|
358
|
-
};
|
|
359
|
-
// Add a line defined in HSV
|
|
360
|
-
|
|
333
|
+
};
|
|
361
334
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
335
|
+
//----------------------------------------------------------------------------
|
|
336
|
+
// Add a line defined in HSV
|
|
337
|
+
publicAPI.addHSVSegment = (x1, h1, s1, v1, x2, h2, s2, v2) => {
|
|
338
|
+
const hsv1 = [h1, s1, v1];
|
|
339
|
+
const hsv2 = [h2, s2, v2];
|
|
340
|
+
const rgb1 = [];
|
|
341
|
+
const rgb2 = [];
|
|
367
342
|
hsv2rgb(hsv1, rgb1);
|
|
368
343
|
hsv2rgb(hsv2, rgb2);
|
|
369
344
|
publicAPI.addRGBSegment(x1, rgb1[0], rgb1[1], rgb1[2], x2, rgb2[0], rgb2[1], rgb2[2]);
|
|
370
|
-
};
|
|
371
|
-
// Returns the RGBA color evaluated at the specified location
|
|
372
|
-
|
|
345
|
+
};
|
|
373
346
|
|
|
374
|
-
|
|
375
|
-
|
|
347
|
+
//----------------------------------------------------------------------------
|
|
348
|
+
// Returns the RGBA color evaluated at the specified location
|
|
349
|
+
publicAPI.mapValue = x => {
|
|
350
|
+
const rgb = [];
|
|
376
351
|
publicAPI.getColor(x, rgb);
|
|
377
352
|
return [Math.floor(255.0 * rgb[0] + 0.5), Math.floor(255.0 * rgb[1] + 0.5), Math.floor(255.0 * rgb[2] + 0.5), 255];
|
|
378
|
-
};
|
|
379
|
-
// Returns the RGB color evaluated at the specified location
|
|
380
|
-
|
|
353
|
+
};
|
|
381
354
|
|
|
382
|
-
|
|
355
|
+
//----------------------------------------------------------------------------
|
|
356
|
+
// Returns the RGB color evaluated at the specified location
|
|
357
|
+
publicAPI.getColor = (x, rgb) => {
|
|
383
358
|
if (model.indexedLookup) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
359
|
+
const numNodes = publicAPI.getSize();
|
|
360
|
+
// todo
|
|
361
|
+
const idx = publicAPI.getAnnotatedValueIndexInternal(x);
|
|
388
362
|
if (idx < 0 || numNodes === 0) {
|
|
389
|
-
|
|
363
|
+
const nanColor = publicAPI.getNanColorByReference();
|
|
390
364
|
rgb[0] = nanColor[0];
|
|
391
365
|
rgb[1] = nanColor[1];
|
|
392
366
|
rgb[2] = nanColor[2];
|
|
393
367
|
} else {
|
|
394
|
-
|
|
395
|
-
publicAPI.getNodeValue(idx % numNodes, nodeVal);
|
|
396
|
-
|
|
368
|
+
const nodeVal = [];
|
|
369
|
+
publicAPI.getNodeValue(idx % numNodes, nodeVal);
|
|
370
|
+
// nodeVal[0] is the x value. nodeVal[1...3] is rgb.
|
|
397
371
|
rgb[0] = nodeVal[1];
|
|
398
372
|
rgb[1] = nodeVal[2];
|
|
399
373
|
rgb[2] = nodeVal[3];
|
|
400
374
|
}
|
|
401
|
-
|
|
402
375
|
return;
|
|
403
376
|
}
|
|
404
|
-
|
|
405
377
|
publicAPI.getTable(x, x, 1, rgb);
|
|
406
|
-
};
|
|
407
|
-
// Returns the red color evaluated at the specified location
|
|
408
|
-
|
|
378
|
+
};
|
|
409
379
|
|
|
410
|
-
|
|
411
|
-
|
|
380
|
+
//----------------------------------------------------------------------------
|
|
381
|
+
// Returns the red color evaluated at the specified location
|
|
382
|
+
publicAPI.getRedValue = x => {
|
|
383
|
+
const rgb = [];
|
|
412
384
|
publicAPI.getColor(x, rgb);
|
|
413
385
|
return rgb[0];
|
|
414
|
-
};
|
|
415
|
-
// Returns the green color evaluated at the specified location
|
|
416
|
-
|
|
386
|
+
};
|
|
417
387
|
|
|
418
|
-
|
|
419
|
-
|
|
388
|
+
//----------------------------------------------------------------------------
|
|
389
|
+
// Returns the green color evaluated at the specified location
|
|
390
|
+
publicAPI.getGreenValue = x => {
|
|
391
|
+
const rgb = [];
|
|
420
392
|
publicAPI.getColor(x, rgb);
|
|
421
393
|
return rgb[1];
|
|
422
|
-
};
|
|
423
|
-
// Returns the blue color evaluated at the specified location
|
|
424
|
-
|
|
394
|
+
};
|
|
425
395
|
|
|
426
|
-
|
|
427
|
-
|
|
396
|
+
//----------------------------------------------------------------------------
|
|
397
|
+
// Returns the blue color evaluated at the specified location
|
|
398
|
+
publicAPI.getBlueValue = x => {
|
|
399
|
+
const rgb = [];
|
|
428
400
|
publicAPI.getColor(x, rgb);
|
|
429
401
|
return rgb[2];
|
|
430
|
-
};
|
|
431
|
-
// Returns a table of RGB colors at regular intervals along the function
|
|
432
|
-
|
|
402
|
+
};
|
|
433
403
|
|
|
434
|
-
|
|
404
|
+
//----------------------------------------------------------------------------
|
|
405
|
+
// Returns a table of RGB colors at regular intervals along the function
|
|
406
|
+
publicAPI.getTable = (xStart_, xEnd_, size, table) => {
|
|
435
407
|
// To handle BigInt limitation
|
|
436
|
-
|
|
437
|
-
|
|
408
|
+
const xStart = Number(xStart_);
|
|
409
|
+
const xEnd = Number(xEnd_);
|
|
410
|
+
|
|
411
|
+
// Special case: If either the start or end is a NaN, then all any
|
|
438
412
|
// interpolation done on them is also a NaN. Therefore, fill the table with
|
|
439
413
|
// the NaN color.
|
|
440
|
-
|
|
441
414
|
if (isNan(xStart) || isNan(xEnd)) {
|
|
442
|
-
for (
|
|
415
|
+
for (let i = 0; i < size; i++) {
|
|
443
416
|
table[i * 3 + 0] = model.nanColor[0];
|
|
444
417
|
table[i * 3 + 1] = model.nanColor[1];
|
|
445
418
|
table[i * 3 + 2] = model.nanColor[2];
|
|
446
419
|
}
|
|
447
|
-
|
|
448
420
|
return;
|
|
449
421
|
}
|
|
422
|
+
let idx = 0;
|
|
423
|
+
const numNodes = model.nodes.length;
|
|
450
424
|
|
|
451
|
-
|
|
452
|
-
var numNodes = model.nodes.length; // Need to keep track of the last value so that
|
|
425
|
+
// Need to keep track of the last value so that
|
|
453
426
|
// we can fill in table locations past this with
|
|
454
427
|
// this value if Clamping is On.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
var lastB = 0.0;
|
|
459
|
-
|
|
428
|
+
let lastR = 0.0;
|
|
429
|
+
let lastG = 0.0;
|
|
430
|
+
let lastB = 0.0;
|
|
460
431
|
if (numNodes !== 0) {
|
|
461
432
|
lastR = model.nodes[numNodes - 1].r;
|
|
462
433
|
lastG = model.nodes[numNodes - 1].g;
|
|
463
434
|
lastB = model.nodes[numNodes - 1].b;
|
|
464
435
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
436
|
+
let x = 0.0;
|
|
437
|
+
let x1 = 0.0;
|
|
438
|
+
let x2 = 0.0;
|
|
439
|
+
const rgb1 = [0.0, 0.0, 0.0];
|
|
440
|
+
const rgb2 = [0.0, 0.0, 0.0];
|
|
441
|
+
let midpoint = 0.0;
|
|
442
|
+
let sharpness = 0.0;
|
|
443
|
+
const tmpVec = [];
|
|
444
|
+
|
|
445
|
+
// If the scale is logarithmic, make sure the range is valid.
|
|
446
|
+
let usingLogScale = model.scale === Scale.LOG10;
|
|
477
447
|
if (usingLogScale) {
|
|
478
448
|
// Note: This requires range[0] <= range[1].
|
|
479
449
|
usingLogScale = model.mappingRange[0] > 0.0;
|
|
480
450
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
var logX = 0.0;
|
|
485
|
-
|
|
451
|
+
let logStart = 0.0;
|
|
452
|
+
let logEnd = 0.0;
|
|
453
|
+
let logX = 0.0;
|
|
486
454
|
if (usingLogScale) {
|
|
487
455
|
logStart = Math.log10(xStart);
|
|
488
456
|
logEnd = Math.log10(xEnd);
|
|
489
|
-
}
|
|
490
|
-
|
|
457
|
+
}
|
|
491
458
|
|
|
492
|
-
|
|
459
|
+
// For each table entry
|
|
460
|
+
for (let i = 0; i < size; i++) {
|
|
493
461
|
// Find our location in the table
|
|
494
|
-
|
|
462
|
+
const tidx = 3 * i;
|
|
463
|
+
|
|
464
|
+
// Find our X location. If we are taking only 1 sample, make
|
|
495
465
|
// it halfway between start and end (usually start and end will
|
|
496
466
|
// be the same in this case)
|
|
497
|
-
|
|
498
467
|
if (size > 1) {
|
|
499
468
|
if (usingLogScale) {
|
|
500
|
-
logX = logStart +
|
|
501
|
-
x =
|
|
469
|
+
logX = logStart + i / (size - 1.0) * (logEnd - logStart);
|
|
470
|
+
x = 10.0 ** logX;
|
|
502
471
|
} else {
|
|
503
|
-
x = xStart +
|
|
472
|
+
x = xStart + i / (size - 1.0) * (xEnd - xStart);
|
|
504
473
|
}
|
|
505
474
|
} else if (usingLogScale) {
|
|
506
475
|
logX = 0.5 * (logStart + logEnd);
|
|
507
|
-
x =
|
|
476
|
+
x = 10.0 ** logX;
|
|
508
477
|
} else {
|
|
509
478
|
x = 0.5 * (xStart + xEnd);
|
|
510
|
-
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Linearly map x from mappingRange to [0, numberOfValues-1],
|
|
511
482
|
// discretize (round down to the closest integer),
|
|
512
483
|
// then map back to mappingRange
|
|
513
|
-
|
|
514
|
-
|
|
515
484
|
if (model.discretize) {
|
|
516
|
-
|
|
517
|
-
|
|
485
|
+
const range = model.mappingRange;
|
|
518
486
|
if (x >= range[0] && x <= range[1]) {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
487
|
+
const numberOfValues = model.numberOfValues;
|
|
488
|
+
const deltaRange = range[1] - range[0];
|
|
522
489
|
if (numberOfValues <= 1) {
|
|
523
490
|
x = range[0] + deltaRange / 2.0;
|
|
524
491
|
} else {
|
|
525
492
|
// normalize x
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
493
|
+
const xn = (x - range[0]) / deltaRange;
|
|
494
|
+
// discretize
|
|
495
|
+
const discretizeIndex = floor(numberOfValues * xn);
|
|
496
|
+
// get discretized x
|
|
530
497
|
x = range[0] + discretizeIndex / (numberOfValues - 1) * deltaRange;
|
|
531
498
|
}
|
|
532
499
|
}
|
|
533
|
-
}
|
|
534
|
-
|
|
500
|
+
}
|
|
535
501
|
|
|
502
|
+
// Do we need to move to the next node?
|
|
536
503
|
while (idx < numNodes && x > model.nodes[idx].x) {
|
|
537
|
-
idx++;
|
|
504
|
+
idx++;
|
|
505
|
+
// If we are at a valid point index, fill in
|
|
538
506
|
// the value at this node, and the one before (the
|
|
539
507
|
// two that surround our current sample location)
|
|
540
508
|
// idx cannot be 0 since we just incremented it.
|
|
541
|
-
|
|
542
509
|
if (idx < numNodes) {
|
|
543
510
|
x1 = model.nodes[idx - 1].x;
|
|
544
511
|
x2 = model.nodes[idx].x;
|
|
545
|
-
|
|
546
512
|
if (usingLogScale) {
|
|
547
513
|
x1 = Math.log10(x1);
|
|
548
514
|
x2 = Math.log10(x2);
|
|
549
515
|
}
|
|
550
|
-
|
|
551
516
|
rgb1[0] = model.nodes[idx - 1].r;
|
|
552
517
|
rgb2[0] = model.nodes[idx].r;
|
|
553
518
|
rgb1[1] = model.nodes[idx - 1].g;
|
|
554
519
|
rgb2[1] = model.nodes[idx].g;
|
|
555
520
|
rgb1[2] = model.nodes[idx - 1].b;
|
|
556
|
-
rgb2[2] = model.nodes[idx].b;
|
|
557
|
-
// since these control this region
|
|
521
|
+
rgb2[2] = model.nodes[idx].b;
|
|
558
522
|
|
|
523
|
+
// We only need the previous midpoint and sharpness
|
|
524
|
+
// since these control this region
|
|
559
525
|
midpoint = model.nodes[idx - 1].midpoint;
|
|
560
|
-
sharpness = model.nodes[idx - 1].sharpness;
|
|
561
|
-
// degenerate math
|
|
526
|
+
sharpness = model.nodes[idx - 1].sharpness;
|
|
562
527
|
|
|
528
|
+
// Move midpoint away from extreme ends of range to avoid
|
|
529
|
+
// degenerate math
|
|
563
530
|
if (midpoint < 0.00001) {
|
|
564
531
|
midpoint = 0.00001;
|
|
565
532
|
}
|
|
566
|
-
|
|
567
533
|
if (midpoint > 0.99999) {
|
|
568
534
|
midpoint = 0.99999;
|
|
569
535
|
}
|
|
570
536
|
}
|
|
571
|
-
}
|
|
572
|
-
|
|
537
|
+
}
|
|
573
538
|
|
|
539
|
+
// Are we at or past the end? If so, just use the last value
|
|
574
540
|
if (x > model.mappingRange[1]) {
|
|
575
541
|
table[tidx] = 0.0;
|
|
576
542
|
table[tidx + 1] = 0.0;
|
|
577
543
|
table[tidx + 2] = 0.0;
|
|
578
|
-
|
|
579
544
|
if (model.clamping) {
|
|
580
545
|
if (publicAPI.getUseAboveRangeColor()) {
|
|
581
546
|
table[tidx] = model.aboveRangeColor[0];
|
|
@@ -593,7 +558,6 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
593
558
|
table[tidx] = 0.0;
|
|
594
559
|
table[tidx + 1] = 0.0;
|
|
595
560
|
table[tidx + 2] = 0.0;
|
|
596
|
-
|
|
597
561
|
if (model.clamping) {
|
|
598
562
|
if (publicAPI.getUseBelowRangeColor()) {
|
|
599
563
|
table[tidx] = model.belowRangeColor[0];
|
|
@@ -621,23 +585,22 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
621
585
|
// we will be modifying this based on midpoint and
|
|
622
586
|
// sharpness to get the curve shape we want and to have
|
|
623
587
|
// it pass through (y1+y2)/2 at the midpoint.
|
|
624
|
-
|
|
625
|
-
|
|
588
|
+
let s = 0.0;
|
|
626
589
|
if (usingLogScale) {
|
|
627
590
|
s = (logX - x1) / (x2 - x1);
|
|
628
591
|
} else {
|
|
629
592
|
s = (x - x1) / (x2 - x1);
|
|
630
|
-
}
|
|
631
|
-
|
|
593
|
+
}
|
|
632
594
|
|
|
595
|
+
// Readjust based on the midpoint - linear adjustment
|
|
633
596
|
if (s < midpoint) {
|
|
634
597
|
s = 0.5 * s / midpoint;
|
|
635
598
|
} else {
|
|
636
599
|
s = 0.5 + 0.5 * (s - midpoint) / (1.0 - midpoint);
|
|
637
|
-
}
|
|
638
|
-
// In this case we just want piecewise constant
|
|
639
|
-
|
|
600
|
+
}
|
|
640
601
|
|
|
602
|
+
// override for sharpness > 0.99
|
|
603
|
+
// In this case we just want piecewise constant
|
|
641
604
|
if (sharpness > 0.99) {
|
|
642
605
|
// Use the first value since we are below the midpoint
|
|
643
606
|
if (s < 0.5) {
|
|
@@ -652,10 +615,10 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
652
615
|
table[tidx + 2] = rgb2[2];
|
|
653
616
|
continue;
|
|
654
617
|
}
|
|
655
|
-
}
|
|
656
|
-
// In this case we want piecewise linear
|
|
657
|
-
|
|
618
|
+
}
|
|
658
619
|
|
|
620
|
+
// Override for sharpness < 0.01
|
|
621
|
+
// In this case we want piecewise linear
|
|
659
622
|
if (sharpness < 0.01) {
|
|
660
623
|
// Simple linear interpolation
|
|
661
624
|
if (model.colorSpace === ColorSpace.RGB) {
|
|
@@ -663,11 +626,10 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
663
626
|
table[tidx + 1] = (1 - s) * rgb1[1] + s * rgb2[1];
|
|
664
627
|
table[tidx + 2] = (1 - s) * rgb1[2] + s * rgb2[2];
|
|
665
628
|
} else if (model.colorSpace === ColorSpace.HSV) {
|
|
666
|
-
|
|
667
|
-
|
|
629
|
+
const hsv1 = [];
|
|
630
|
+
const hsv2 = [];
|
|
668
631
|
rgb2hsv(rgb1, hsv1);
|
|
669
632
|
rgb2hsv(rgb2, hsv2);
|
|
670
|
-
|
|
671
633
|
if (model.hSVWrap && (hsv1[0] - hsv2[0] > 0.5 || hsv2[0] - hsv1[0] > 0.5)) {
|
|
672
634
|
if (hsv1[0] > hsv2[0]) {
|
|
673
635
|
hsv1[0] -= 1.0;
|
|
@@ -675,31 +637,30 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
675
637
|
hsv2[0] -= 1.0;
|
|
676
638
|
}
|
|
677
639
|
}
|
|
678
|
-
|
|
679
|
-
var hsvTmp = [];
|
|
640
|
+
const hsvTmp = [];
|
|
680
641
|
hsvTmp[0] = (1.0 - s) * hsv1[0] + s * hsv2[0];
|
|
681
|
-
|
|
682
642
|
if (hsvTmp[0] < 0.0) {
|
|
683
643
|
hsvTmp[0] += 1.0;
|
|
684
644
|
}
|
|
685
|
-
|
|
686
645
|
hsvTmp[1] = (1.0 - s) * hsv1[1] + s * hsv2[1];
|
|
687
|
-
hsvTmp[2] = (1.0 - s) * hsv1[2] + s * hsv2[2];
|
|
646
|
+
hsvTmp[2] = (1.0 - s) * hsv1[2] + s * hsv2[2];
|
|
688
647
|
|
|
648
|
+
// Now convert this back to RGB
|
|
689
649
|
hsv2rgb(hsvTmp, tmpVec);
|
|
690
650
|
table[tidx] = tmpVec[0];
|
|
691
651
|
table[tidx + 1] = tmpVec[1];
|
|
692
652
|
table[tidx + 2] = tmpVec[2];
|
|
693
653
|
} else if (model.colorSpace === ColorSpace.LAB) {
|
|
694
|
-
|
|
695
|
-
|
|
654
|
+
const lab1 = [];
|
|
655
|
+
const lab2 = [];
|
|
696
656
|
rgb2lab(rgb1, lab1);
|
|
697
657
|
rgb2lab(rgb2, lab2);
|
|
698
|
-
|
|
658
|
+
const labTmp = [];
|
|
699
659
|
labTmp[0] = (1 - s) * lab1[0] + s * lab2[0];
|
|
700
660
|
labTmp[1] = (1 - s) * lab1[1] + s * lab2[1];
|
|
701
|
-
labTmp[2] = (1 - s) * lab1[2] + s * lab2[2];
|
|
661
|
+
labTmp[2] = (1 - s) * lab1[2] + s * lab2[2];
|
|
702
662
|
|
|
663
|
+
// Now convert back to RGB
|
|
703
664
|
lab2rgb(labTmp, tmpVec);
|
|
704
665
|
table[tidx] = tmpVec[0];
|
|
705
666
|
table[tidx + 1] = tmpVec[1];
|
|
@@ -712,90 +673,85 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
712
673
|
} else {
|
|
713
674
|
vtkErrorMacro('ColorSpace set to invalid value.', model.colorSpace);
|
|
714
675
|
}
|
|
715
|
-
|
|
716
676
|
continue;
|
|
717
|
-
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// We have a sharpness between [0.01, 0.99] - we will
|
|
718
680
|
// used a modified hermite curve interpolation where we
|
|
719
681
|
// derive the slope based on the sharpness, and we compress
|
|
720
682
|
// the curve non-linearly based on the sharpness
|
|
683
|
+
|
|
721
684
|
// First, we will adjust our position based on sharpness in
|
|
722
685
|
// order to make the curve sharper (closer to piecewise constant)
|
|
723
|
-
|
|
724
|
-
|
|
725
686
|
if (s < 0.5) {
|
|
726
|
-
s = 0.5 *
|
|
687
|
+
s = 0.5 * (s * 2.0) ** (1.0 + 10.0 * sharpness);
|
|
727
688
|
} else if (s > 0.5) {
|
|
728
|
-
s = 1.0 - 0.5 *
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
var ss = s * s;
|
|
733
|
-
var sss = ss * s;
|
|
734
|
-
var h1 = 2.0 * sss - 3 * ss + 1;
|
|
735
|
-
var h2 = -2 * sss + 3 * ss;
|
|
736
|
-
var h3 = sss - 2 * ss + s;
|
|
737
|
-
var h4 = sss - ss;
|
|
738
|
-
var slope = void 0;
|
|
739
|
-
var t = void 0;
|
|
689
|
+
s = 1.0 - 0.5 * ((1.0 - s) * 2) ** (1 + 10.0 * sharpness);
|
|
690
|
+
}
|
|
740
691
|
|
|
692
|
+
// Compute some coefficients we will need for the hermite curve
|
|
693
|
+
const ss = s * s;
|
|
694
|
+
const sss = ss * s;
|
|
695
|
+
const h1 = 2.0 * sss - 3 * ss + 1;
|
|
696
|
+
const h2 = -2 * sss + 3 * ss;
|
|
697
|
+
const h3 = sss - 2 * ss + s;
|
|
698
|
+
const h4 = sss - ss;
|
|
699
|
+
let slope;
|
|
700
|
+
let t;
|
|
741
701
|
if (model.colorSpace === ColorSpace.RGB) {
|
|
742
|
-
for (
|
|
702
|
+
for (let j = 0; j < 3; j++) {
|
|
743
703
|
// Use one slope for both end points
|
|
744
704
|
slope = rgb2[j] - rgb1[j];
|
|
745
|
-
t = (1.0 - sharpness) * slope;
|
|
705
|
+
t = (1.0 - sharpness) * slope;
|
|
746
706
|
|
|
707
|
+
// Compute the value
|
|
747
708
|
table[tidx + j] = h1 * rgb1[j] + h2 * rgb2[j] + h3 * t + h4 * t;
|
|
748
709
|
}
|
|
749
710
|
} else if (model.colorSpace === ColorSpace.HSV) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
rgb2hsv(rgb1,
|
|
753
|
-
rgb2hsv(rgb2,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
_hsv[0] -= 1.0;
|
|
711
|
+
const hsv1 = [];
|
|
712
|
+
const hsv2 = [];
|
|
713
|
+
rgb2hsv(rgb1, hsv1);
|
|
714
|
+
rgb2hsv(rgb2, hsv2);
|
|
715
|
+
if (model.hSVWrap && (hsv1[0] - hsv2[0] > 0.5 || hsv2[0] - hsv1[0] > 0.5)) {
|
|
716
|
+
if (hsv1[0] > hsv2[0]) {
|
|
717
|
+
hsv1[0] -= 1.0;
|
|
758
718
|
} else {
|
|
759
|
-
|
|
719
|
+
hsv2[0] -= 1.0;
|
|
760
720
|
}
|
|
761
721
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
for (var _j = 0; _j < 3; _j++) {
|
|
722
|
+
const hsvTmp = [];
|
|
723
|
+
for (let j = 0; j < 3; j++) {
|
|
766
724
|
// Use one slope for both end points
|
|
767
|
-
slope =
|
|
768
|
-
t = (1.0 - sharpness) * slope;
|
|
769
|
-
|
|
770
|
-
_hsvTmp[_j] = h1 * _hsv[_j] + h2 * _hsv2[_j] + h3 * t + h4 * t;
|
|
725
|
+
slope = hsv2[j] - hsv1[j];
|
|
726
|
+
t = (1.0 - sharpness) * slope;
|
|
771
727
|
|
|
772
|
-
|
|
773
|
-
|
|
728
|
+
// Compute the value
|
|
729
|
+
hsvTmp[j] = h1 * hsv1[j] + h2 * hsv2[j] + h3 * t + h4 * t;
|
|
730
|
+
if (j === 0 && hsvTmp[j] < 0.0) {
|
|
731
|
+
hsvTmp[j] += 1.0;
|
|
774
732
|
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
hsv2rgb(_hsvTmp, tmpVec);
|
|
733
|
+
}
|
|
734
|
+
// Now convert this back to RGB
|
|
735
|
+
hsv2rgb(hsvTmp, tmpVec);
|
|
779
736
|
table[tidx] = tmpVec[0];
|
|
780
737
|
table[tidx + 1] = tmpVec[1];
|
|
781
738
|
table[tidx + 2] = tmpVec[2];
|
|
782
739
|
} else if (model.colorSpace === ColorSpace.LAB) {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
rgb2lab(rgb1,
|
|
786
|
-
rgb2lab(rgb2,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
for (var _j2 = 0; _j2 < 3; _j2++) {
|
|
740
|
+
const lab1 = [];
|
|
741
|
+
const lab2 = [];
|
|
742
|
+
rgb2lab(rgb1, lab1);
|
|
743
|
+
rgb2lab(rgb2, lab2);
|
|
744
|
+
const labTmp = [];
|
|
745
|
+
for (let j = 0; j < 3; j++) {
|
|
790
746
|
// Use one slope for both end points
|
|
791
|
-
slope =
|
|
792
|
-
t = (1.0 - sharpness) * slope;
|
|
793
|
-
|
|
794
|
-
_labTmp[_j2] = h1 * _lab[_j2] + h2 * _lab2[_j2] + h3 * t + h4 * t;
|
|
795
|
-
} // Now convert this back to RGB
|
|
796
|
-
|
|
747
|
+
slope = lab2[j] - lab1[j];
|
|
748
|
+
t = (1.0 - sharpness) * slope;
|
|
797
749
|
|
|
798
|
-
|
|
750
|
+
// Compute the value
|
|
751
|
+
labTmp[j] = h1 * lab1[j] + h2 * lab2[j] + h3 * t + h4 * t;
|
|
752
|
+
}
|
|
753
|
+
// Now convert this back to RGB
|
|
754
|
+
lab2rgb(labTmp, tmpVec);
|
|
799
755
|
table[tidx] = tmpVec[0];
|
|
800
756
|
table[tidx + 1] = tmpVec[1];
|
|
801
757
|
table[tidx + 2] = tmpVec[2];
|
|
@@ -809,60 +765,50 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
809
765
|
table[tidx + 2] = tmpVec[2];
|
|
810
766
|
} else {
|
|
811
767
|
vtkErrorMacro('ColorSpace set to invalid value.');
|
|
812
|
-
}
|
|
813
|
-
|
|
768
|
+
}
|
|
814
769
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
table[tidx +
|
|
770
|
+
// Final error check to make sure we don't go outside [0,1]
|
|
771
|
+
for (let j = 0; j < 3; j++) {
|
|
772
|
+
table[tidx + j] = table[tidx + j] < 0.0 ? 0.0 : table[tidx + j];
|
|
773
|
+
table[tidx + j] = table[tidx + j] > 1.0 ? 1.0 : table[tidx + j];
|
|
818
774
|
}
|
|
819
775
|
}
|
|
820
776
|
}
|
|
821
|
-
};
|
|
822
|
-
|
|
777
|
+
};
|
|
823
778
|
|
|
779
|
+
//----------------------------------------------------------------------------
|
|
824
780
|
publicAPI.getUint8Table = function (xStart, xEnd, size) {
|
|
825
|
-
|
|
826
|
-
|
|
781
|
+
let withAlpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
827
782
|
if (publicAPI.getMTime() <= model.buildTime && model.tableSize === size && model.tableWithAlpha !== withAlpha) {
|
|
828
783
|
return model.table;
|
|
829
784
|
}
|
|
830
|
-
|
|
831
785
|
if (model.nodes.length === 0) {
|
|
832
786
|
vtkErrorMacro('Attempting to lookup a value with no points in the function');
|
|
833
787
|
return model.table;
|
|
834
788
|
}
|
|
835
|
-
|
|
836
|
-
var nbChannels = withAlpha ? 4 : 3;
|
|
837
|
-
|
|
789
|
+
const nbChannels = withAlpha ? 4 : 3;
|
|
838
790
|
if (model.tableSize !== size || model.tableWithAlpha !== withAlpha) {
|
|
839
791
|
model.table = new Uint8Array(size * nbChannels);
|
|
840
792
|
model.tableSize = size;
|
|
841
793
|
model.tableWithAlpha = withAlpha;
|
|
842
794
|
}
|
|
843
|
-
|
|
844
|
-
var tmpTable = [];
|
|
795
|
+
const tmpTable = [];
|
|
845
796
|
publicAPI.getTable(xStart, xEnd, size, tmpTable);
|
|
846
|
-
|
|
847
|
-
for (var i = 0; i < size; i++) {
|
|
797
|
+
for (let i = 0; i < size; i++) {
|
|
848
798
|
model.table[i * nbChannels + 0] = Math.floor(tmpTable[i * 3 + 0] * 255.0 + 0.5);
|
|
849
799
|
model.table[i * nbChannels + 1] = Math.floor(tmpTable[i * 3 + 1] * 255.0 + 0.5);
|
|
850
800
|
model.table[i * nbChannels + 2] = Math.floor(tmpTable[i * 3 + 2] * 255.0 + 0.5);
|
|
851
|
-
|
|
852
801
|
if (withAlpha) {
|
|
853
802
|
model.table[i * nbChannels + 3] = 255;
|
|
854
803
|
}
|
|
855
804
|
}
|
|
856
|
-
|
|
857
805
|
model.buildTime.modified();
|
|
858
806
|
return model.table;
|
|
859
807
|
};
|
|
860
|
-
|
|
861
|
-
publicAPI.buildFunctionFromArray = function (array) {
|
|
808
|
+
publicAPI.buildFunctionFromArray = array => {
|
|
862
809
|
publicAPI.removeAllPoints();
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
for (var i = 0; i < array.getNumberOfTuples(); i++) {
|
|
810
|
+
const numComponents = array.getNumberOfComponents();
|
|
811
|
+
for (let i = 0; i < array.getNumberOfTuples(); i++) {
|
|
866
812
|
switch (numComponents) {
|
|
867
813
|
case 3:
|
|
868
814
|
{
|
|
@@ -876,7 +822,6 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
876
822
|
});
|
|
877
823
|
break;
|
|
878
824
|
}
|
|
879
|
-
|
|
880
825
|
case 4:
|
|
881
826
|
{
|
|
882
827
|
model.nodes.push({
|
|
@@ -889,7 +834,6 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
889
834
|
});
|
|
890
835
|
break;
|
|
891
836
|
}
|
|
892
|
-
|
|
893
837
|
case 5:
|
|
894
838
|
{
|
|
895
839
|
model.nodes.push({
|
|
@@ -902,7 +846,6 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
902
846
|
});
|
|
903
847
|
break;
|
|
904
848
|
}
|
|
905
|
-
|
|
906
849
|
case 6:
|
|
907
850
|
{
|
|
908
851
|
model.nodes.push({
|
|
@@ -917,21 +860,18 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
917
860
|
}
|
|
918
861
|
}
|
|
919
862
|
}
|
|
920
|
-
|
|
921
863
|
publicAPI.sortAndUpdateRange();
|
|
922
|
-
};
|
|
923
|
-
|
|
864
|
+
};
|
|
924
865
|
|
|
925
|
-
|
|
926
|
-
|
|
866
|
+
//----------------------------------------------------------------------------
|
|
867
|
+
publicAPI.buildFunctionFromTable = (xStart, xEnd, size, table) => {
|
|
868
|
+
let inc = 0.0;
|
|
927
869
|
publicAPI.removeAllPoints();
|
|
928
|
-
|
|
929
870
|
if (size > 1) {
|
|
930
871
|
inc = (xEnd - xStart) / (size - 1.0);
|
|
931
872
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
var node = {
|
|
873
|
+
for (let i = 0; i < size; i++) {
|
|
874
|
+
const node = {
|
|
935
875
|
x: xStart + inc * i,
|
|
936
876
|
r: table[i * 3],
|
|
937
877
|
g: table[i * 3 + 1],
|
|
@@ -941,18 +881,16 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
941
881
|
};
|
|
942
882
|
model.nodes.push(node);
|
|
943
883
|
}
|
|
944
|
-
|
|
945
884
|
publicAPI.sortAndUpdateRange();
|
|
946
|
-
};
|
|
947
|
-
// For a specified index value, get the node parameters
|
|
948
|
-
|
|
885
|
+
};
|
|
949
886
|
|
|
950
|
-
|
|
887
|
+
//----------------------------------------------------------------------------
|
|
888
|
+
// For a specified index value, get the node parameters
|
|
889
|
+
publicAPI.getNodeValue = (index, val) => {
|
|
951
890
|
if (index < 0 || index >= model.nodes.length) {
|
|
952
891
|
vtkErrorMacro('Index out of range!');
|
|
953
892
|
return -1;
|
|
954
893
|
}
|
|
955
|
-
|
|
956
894
|
val[0] = model.nodes[index].x;
|
|
957
895
|
val[1] = model.nodes[index].r;
|
|
958
896
|
val[2] = model.nodes[index].g;
|
|
@@ -960,121 +898,105 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
960
898
|
val[4] = model.nodes[index].midpoint;
|
|
961
899
|
val[5] = model.nodes[index].sharpness;
|
|
962
900
|
return 1;
|
|
963
|
-
};
|
|
964
|
-
// For a specified index value, get the node parameters
|
|
965
|
-
|
|
901
|
+
};
|
|
966
902
|
|
|
967
|
-
|
|
903
|
+
//----------------------------------------------------------------------------
|
|
904
|
+
// For a specified index value, get the node parameters
|
|
905
|
+
publicAPI.setNodeValue = (index, val) => {
|
|
968
906
|
if (index < 0 || index >= model.nodes.length) {
|
|
969
907
|
vtkErrorMacro('Index out of range!');
|
|
970
908
|
return -1;
|
|
971
909
|
}
|
|
972
|
-
|
|
973
|
-
var oldX = model.nodes[index].x;
|
|
910
|
+
const oldX = model.nodes[index].x;
|
|
974
911
|
model.nodes[index].x = val[0];
|
|
975
912
|
model.nodes[index].r = val[1];
|
|
976
913
|
model.nodes[index].g = val[2];
|
|
977
914
|
model.nodes[index].b = val[3];
|
|
978
915
|
model.nodes[index].midpoint = val[4];
|
|
979
916
|
model.nodes[index].sharpness = val[5];
|
|
980
|
-
|
|
981
917
|
if (oldX !== val[0]) {
|
|
982
918
|
// The point has been moved, the order of points or the range might have
|
|
983
919
|
// been modified.
|
|
984
|
-
publicAPI.sortAndUpdateRange();
|
|
920
|
+
publicAPI.sortAndUpdateRange();
|
|
921
|
+
// No need to call Modified() here because SortAndUpdateRange() has done it
|
|
985
922
|
// already.
|
|
986
923
|
} else {
|
|
987
924
|
publicAPI.modified();
|
|
988
925
|
}
|
|
989
|
-
|
|
990
926
|
return 1;
|
|
991
|
-
};
|
|
992
|
-
|
|
927
|
+
};
|
|
993
928
|
|
|
994
|
-
|
|
929
|
+
//----------------------------------------------------------------------------
|
|
930
|
+
publicAPI.getNumberOfAvailableColors = () => {
|
|
995
931
|
if (model.indexedLookup && publicAPI.getSize()) {
|
|
996
932
|
return publicAPI.getSize();
|
|
997
933
|
}
|
|
998
|
-
|
|
999
934
|
if (model.tableSize) {
|
|
1000
935
|
// Not sure if this is correct since it is only set if
|
|
1001
936
|
// "const unsigned char *::GetTable(double xStart, double xEnd,int size)"
|
|
1002
937
|
// has been called.
|
|
1003
938
|
return model.tableSize;
|
|
1004
939
|
}
|
|
1005
|
-
|
|
1006
940
|
return 16777216; // 2^24
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
publicAPI.getIndexedColor = function (idx, rgba) {
|
|
1011
|
-
var n = publicAPI.getSize();
|
|
941
|
+
};
|
|
1012
942
|
|
|
943
|
+
//----------------------------------------------------------------------------
|
|
944
|
+
publicAPI.getIndexedColor = (idx, rgba) => {
|
|
945
|
+
const n = publicAPI.getSize();
|
|
1013
946
|
if (n > 0 && idx >= 0) {
|
|
1014
|
-
|
|
947
|
+
const nodeValue = [];
|
|
1015
948
|
publicAPI.getNodeValue(idx % n, nodeValue);
|
|
1016
|
-
|
|
1017
|
-
for (var j = 0; j < 3; ++j) {
|
|
949
|
+
for (let j = 0; j < 3; ++j) {
|
|
1018
950
|
rgba[j] = nodeValue[j + 1];
|
|
1019
951
|
}
|
|
1020
|
-
|
|
1021
952
|
rgba[3] = 1.0; // NodeColor is RGB-only.
|
|
1022
|
-
|
|
1023
953
|
return;
|
|
1024
954
|
}
|
|
1025
|
-
|
|
1026
|
-
var nanColor = publicAPI.getNanColorByReference();
|
|
955
|
+
const nanColor = publicAPI.getNanColorByReference();
|
|
1027
956
|
rgba[0] = nanColor[0];
|
|
1028
957
|
rgba[1] = nanColor[1];
|
|
1029
958
|
rgba[2] = nanColor[2];
|
|
1030
959
|
rgba[3] = 1.0; // NanColor is RGB-only.
|
|
1031
|
-
};
|
|
1032
|
-
|
|
960
|
+
};
|
|
1033
961
|
|
|
1034
|
-
|
|
962
|
+
//----------------------------------------------------------------------------
|
|
963
|
+
publicAPI.fillFromDataPointer = (nb, ptr) => {
|
|
1035
964
|
if (nb <= 0 || !ptr) {
|
|
1036
965
|
return;
|
|
1037
966
|
}
|
|
1038
|
-
|
|
1039
967
|
publicAPI.removeAllPoints();
|
|
1040
|
-
|
|
1041
|
-
for (var i = 0; i < nb; i++) {
|
|
968
|
+
for (let i = 0; i < nb; i++) {
|
|
1042
969
|
publicAPI.addRGBPoint(ptr[i * 4], ptr[i * 4 + 1], ptr[i * 4 + 2], ptr[i * 4 + 3]);
|
|
1043
970
|
}
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
publicAPI.setMappingRange = function (min, max) {
|
|
1048
|
-
var range = [min, max];
|
|
1049
|
-
var originalRange = publicAPI.getRange();
|
|
971
|
+
};
|
|
1050
972
|
|
|
973
|
+
//----------------------------------------------------------------------------
|
|
974
|
+
publicAPI.setMappingRange = (min, max) => {
|
|
975
|
+
const range = [min, max];
|
|
976
|
+
const originalRange = publicAPI.getRange();
|
|
1051
977
|
if (originalRange[1] === range[1] && originalRange[0] === range[0]) {
|
|
1052
978
|
return;
|
|
1053
979
|
}
|
|
1054
|
-
|
|
1055
980
|
if (range[1] === range[0]) {
|
|
1056
981
|
vtkErrorMacro('attempt to set zero width color range');
|
|
1057
982
|
return;
|
|
1058
983
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
for (var i = 0; i < model.nodes.length; ++i) {
|
|
984
|
+
const scale = (range[1] - range[0]) / (originalRange[1] - originalRange[0]);
|
|
985
|
+
const shift = range[0] - originalRange[0] * scale;
|
|
986
|
+
for (let i = 0; i < model.nodes.length; ++i) {
|
|
1064
987
|
model.nodes[i].x = model.nodes[i].x * scale + shift;
|
|
1065
988
|
}
|
|
1066
|
-
|
|
1067
989
|
model.mappingRange[0] = range[0];
|
|
1068
990
|
model.mappingRange[1] = range[1];
|
|
1069
991
|
publicAPI.modified();
|
|
1070
|
-
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
publicAPI.adjustRange = function (range) {
|
|
1074
|
-
var functionRange = publicAPI.getRange(); // Make sure we have points at each end of the range
|
|
992
|
+
};
|
|
1075
993
|
|
|
1076
|
-
|
|
994
|
+
//----------------------------------------------------------------------------
|
|
995
|
+
publicAPI.adjustRange = range => {
|
|
996
|
+
const functionRange = publicAPI.getRange();
|
|
1077
997
|
|
|
998
|
+
// Make sure we have points at each end of the range
|
|
999
|
+
const rgb = [];
|
|
1078
1000
|
if (functionRange[0] < range[0]) {
|
|
1079
1001
|
publicAPI.getColor(range[0], rgb);
|
|
1080
1002
|
publicAPI.addRGBPoint(range[0], rgb[0], rgb[1], rgb[2]);
|
|
@@ -1082,84 +1004,73 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
1082
1004
|
publicAPI.getColor(functionRange[0], rgb);
|
|
1083
1005
|
publicAPI.addRGBPoint(range[0], rgb[0], rgb[1], rgb[2]);
|
|
1084
1006
|
}
|
|
1085
|
-
|
|
1086
1007
|
if (functionRange[1] > range[1]) {
|
|
1087
1008
|
publicAPI.getColor(range[1], rgb);
|
|
1088
1009
|
publicAPI.addRGBPoint(range[1], rgb[0], rgb[1], rgb[2]);
|
|
1089
1010
|
} else {
|
|
1090
1011
|
publicAPI.getColor(functionRange[1], rgb);
|
|
1091
1012
|
publicAPI.addRGBPoint(range[1], rgb[0], rgb[1], rgb[2]);
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1013
|
+
}
|
|
1094
1014
|
|
|
1015
|
+
// Remove all points out-of-range
|
|
1095
1016
|
publicAPI.sortAndUpdateRange();
|
|
1096
|
-
|
|
1097
|
-
for (var i = 0; i < model.nodes.length;) {
|
|
1017
|
+
for (let i = 0; i < model.nodes.length;) {
|
|
1098
1018
|
if (model.nodes[i].x >= range[0] && model.nodes[i].x <= range[1]) {
|
|
1099
1019
|
model.nodes.splice(i, 1);
|
|
1100
1020
|
} else {
|
|
1101
1021
|
++i;
|
|
1102
1022
|
}
|
|
1103
1023
|
}
|
|
1104
|
-
|
|
1105
1024
|
return 1;
|
|
1106
|
-
};
|
|
1107
|
-
|
|
1025
|
+
};
|
|
1108
1026
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1027
|
+
//--------------------------------------------------------------------------
|
|
1028
|
+
publicAPI.estimateMinNumberOfSamples = (x1, x2) => {
|
|
1029
|
+
const d = publicAPI.findMinimumXDistance();
|
|
1111
1030
|
return Math.ceil((x2 - x1) / d);
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1031
|
+
};
|
|
1114
1032
|
|
|
1115
|
-
|
|
1033
|
+
//----------------------------------------------------------------------------
|
|
1034
|
+
publicAPI.findMinimumXDistance = () => {
|
|
1116
1035
|
if (model.nodes.length < 2) {
|
|
1117
1036
|
return -1.0;
|
|
1118
1037
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
for (var i = 0; i < model.nodes.length - 1; i++) {
|
|
1123
|
-
var currentDist = model.nodes[i + 1].x - model.nodes[i].x;
|
|
1124
|
-
|
|
1038
|
+
let distance = Number.MAX_VALUE;
|
|
1039
|
+
for (let i = 0; i < model.nodes.length - 1; i++) {
|
|
1040
|
+
const currentDist = model.nodes[i + 1].x - model.nodes[i].x;
|
|
1125
1041
|
if (currentDist < distance) {
|
|
1126
1042
|
distance = currentDist;
|
|
1127
1043
|
}
|
|
1128
1044
|
}
|
|
1129
|
-
|
|
1130
1045
|
return distance;
|
|
1131
1046
|
};
|
|
1132
|
-
|
|
1133
|
-
publicAPI.mapScalarsThroughTable = function (input, output, outFormat, inputOffset) {
|
|
1047
|
+
publicAPI.mapScalarsThroughTable = (input, output, outFormat, inputOffset) => {
|
|
1134
1048
|
if (publicAPI.getSize() === 0) {
|
|
1135
1049
|
vtkDebugMacro('Transfer Function Has No Points!');
|
|
1136
1050
|
return;
|
|
1137
1051
|
}
|
|
1138
|
-
|
|
1139
1052
|
if (model.indexedLookup) {
|
|
1140
1053
|
publicAPI.mapDataIndexed(input, output, outFormat, inputOffset);
|
|
1141
1054
|
} else {
|
|
1142
1055
|
publicAPI.mapData(input, output, outFormat, inputOffset);
|
|
1143
1056
|
}
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1057
|
+
};
|
|
1146
1058
|
|
|
1147
|
-
|
|
1059
|
+
//----------------------------------------------------------------------------
|
|
1060
|
+
publicAPI.mapData = (input, output, outFormat, inputOffset) => {
|
|
1148
1061
|
if (publicAPI.getSize() === 0) {
|
|
1149
1062
|
vtkWarningMacro('Transfer Function Has No Points!');
|
|
1150
1063
|
return;
|
|
1151
1064
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
var rgb = [];
|
|
1159
|
-
|
|
1065
|
+
const alpha = Math.floor(publicAPI.getAlpha() * 255.0 + 0.5);
|
|
1066
|
+
const length = input.getNumberOfTuples();
|
|
1067
|
+
const inIncr = input.getNumberOfComponents();
|
|
1068
|
+
const outputV = output.getData();
|
|
1069
|
+
const inputV = input.getData();
|
|
1070
|
+
const rgb = [];
|
|
1160
1071
|
if (outFormat === ScalarMappingTarget.RGBA) {
|
|
1161
|
-
for (
|
|
1162
|
-
|
|
1072
|
+
for (let i = 0; i < length; i++) {
|
|
1073
|
+
const x = inputV[i * inIncr + inputOffset];
|
|
1163
1074
|
publicAPI.getColor(x, rgb);
|
|
1164
1075
|
outputV[i * 4] = Math.floor(rgb[0] * 255.0 + 0.5);
|
|
1165
1076
|
outputV[i * 4 + 1] = Math.floor(rgb[1] * 255.0 + 0.5);
|
|
@@ -1167,91 +1078,80 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
1167
1078
|
outputV[i * 4 + 3] = alpha;
|
|
1168
1079
|
}
|
|
1169
1080
|
}
|
|
1170
|
-
|
|
1171
1081
|
if (outFormat === ScalarMappingTarget.RGB) {
|
|
1172
|
-
for (
|
|
1173
|
-
|
|
1174
|
-
publicAPI.getColor(
|
|
1175
|
-
outputV[
|
|
1176
|
-
outputV[
|
|
1177
|
-
outputV[
|
|
1082
|
+
for (let i = 0; i < length; i++) {
|
|
1083
|
+
const x = inputV[i * inIncr + inputOffset];
|
|
1084
|
+
publicAPI.getColor(x, rgb);
|
|
1085
|
+
outputV[i * 3] = Math.floor(rgb[0] * 255.0 + 0.5);
|
|
1086
|
+
outputV[i * 3 + 1] = Math.floor(rgb[1] * 255.0 + 0.5);
|
|
1087
|
+
outputV[i * 3 + 2] = Math.floor(rgb[2] * 255.0 + 0.5);
|
|
1178
1088
|
}
|
|
1179
1089
|
}
|
|
1180
|
-
|
|
1181
1090
|
if (outFormat === ScalarMappingTarget.LUMINANCE) {
|
|
1182
|
-
for (
|
|
1183
|
-
|
|
1184
|
-
publicAPI.getColor(
|
|
1185
|
-
outputV[
|
|
1091
|
+
for (let i = 0; i < length; i++) {
|
|
1092
|
+
const x = inputV[i * inIncr + inputOffset];
|
|
1093
|
+
publicAPI.getColor(x, rgb);
|
|
1094
|
+
outputV[i] = Math.floor(rgb[0] * 76.5 + rgb[1] * 150.45 + rgb[2] * 28.05 + 0.5);
|
|
1186
1095
|
}
|
|
1187
1096
|
}
|
|
1188
|
-
|
|
1189
1097
|
if (outFormat === ScalarMappingTarget.LUMINANCE_ALPHA) {
|
|
1190
|
-
for (
|
|
1191
|
-
|
|
1192
|
-
publicAPI.getColor(
|
|
1193
|
-
outputV[
|
|
1194
|
-
outputV[
|
|
1098
|
+
for (let i = 0; i < length; i++) {
|
|
1099
|
+
const x = inputV[i * inIncr + inputOffset];
|
|
1100
|
+
publicAPI.getColor(x, rgb);
|
|
1101
|
+
outputV[i * 2] = Math.floor(rgb[0] * 76.5 + rgb[1] * 150.45 + rgb[2] * 28.05 + 0.5);
|
|
1102
|
+
outputV[i * 2 + 1] = alpha;
|
|
1195
1103
|
}
|
|
1196
1104
|
}
|
|
1197
|
-
};
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
publicAPI.applyColorMap = function (colorMap) {
|
|
1201
|
-
var oldColorSpace = JSON.stringify(model.colorSpace);
|
|
1105
|
+
};
|
|
1202
1106
|
|
|
1107
|
+
//----------------------------------------------------------------------------
|
|
1108
|
+
publicAPI.applyColorMap = colorMap => {
|
|
1109
|
+
const oldColorSpace = JSON.stringify(model.colorSpace);
|
|
1203
1110
|
if (colorMap.ColorSpace) {
|
|
1204
1111
|
model.colorSpace = ColorSpace[colorMap.ColorSpace.toUpperCase()];
|
|
1205
|
-
|
|
1206
1112
|
if (model.colorSpace === undefined) {
|
|
1207
|
-
vtkErrorMacro(
|
|
1113
|
+
vtkErrorMacro(`ColorSpace ${colorMap.ColorSpace} not supported, using RGB instead`);
|
|
1208
1114
|
model.colorSpace = ColorSpace.RGB;
|
|
1209
1115
|
}
|
|
1210
1116
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
var oldNanColor = isModified || JSON.stringify(model.nanColor);
|
|
1214
|
-
|
|
1117
|
+
let isModified = oldColorSpace !== JSON.stringify(model.colorSpace);
|
|
1118
|
+
const oldNanColor = isModified || JSON.stringify(model.nanColor);
|
|
1215
1119
|
if (colorMap.NanColor) {
|
|
1216
1120
|
model.nanColor = [].concat(colorMap.NanColor);
|
|
1217
|
-
|
|
1218
1121
|
while (model.nanColor.length < 4) {
|
|
1219
1122
|
model.nanColor.push(1.0);
|
|
1220
1123
|
}
|
|
1221
1124
|
}
|
|
1222
|
-
|
|
1223
1125
|
isModified = isModified || oldNanColor !== JSON.stringify(model.nanColor);
|
|
1224
|
-
|
|
1225
|
-
|
|
1126
|
+
const oldNodes = isModified || JSON.stringify(model.nodes);
|
|
1226
1127
|
if (colorMap.RGBPoints) {
|
|
1227
|
-
|
|
1128
|
+
const size = colorMap.RGBPoints.length;
|
|
1228
1129
|
model.nodes = [];
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
for (var i = 0; i < size; i += 4) {
|
|
1130
|
+
const midpoint = 0.5;
|
|
1131
|
+
const sharpness = 0.0;
|
|
1132
|
+
for (let i = 0; i < size; i += 4) {
|
|
1233
1133
|
model.nodes.push({
|
|
1234
1134
|
x: colorMap.RGBPoints[i],
|
|
1235
1135
|
r: colorMap.RGBPoints[i + 1],
|
|
1236
1136
|
g: colorMap.RGBPoints[i + 2],
|
|
1237
1137
|
b: colorMap.RGBPoints[i + 3],
|
|
1238
|
-
midpoint
|
|
1239
|
-
sharpness
|
|
1138
|
+
midpoint,
|
|
1139
|
+
sharpness
|
|
1240
1140
|
});
|
|
1241
1141
|
}
|
|
1242
1142
|
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
var callModified = !modifiedInvoked && (isModified || oldNodes !== JSON.stringify(model.nodes));
|
|
1143
|
+
const modifiedInvoked = publicAPI.sortAndUpdateRange();
|
|
1144
|
+
const callModified = !modifiedInvoked && (isModified || oldNodes !== JSON.stringify(model.nodes));
|
|
1246
1145
|
if (callModified) publicAPI.modified();
|
|
1247
1146
|
return modifiedInvoked || callModified;
|
|
1248
1147
|
};
|
|
1249
|
-
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
// ----------------------------------------------------------------------------
|
|
1250
1151
|
// Object factory
|
|
1251
1152
|
// ----------------------------------------------------------------------------
|
|
1252
1153
|
|
|
1253
|
-
|
|
1254
|
-
var DEFAULT_VALUES = {
|
|
1154
|
+
const DEFAULT_VALUES = {
|
|
1255
1155
|
clamping: true,
|
|
1256
1156
|
colorSpace: ColorSpace.RGB,
|
|
1257
1157
|
hSVWrap: true,
|
|
@@ -1268,38 +1168,52 @@ var DEFAULT_VALUES = {
|
|
|
1268
1168
|
nodes: null,
|
|
1269
1169
|
discretize: false,
|
|
1270
1170
|
numberOfValues: 256
|
|
1271
|
-
};
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// ----------------------------------------------------------------------------
|
|
1272
1174
|
|
|
1273
1175
|
function extend(publicAPI, model) {
|
|
1274
|
-
|
|
1275
|
-
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
1176
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1177
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
1276
1178
|
|
|
1277
|
-
|
|
1179
|
+
// Inheritance
|
|
1180
|
+
vtkScalarsToColors.extend(publicAPI, model, initialValues);
|
|
1278
1181
|
|
|
1182
|
+
// Internal objects initialization
|
|
1279
1183
|
model.table = [];
|
|
1280
1184
|
model.nodes = [];
|
|
1281
1185
|
model.nanColor = [0.5, 0.0, 0.0, 1.0];
|
|
1282
1186
|
model.belowRangeColor = [0.0, 0.0, 0.0, 1.0];
|
|
1283
1187
|
model.aboveRangeColor = [1.0, 1.0, 1.0, 1.0];
|
|
1284
1188
|
model.buildTime = {};
|
|
1285
|
-
macro.obj(model.buildTime);
|
|
1189
|
+
macro.obj(model.buildTime);
|
|
1286
1190
|
|
|
1287
|
-
|
|
1191
|
+
// Create get-only macros
|
|
1192
|
+
macro.get(publicAPI, model, ['buildTime', 'mappingRange']);
|
|
1288
1193
|
|
|
1194
|
+
// Create get-set macros
|
|
1289
1195
|
macro.setGet(publicAPI, model, ['useAboveRangeColor', 'useBelowRangeColor', 'colorSpace', 'discretize', 'numberOfValues']);
|
|
1290
|
-
macro.setArray(publicAPI, model, ['nanColor', 'belowRangeColor', 'aboveRangeColor'], 4);
|
|
1196
|
+
macro.setArray(publicAPI, model, ['nanColor', 'belowRangeColor', 'aboveRangeColor'], 4);
|
|
1291
1197
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1198
|
+
// Create get macros for array
|
|
1199
|
+
macro.getArray(publicAPI, model, ['nanColor', 'belowRangeColor', 'aboveRangeColor']);
|
|
1200
|
+
|
|
1201
|
+
// For more macro methods, see "Sources/macros.js"
|
|
1294
1202
|
|
|
1203
|
+
// Object specific methods
|
|
1295
1204
|
vtkColorTransferFunction(publicAPI, model);
|
|
1296
|
-
}
|
|
1205
|
+
}
|
|
1297
1206
|
|
|
1298
|
-
|
|
1207
|
+
// ----------------------------------------------------------------------------
|
|
1208
|
+
|
|
1209
|
+
const newInstance = macro.newInstance(extend, 'vtkColorTransferFunction');
|
|
1210
|
+
|
|
1211
|
+
// ----------------------------------------------------------------------------
|
|
1299
1212
|
|
|
1300
|
-
var vtkColorTransferFunction$1 =
|
|
1301
|
-
newInstance
|
|
1302
|
-
extend
|
|
1303
|
-
|
|
1213
|
+
var vtkColorTransferFunction$1 = {
|
|
1214
|
+
newInstance,
|
|
1215
|
+
extend,
|
|
1216
|
+
...Constants
|
|
1217
|
+
};
|
|
1304
1218
|
|
|
1305
1219
|
export { vtkColorTransferFunction$1 as default, extend, newInstance };
|