@kitware/vtk.js 21.6.1 → 22.1.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.
- package/Common/Core/CellArray.js +2 -2
- package/Common/Core/DataArray.js +2 -2
- package/Common/Core/MatrixBuilder.d.ts +1 -1
- package/Common/Core/ScalarsToColors.js +12 -11
- package/Common/DataModel/BoundingBox.js +2 -2
- package/Common/DataModel/Box.js +2 -2
- package/Common/DataModel/CellTypes.js +2 -2
- package/Common/DataModel/Cylinder.js +2 -2
- package/Common/DataModel/DataSet.js +2 -2
- package/Common/DataModel/DataSetAttributes.js +2 -2
- package/Common/DataModel/ImplicitBoolean.js +2 -2
- package/Common/DataModel/Line.js +2 -2
- package/Common/DataModel/PiecewiseFunction.js +3 -3
- package/Common/DataModel/Plane.js +2 -2
- package/Common/DataModel/SelectionNode.js +2 -2
- package/Common/DataModel/Sphere.js +2 -2
- package/Common/DataModel/StructuredData.js +2 -2
- package/Common/DataModel/Triangle.js +2 -2
- package/Common/Transform/LandmarkTransform.js +2 -2
- package/Filters/Core/Cutter.js +2 -2
- package/Filters/General/Calculator.js +2 -2
- package/Filters/Sources/Arrow2DSource.js +2 -2
- package/Filters/Sources/CircleSource.js +2 -2
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +6 -12
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +11 -19
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +8 -15
- package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +11 -19
- package/IO/Core/HttpSceneLoader.js +2 -2
- package/IO/Core/ImageStream/DefaultProtocol.js +2 -6
- package/IO/Geometry/PLYWriter/Constants.js +19 -0
- package/IO/Geometry/PLYWriter.d.ts +203 -0
- package/IO/Geometry/PLYWriter.js +323 -0
- package/IO/Geometry/STLWriter.js +2 -2
- package/IO/Geometry.js +3 -1
- package/IO/XML/XMLImageDataWriter.js +2 -2
- package/IO/XML/XMLPolyDataWriter.js +2 -2
- package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +2 -2
- package/Imaging/Core/AbstractImageInterpolator.js +2 -2
- package/Imaging/Core/ImageInterpolator.js +12 -12
- package/Imaging/Core/ImageReslice.js +10 -10
- package/Imaging/Hybrid/SampleFunction.js +2 -2
- package/Interaction/Animations/TimeStepBasedAnimationHandler.js +2 -2
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +2 -2
- package/Interaction/Style/InteractorStyleManipulator.js +2 -2
- package/Interaction/Style/InteractorStyleRemoteMouse.js +2 -2
- package/Interaction/UI/FPSMonitor.js +2 -2
- package/Interaction/UI/Slider.js +2 -2
- package/Interaction/Widgets/AbstractWidget.js +2 -2
- package/Interaction/Widgets/DistanceRepresentation.js +2 -2
- package/Interaction/Widgets/DistanceWidget.js +2 -2
- package/Interaction/Widgets/HandleRepresentation.js +2 -2
- package/Interaction/Widgets/HandleWidget.js +2 -2
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +2 -2
- package/Interaction/Widgets/LabelRepresentation.js +2 -2
- package/Interaction/Widgets/LabelWidget.js +2 -2
- package/Interaction/Widgets/LineRepresentation.js +2 -2
- package/Interaction/Widgets/LineWidget.js +2 -2
- package/Interaction/Widgets/OrientationMarkerWidget.js +2 -2
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +2 -2
- package/Interaction/Widgets/SphereHandleRepresentation.js +2 -2
- package/Proxy/Core/PiecewiseFunctionProxy.js +2 -2
- package/Proxy/Core/ProxyManager/core.js +2 -2
- package/Proxy/Core/ProxyManager/properties.js +2 -2
- package/Proxy/Core/ProxyManager/state.js +2 -2
- package/Proxy/Representations/SliceRepresentationProxy.js +2 -2
- package/Rendering/Core/AbstractMapper.d.ts +4 -4
- package/Rendering/Core/AbstractMapper.js +18 -7
- package/Rendering/Core/Actor.js +2 -2
- package/Rendering/Core/AnnotatedCubeActor.js +2 -2
- package/Rendering/Core/AxesActor.js +2 -2
- package/Rendering/Core/CellPicker.js +2 -2
- package/Rendering/Core/ColorTransferFunction.js +2 -2
- package/Rendering/Core/Coordinate.js +2 -2
- package/Rendering/Core/CubeAxesActor.js +2 -2
- package/Rendering/Core/Follower.js +2 -2
- package/Rendering/Core/Glyph3DMapper.js +2 -2
- package/Rendering/Core/ImageMapper.js +2 -2
- package/Rendering/Core/InteractorObserver.js +2 -2
- package/Rendering/Core/InteractorStyle.js +2 -2
- package/Rendering/Core/Mapper.js +2 -2
- package/Rendering/Core/Picker.js +2 -2
- package/Rendering/Core/Property.js +2 -2
- package/Rendering/Core/RenderWindowInteractor.js +36 -14
- package/Rendering/Core/ScalarBarActor.js +2 -2
- package/Rendering/Core/VolumeMapper.js +1 -4
- package/Rendering/Core/VolumeProperty.js +2 -2
- package/Rendering/Core.js +2 -2
- package/Rendering/Misc/RenderWindowWithControlBar.js +2 -2
- package/Rendering/Misc/SynchronizableRenderWindow/vtkObjectManager.js +2 -2
- package/Rendering/Misc/SynchronizableRenderWindow.js +2 -2
- package/Rendering/OpenGL/BufferObject.js +5 -5
- package/Rendering/OpenGL/CellArrayBufferObject.js +2 -1
- package/Rendering/OpenGL/Glyph3DMapper.js +2 -2
- package/Rendering/OpenGL/HardwareSelector.js +2 -2
- package/Rendering/OpenGL/RenderWindow.js +1 -1
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +2 -2
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +2 -2
- package/Rendering/OpenGL/Texture.js +2 -2
- package/Rendering/OpenGL/VolumeMapper.js +11 -18
- package/Rendering/WebGPU/Buffer.js +2 -2
- package/Rendering/WebGPU/BufferManager.js +2 -2
- package/Rendering/WebGPU/Glyph3DMapper.js +2 -2
- package/Rendering/WebGPU/HardwareSelector.js +1 -1
- package/Rendering/WebGPU/MapperHelper.js +2 -1
- package/Rendering/WebGPU/PolyDataMapper.js +1 -1
- package/Rendering/WebGPU/TextureManager.js +1 -1
- package/Rendering/WebGPU/VolumePass.js +366 -64
- package/Rendering/WebGPU/VolumePassFSQ.js +5 -2
- package/Widgets/Core/AbstractWidgetFactory.js +2 -2
- package/Widgets/Representations/ArrowHandleRepresentation.js +2 -2
- package/Widgets/Representations/ContextRepresentation.js +2 -2
- package/Widgets/Representations/HandleRepresentation.js +2 -2
- package/Widgets/Representations/PolyLineRepresentation.js +2 -2
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +2 -2
- package/Widgets/SVG/SVGLandmarkRepresentation.js +2 -2
- package/Widgets/Widgets3D/EllipseWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/EllipseWidget.js +2 -2
- package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/LineWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/RectangleWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/RectangleWidget.js +2 -2
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/ShapeWidget.js +2 -2
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +44 -44
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/macros.js +16 -32
- package/package.json +52 -54
- package/vtk.js +2 -2
- package/Utilities/config/rules-linter.js +0 -13
|
@@ -9,7 +9,7 @@ import vtkWebGPUSampler from './Sampler.js';
|
|
|
9
9
|
import vtkWebGPUTypes from './Types.js';
|
|
10
10
|
import { BlendMode } from '../Core/VolumeMapper/Constants.js';
|
|
11
11
|
|
|
12
|
-
var volFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d<f32>, tpos: vec4<f32>) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d<f32>, tpos: vec4<f32>, vNum: i32, scalar: f32) -> vec4<f32>\n{\n var result: vec4<f32>;\n\n var tstep: vec4<f32> = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4<f32>(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4<f32>(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4<f32>(0.0, 0.0, tstep.z, 1.0)) - scalar;\n\n // divide by spacing\n result = result / volumeSSBO.values[vNum].spacing;\n\n var grad: f32 = length(result.xyz);\n\n // // rotate to View Coords, needed for lighting and shading\n // result.xyz =\n // result.x * vPlaneNormal0 +\n // result.y * vPlaneNormal2 +\n // result.z * vPlaneNormal4;\n\n if (grad > 0.0)\n {\n result = result * (1.0 / grad);\n }\n\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d<f32>, vNum: i32, cNum: i32, posSC: vec4<f32>, tfunRows: f32) -> vec4<f32>\n{\n var outColor: vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2<f32> =\n vec2<f32>(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4<f32> = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n var normal: vec4<f32> = getGradient(vTex, tpos, vNum, scalar);\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n outColor = vec4<f32>(color.rgb, gofactor * opacity);\n\n//VTK::Volume::Process\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4<f32>, tstep: vec4<f32>, numSteps: f32) -> vec2<f32>\n{\n var result: vec2<f32> = vec2<f32>(0.0, numSteps);\n var tpos2: vec4<f32> = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4<f32>\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2<f32> =\n vec2<f32>(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4<f32> = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4<f32>(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4<f32> = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4<f32> = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>) -> vec4<f32>\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4<f32> = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4<f32>;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n[[stage(fragment)]]\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n var winDimsI32: vec2<i32> = textureDimensions(minTexture);\n var winDims: vec2<f32> = vec2<f32>(f32(winDimsI32.x), f32(winDimsI32.y));\n\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4<f32> = rendererUBO.PCSCMatrix*vec4<f32>(2.0*input.fragPos.x/winDims.x - 1.0, 1.0 - 2.0 * input.fragPos.y/winDims.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4<f32> = rendererUBO.PCSCMatrix*vec4<f32>(2.0*input.fragPos.x/winDims.x - 1.0, 1.0 - 2.0 * input.fragPos.y/winDims.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4<f32> = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4<f32>;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n";
|
|
12
|
+
var volFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d<f32>, tpos: vec4<f32>) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d<f32>, tpos: vec4<f32>, vNum: i32, scalar: f32) -> vec4<f32>\n{\n var result: vec4<f32>;\n\n var tstep: vec4<f32> = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4<f32>(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4<f32>(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4<f32>(0.0, 0.0, tstep.z, 1.0)) - scalar;\n\n // divide by spacing\n result = result / volumeSSBO.values[vNum].spacing;\n\n var grad: f32 = length(result.xyz);\n\n // // rotate to View Coords, needed for lighting and shading\n // result.xyz =\n // result.x * vPlaneNormal0 +\n // result.y * vPlaneNormal2 +\n // result.z * vPlaneNormal4;\n\n if (grad > 0.0)\n {\n result = result * (1.0 / grad);\n }\n\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d<f32>, vNum: i32, cNum: i32, posSC: vec4<f32>, tfunRows: f32) -> vec4<f32>\n{\n var outColor: vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2<f32> =\n vec2<f32>(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4<f32> = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n var normal: vec4<f32> = getGradient(vTex, tpos, vNum, scalar);\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n outColor = vec4<f32>(color.rgb, gofactor * opacity);\n\n//VTK::Volume::Process\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4<f32>, tstep: vec4<f32>, numSteps: f32) -> vec2<f32>\n{\n var result: vec2<f32> = vec2<f32>(0.0, numSteps);\n var tpos2: vec4<f32> = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4<f32>\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2<f32> =\n vec2<f32>(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4<f32> = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4<f32>(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4<f32> = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4<f32> = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>) -> vec4<f32>\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4<f32> = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4<f32>;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n[[stage(fragment)]]\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4<f32> = rendererUBO.PCSCMatrix*vec4<f32>(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4<f32> = rendererUBO.PCSCMatrix*vec4<f32>(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4<f32> = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4<f32>;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n";
|
|
13
13
|
var tmpMat4 = new Float64Array(16);
|
|
14
14
|
var tmp2Mat4 = new Float64Array(16); // ----------------------------------------------------------------------------
|
|
15
15
|
// vtkWebGPUVolumePassFSQ methods
|
|
@@ -454,7 +454,10 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
454
454
|
|
|
455
455
|
|
|
456
456
|
if (model.volumes.length < model.lastVolumeLength) {
|
|
457
|
-
|
|
457
|
+
// we may have gaps in the array right now so no splice
|
|
458
|
+
for (var _i3 = model.volumes.length; _i3 < model.lastVolumeLength; _i3++) {
|
|
459
|
+
model.textureViews.pop();
|
|
460
|
+
}
|
|
458
461
|
}
|
|
459
462
|
|
|
460
463
|
model.lastVolumeLength = model.volumes.length;
|
|
@@ -4,9 +4,9 @@ import macro from '../../macros.js';
|
|
|
4
4
|
import vtkAbstractWidget from './AbstractWidget.js';
|
|
5
5
|
import { extractRenderingComponents } from './WidgetManager.js';
|
|
6
6
|
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
7
|
+
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; }
|
|
8
8
|
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
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; }
|
|
10
10
|
|
|
11
11
|
function NoOp() {} // ----------------------------------------------------------------------------
|
|
12
12
|
|
|
@@ -18,9 +18,9 @@ import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
|
18
18
|
import { mat4, mat3, vec3 } from 'gl-matrix';
|
|
19
19
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
20
20
|
|
|
21
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
21
|
+
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; }
|
|
22
22
|
|
|
23
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
23
|
+
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; }
|
|
24
24
|
var ShapeType = Constants.ShapeType,
|
|
25
25
|
Shapes2D = Constants.Shapes2D,
|
|
26
26
|
ShapesOrientable = Constants.ShapesOrientable; // ----------------------------------------------------------------------------
|
|
@@ -2,9 +2,9 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
3
3
|
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
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; }
|
|
6
6
|
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
7
|
+
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; }
|
|
8
8
|
// vtkWidgetRepresentation
|
|
9
9
|
// ----------------------------------------------------------------------------
|
|
10
10
|
|
|
@@ -3,9 +3,9 @@ import macro from '../../macros.js';
|
|
|
3
3
|
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
4
4
|
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
5
5
|
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
+
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; }
|
|
7
7
|
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
8
|
+
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; }
|
|
9
9
|
// vtkHandleRepresentation methods
|
|
10
10
|
// ----------------------------------------------------------------------------
|
|
11
11
|
|
|
@@ -9,9 +9,9 @@ import vtkTubeFilter from '../../Filters/General/TubeFilter.js';
|
|
|
9
9
|
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
10
10
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
11
11
|
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
12
|
+
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; }
|
|
13
13
|
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
14
|
+
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; }
|
|
15
15
|
// vtkPolyLineRepresentation methods
|
|
16
16
|
// ----------------------------------------------------------------------------
|
|
17
17
|
|
|
@@ -11,9 +11,9 @@ import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
|
11
11
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
12
12
|
import { InteractionMethodsName } from '../Widgets3D/ResliceCursorWidget/Constants.js';
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
14
|
+
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
15
|
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
16
|
+
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; }
|
|
17
17
|
// vtkResliceCursorContextRepresentation methods
|
|
18
18
|
// ----------------------------------------------------------------------------
|
|
19
19
|
|
|
@@ -3,9 +3,9 @@ import macro from '../../macros.js';
|
|
|
3
3
|
import vtkSVGRepresentation from './SVGRepresentation.js';
|
|
4
4
|
import { fontSizeToPixels, VerticalTextAlignment } from './SVGLandmarkRepresentation/Constants.js';
|
|
5
5
|
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
+
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; }
|
|
7
7
|
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
8
|
+
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; }
|
|
9
9
|
var createSvgElement = vtkSVGRepresentation.createSvgElement; // ----------------------------------------------------------------------------
|
|
10
10
|
// vtkSVGLandmarkRepresentation
|
|
11
11
|
// ----------------------------------------------------------------------------
|
|
@@ -2,9 +2,9 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import widgetBehavior$1 from '../ShapeWidget/behavior.js';
|
|
3
3
|
import { vec3 } from 'gl-matrix';
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
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; }
|
|
6
6
|
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
7
|
+
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; }
|
|
8
8
|
function widgetBehavior(publicAPI, model) {
|
|
9
9
|
model.shapeHandle = model.widgetState.getEllipseHandle();
|
|
10
10
|
model.point1Handle = model.widgetState.getPoint1Handle();
|
|
@@ -11,9 +11,9 @@ import generateState from './EllipseWidget/state.js';
|
|
|
11
11
|
import { BehaviorCategory, ShapeBehavior } from './ShapeWidget/Constants.js';
|
|
12
12
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
14
|
+
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
15
|
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
16
|
+
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; }
|
|
17
17
|
// Factory
|
|
18
18
|
// ----------------------------------------------------------------------------
|
|
19
19
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../../macros.js';
|
|
3
3
|
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
4
|
+
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; }
|
|
5
5
|
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
6
|
+
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; }
|
|
7
7
|
function widgetBehavior(publicAPI, model) {
|
|
8
8
|
model.classHierarchy.push('vtkInteractiveOrientationWidgetProp');
|
|
9
9
|
macro.event(publicAPI, model, 'OrientationChange'); // --------------------------------------------------------------------------
|
|
@@ -5,9 +5,9 @@ import macro from '../../../macros.js';
|
|
|
5
5
|
import { g as subtract, k as add, l as normalize } from '../../../Common/Core/Math/index.js';
|
|
6
6
|
import { getNumberOfPlacedHandles, isHandlePlaced, calculateTextPosition, updateTextPosition, getPoint } from './helpers.js';
|
|
7
7
|
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
8
|
+
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; }
|
|
9
9
|
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
10
|
+
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; }
|
|
11
11
|
var ShapeType = Constants.ShapeType; // Total number of points to place
|
|
12
12
|
|
|
13
13
|
var MAX_POINTS = 2;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import widgetBehavior$1 from '../ShapeWidget/behavior.js';
|
|
3
3
|
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
4
|
+
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; }
|
|
5
5
|
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
6
|
+
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; }
|
|
7
7
|
function widgetBehavior(publicAPI, model) {
|
|
8
8
|
model.shapeHandle = model.widgetState.getRectangleHandle();
|
|
9
9
|
model.point1Handle = model.widgetState.getPoint1Handle();
|
|
@@ -11,9 +11,9 @@ import generateState from './RectangleWidget/state.js';
|
|
|
11
11
|
import { BehaviorCategory, ShapeBehavior } from './ShapeWidget/Constants.js';
|
|
12
12
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
14
|
+
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
15
|
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
16
|
+
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; }
|
|
17
17
|
// Factory
|
|
18
18
|
// ----------------------------------------------------------------------------
|
|
19
19
|
|
|
@@ -8,9 +8,9 @@ import { ShapeBehavior, BehaviorCategory, TextPosition } from './Constants.js';
|
|
|
8
8
|
import { boundPlane } from '../ResliceCursorWidget/helpers.js';
|
|
9
9
|
import { vec3 } from 'gl-matrix';
|
|
10
10
|
|
|
11
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
11
|
+
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; }
|
|
12
12
|
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
13
|
+
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; }
|
|
14
14
|
var vtkErrorMacro = macro.vtkErrorMacro;
|
|
15
15
|
var EPSILON = 1e-6;
|
|
16
16
|
function widgetBehavior(publicAPI, model) {
|
|
@@ -3,9 +3,9 @@ import macro from '../../macros.js';
|
|
|
3
3
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
4
4
|
import { BehaviorCategory, ShapeBehavior } from './ShapeWidget/Constants.js';
|
|
5
5
|
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
+
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; }
|
|
7
7
|
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
8
|
+
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; }
|
|
9
9
|
|
|
10
10
|
function vtkShapeWidget(publicAPI, model) {
|
|
11
11
|
model.classHierarchy.push('vtkShapeWidget');
|
|
@@ -335,9 +335,9 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
335
335
|
Z: 5
|
|
336
336
|
};
|
|
337
337
|
|
|
338
|
-
/**
|
|
339
|
-
* Common utilities
|
|
340
|
-
* @module glMatrix
|
|
338
|
+
/**
|
|
339
|
+
* Common utilities
|
|
340
|
+
* @module glMatrix
|
|
341
341
|
*/
|
|
342
342
|
var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
|
343
343
|
if (!Math.hypot) Math.hypot = function () {
|
|
@@ -351,15 +351,15 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
351
351
|
return Math.sqrt(y);
|
|
352
352
|
};
|
|
353
353
|
|
|
354
|
-
/**
|
|
355
|
-
* 3 Dimensional Vector
|
|
356
|
-
* @module vec3
|
|
354
|
+
/**
|
|
355
|
+
* 3 Dimensional Vector
|
|
356
|
+
* @module vec3
|
|
357
357
|
*/
|
|
358
358
|
|
|
359
|
-
/**
|
|
360
|
-
* Creates a new, empty vec3
|
|
361
|
-
*
|
|
362
|
-
* @returns {vec3} a new 3D vector
|
|
359
|
+
/**
|
|
360
|
+
* Creates a new, empty vec3
|
|
361
|
+
*
|
|
362
|
+
* @returns {vec3} a new 3D vector
|
|
363
363
|
*/
|
|
364
364
|
|
|
365
365
|
function create() {
|
|
@@ -373,13 +373,13 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
373
373
|
|
|
374
374
|
return out;
|
|
375
375
|
}
|
|
376
|
-
/**
|
|
377
|
-
* Subtracts vector b from vector a
|
|
378
|
-
*
|
|
379
|
-
* @param {vec3} out the receiving vector
|
|
380
|
-
* @param {ReadonlyVec3} a the first operand
|
|
381
|
-
* @param {ReadonlyVec3} b the second operand
|
|
382
|
-
* @returns {vec3} out
|
|
376
|
+
/**
|
|
377
|
+
* Subtracts vector b from vector a
|
|
378
|
+
*
|
|
379
|
+
* @param {vec3} out the receiving vector
|
|
380
|
+
* @param {ReadonlyVec3} a the first operand
|
|
381
|
+
* @param {ReadonlyVec3} b the second operand
|
|
382
|
+
* @returns {vec3} out
|
|
383
383
|
*/
|
|
384
384
|
|
|
385
385
|
function subtract(out, a, b) {
|
|
@@ -388,13 +388,13 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
388
388
|
out[2] = a[2] - b[2];
|
|
389
389
|
return out;
|
|
390
390
|
}
|
|
391
|
-
/**
|
|
392
|
-
* Scales a vec3 by a scalar number
|
|
393
|
-
*
|
|
394
|
-
* @param {vec3} out the receiving vector
|
|
395
|
-
* @param {ReadonlyVec3} a the vector to scale
|
|
396
|
-
* @param {Number} b amount to scale the vector by
|
|
397
|
-
* @returns {vec3} out
|
|
391
|
+
/**
|
|
392
|
+
* Scales a vec3 by a scalar number
|
|
393
|
+
*
|
|
394
|
+
* @param {vec3} out the receiving vector
|
|
395
|
+
* @param {ReadonlyVec3} a the vector to scale
|
|
396
|
+
* @param {Number} b amount to scale the vector by
|
|
397
|
+
* @returns {vec3} out
|
|
398
398
|
*/
|
|
399
399
|
|
|
400
400
|
function scale(out, a, b) {
|
|
@@ -403,14 +403,14 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
403
403
|
out[2] = a[2] * b;
|
|
404
404
|
return out;
|
|
405
405
|
}
|
|
406
|
-
/**
|
|
407
|
-
* Adds two vec3's after scaling the second operand by a scalar value
|
|
408
|
-
*
|
|
409
|
-
* @param {vec3} out the receiving vector
|
|
410
|
-
* @param {ReadonlyVec3} a the first operand
|
|
411
|
-
* @param {ReadonlyVec3} b the second operand
|
|
412
|
-
* @param {Number} scale the amount to scale b by before adding
|
|
413
|
-
* @returns {vec3} out
|
|
406
|
+
/**
|
|
407
|
+
* Adds two vec3's after scaling the second operand by a scalar value
|
|
408
|
+
*
|
|
409
|
+
* @param {vec3} out the receiving vector
|
|
410
|
+
* @param {ReadonlyVec3} a the first operand
|
|
411
|
+
* @param {ReadonlyVec3} b the second operand
|
|
412
|
+
* @param {Number} scale the amount to scale b by before adding
|
|
413
|
+
* @returns {vec3} out
|
|
414
414
|
*/
|
|
415
415
|
|
|
416
416
|
function scaleAndAdd(out, a, b, scale) {
|
|
@@ -419,17 +419,17 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
419
419
|
out[2] = a[2] + b[2] * scale;
|
|
420
420
|
return out;
|
|
421
421
|
}
|
|
422
|
-
/**
|
|
423
|
-
* Perform some operation over an array of vec3s.
|
|
424
|
-
*
|
|
425
|
-
* @param {Array} a the array of vectors to iterate over
|
|
426
|
-
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
427
|
-
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
428
|
-
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
429
|
-
* @param {Function} fn Function to call for each vector in the array
|
|
430
|
-
* @param {Object} [arg] additional argument to pass to fn
|
|
431
|
-
* @returns {Array} a
|
|
432
|
-
* @function
|
|
422
|
+
/**
|
|
423
|
+
* Perform some operation over an array of vec3s.
|
|
424
|
+
*
|
|
425
|
+
* @param {Array} a the array of vectors to iterate over
|
|
426
|
+
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
427
|
+
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
428
|
+
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
429
|
+
* @param {Function} fn Function to call for each vector in the array
|
|
430
|
+
* @param {Object} [arg] additional argument to pass to fn
|
|
431
|
+
* @returns {Array} a
|
|
432
|
+
* @function
|
|
433
433
|
*/
|
|
434
434
|
|
|
435
435
|
(function () {
|
|
@@ -695,7 +695,7 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
695
695
|
return response;
|
|
696
696
|
});
|
|
697
697
|
|
|
698
|
-
}()
|
|
698
|
+
})();
|
|
699
699
|
}, null);
|
|
700
700
|
/* eslint-enable */
|
|
701
701
|
|
|
@@ -271,7 +271,7 @@ var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader
|
|
|
271
271
|
return Promise.resolve(new registerWebworker.TransferableResponse(histogram, [histogram.buffer]));
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
-
}()
|
|
274
|
+
})();
|
|
275
275
|
}, null);
|
|
276
276
|
/* eslint-enable */
|
|
277
277
|
|
package/macros.js
CHANGED
|
@@ -6,9 +6,9 @@ import _construct from '@babel/runtime/helpers/construct';
|
|
|
6
6
|
import vtk, { vtkGlobal } from './vtk.js';
|
|
7
7
|
import ClassHierarchy from './Common/Core/ClassHierarchy.js';
|
|
8
8
|
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
9
|
+
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; }
|
|
10
10
|
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
11
|
+
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; }
|
|
12
12
|
var globalMTime = 0;
|
|
13
13
|
var VOID = Symbol('void');
|
|
14
14
|
|
|
@@ -702,12 +702,7 @@ function algo(publicAPI, model, numberOfInputs, numberOfOutputs) {
|
|
|
702
702
|
return model.inputConnection[port];
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
-
function
|
|
706
|
-
if (model.deleted) {
|
|
707
|
-
vtkErrorMacro('instance deleted - cannot call any method');
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
|
|
705
|
+
function getPortToFill() {
|
|
711
706
|
var portToFill = model.numberOfInputs;
|
|
712
707
|
|
|
713
708
|
while (portToFill && !model.inputData[portToFill - 1] && !model.inputConnection[portToFill - 1]) {
|
|
@@ -718,26 +713,25 @@ function algo(publicAPI, model, numberOfInputs, numberOfOutputs) {
|
|
|
718
713
|
model.numberOfInputs++;
|
|
719
714
|
}
|
|
720
715
|
|
|
721
|
-
|
|
716
|
+
return portToFill;
|
|
722
717
|
}
|
|
723
718
|
|
|
724
|
-
function
|
|
719
|
+
function addInputConnection(outputPort) {
|
|
725
720
|
if (model.deleted) {
|
|
726
721
|
vtkErrorMacro('instance deleted - cannot call any method');
|
|
727
722
|
return;
|
|
728
723
|
}
|
|
729
724
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
while (portToFill && !model.inputData[portToFill - 1] && !model.inputConnection[portToFill - 1]) {
|
|
733
|
-
portToFill--;
|
|
734
|
-
}
|
|
725
|
+
setInputConnection(outputPort, getPortToFill());
|
|
726
|
+
}
|
|
735
727
|
|
|
736
|
-
|
|
737
|
-
|
|
728
|
+
function addInputData(dataset) {
|
|
729
|
+
if (model.deleted) {
|
|
730
|
+
vtkErrorMacro('instance deleted - cannot call any method');
|
|
731
|
+
return;
|
|
738
732
|
}
|
|
739
733
|
|
|
740
|
-
setInputData(dataset,
|
|
734
|
+
setInputData(dataset, getPortToFill());
|
|
741
735
|
}
|
|
742
736
|
|
|
743
737
|
function getOutputData() {
|
|
@@ -757,15 +751,11 @@ function algo(publicAPI, model, numberOfInputs, numberOfOutputs) {
|
|
|
757
751
|
|
|
758
752
|
publicAPI.shouldUpdate = function () {
|
|
759
753
|
var localMTime = publicAPI.getMTime();
|
|
760
|
-
var count = numberOfOutputs;
|
|
761
754
|
var minOutputMTime = Infinity;
|
|
755
|
+
var count = numberOfOutputs;
|
|
762
756
|
|
|
763
757
|
while (count--) {
|
|
764
|
-
if (!model.output[count]) {
|
|
765
|
-
return true;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
if (model.output[count].isDeleted()) {
|
|
758
|
+
if (!model.output[count] || model.output[count].isDeleted()) {
|
|
769
759
|
return true;
|
|
770
760
|
}
|
|
771
761
|
|
|
@@ -783,15 +773,9 @@ function algo(publicAPI, model, numberOfInputs, numberOfOutputs) {
|
|
|
783
773
|
count = model.numberOfInputs;
|
|
784
774
|
|
|
785
775
|
while (count--) {
|
|
786
|
-
|
|
787
|
-
return true;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
776
|
+
var _model$inputConnectio, _publicAPI$getInputDa;
|
|
790
777
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
while (count--) {
|
|
794
|
-
if (publicAPI.getInputData(count) && publicAPI.getInputData(count).getMTime() > minOutputMTime) {
|
|
778
|
+
if ((_model$inputConnectio = model.inputConnection[count]) !== null && _model$inputConnectio !== void 0 && _model$inputConnectio.filter.shouldUpdate() || ((_publicAPI$getInputDa = publicAPI.getInputData(count)) === null || _publicAPI$getInputDa === void 0 ? void 0 : _publicAPI$getInputDa.getMTime()) > minOutputMTime) {
|
|
795
779
|
return true;
|
|
796
780
|
}
|
|
797
781
|
}
|