molstar 3.26.0 → 3.28.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/LICENSE +20 -20
- package/README.md +202 -202
- package/build/viewer/embedded.html +52 -52
- package/build/viewer/index.html +115 -115
- package/build/viewer/molstar.css +1 -1
- package/build/viewer/molstar.js +1 -1
- package/lib/apps/docking-viewer/index.html +36 -36
- package/lib/apps/docking-viewer/viewport.d.ts +2 -0
- package/lib/apps/docking-viewer/viewport.js +1 -0
- package/lib/apps/viewer/app.d.ts +3 -1
- package/lib/apps/viewer/app.js +4 -0
- package/lib/apps/viewer/embedded.html +52 -52
- package/lib/apps/viewer/index.html +115 -115
- package/lib/cli/structure-info/volume.js +1 -1
- package/lib/commonjs/apps/docking-viewer/viewport.d.ts +2 -0
- package/lib/commonjs/apps/docking-viewer/viewport.js +1 -0
- package/lib/commonjs/apps/viewer/app.d.ts +3 -1
- package/lib/commonjs/apps/viewer/app.js +4 -0
- package/lib/commonjs/cli/structure-info/volume.js +1 -1
- package/lib/commonjs/examples/lighting/index.js +1 -1
- package/lib/commonjs/extensions/anvil/behavior.d.ts +1 -0
- package/lib/commonjs/extensions/cellpack/model.js +2 -1
- package/lib/commonjs/extensions/dnatco/confal-pyramids/behavior.d.ts +1 -0
- package/lib/commonjs/extensions/meshes/choice.d.ts +26 -0
- package/lib/commonjs/extensions/meshes/choice.js +31 -0
- package/lib/commonjs/extensions/meshes/examples.d.ts +26 -0
- package/lib/commonjs/extensions/meshes/examples.js +337 -0
- package/lib/commonjs/extensions/meshes/mesh-cif-schema.d.ts +29 -0
- package/lib/commonjs/extensions/meshes/mesh-cif-schema.js +34 -0
- package/lib/commonjs/extensions/meshes/mesh-extension.d.ts +66 -0
- package/lib/commonjs/extensions/meshes/mesh-extension.js +221 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/behavior.d.ts +105 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/behavior.js +379 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/server-info.d.ts +54 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/server-info.js +30 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/transformers.d.ts +42 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/transformers.js +273 -0
- package/lib/commonjs/extensions/meshes/mesh-utils.d.ts +41 -0
- package/lib/commonjs/extensions/meshes/mesh-utils.js +357 -0
- package/lib/commonjs/extensions/meshes/metadata.d.ts +108 -0
- package/lib/commonjs/extensions/meshes/metadata.js +72 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/behavior.d.ts +2 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/prop.d.ts +1 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/prop.js +16 -4
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +4 -2
- package/lib/commonjs/extensions/rcsb/validation-report/behavior.d.ts +3 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-meshes.d.ts +17 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-meshes.js +156 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-models.d.ts +12 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-models.js +96 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-root.d.ts +122 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-root.js +576 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-segmentation.d.ts +20 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-segmentation.js +200 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-state.d.ts +88 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-state.js +32 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-volume.d.ts +35 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-volume.js +234 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/external-api.d.ts +11 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/external-api.js +85 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/global-state.d.ts +51 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/global-state.js +83 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/helpers.d.ts +56 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/helpers.js +171 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/index.d.ts +20 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/index.js +130 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/transformers.d.ts +33 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/transformers.js +85 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/ui.d.ts +29 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/ui.js +232 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/api.d.ts +22 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/api.js +83 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/data.d.ts +92 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/data.js +7 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/utils.d.ts +23 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/utils.js +78 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +2 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.js +3 -3
- package/lib/commonjs/mol-canvas3d/passes/image.d.ts +1 -0
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +2 -1
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +27 -13
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.d.ts +2 -1
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +3 -2
- package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/commonjs/mol-geo/geometry/points/points.d.ts +1 -1
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.d.ts +1 -0
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +3 -2
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/reduction.js +1 -2
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +4 -6
- package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/cylinders.js +1 -1
- package/lib/commonjs/mol-gl/renderable/spheres.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/spheres.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.d.ts +2 -2
- package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.js +2 -2
- package/lib/commonjs/mol-gl/shader/cylinders.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/cylinders.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/cylinders.vert.d.ts +2 -2
- package/lib/commonjs/mol-gl/shader/cylinders.vert.js +2 -2
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/outlines.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/outlines.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/postprocessing.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.vert.d.ts +2 -2
- package/lib/commonjs/mol-gl/shader/spheres.vert.js +2 -2
- package/lib/commonjs/mol-gl/webgl/renderbuffer.d.ts +1 -1
- package/lib/commonjs/mol-gl/webgl/renderbuffer.js +15 -0
- package/lib/commonjs/mol-gl/webgl/state.d.ts +12 -0
- package/lib/commonjs/mol-gl/webgl/state.js +136 -0
- package/lib/commonjs/mol-io/reader/cif/schema/segmentation.d.ts +38 -0
- package/lib/commonjs/mol-io/reader/cif/schema/segmentation.js +22 -0
- package/lib/commonjs/mol-io/reader/cif.d.ts +3 -1
- package/lib/commonjs/mol-io/reader/cif.js +3 -1
- package/lib/commonjs/mol-model/location.d.ts +2 -1
- package/lib/commonjs/mol-model/loci.d.ts +11 -11
- package/lib/commonjs/mol-model/loci.js +13 -1
- package/lib/commonjs/mol-model/sequence/alignment/sequence.d.ts +4 -1
- package/lib/commonjs/mol-model/sequence/alignment/sequence.js +4 -1
- package/lib/commonjs/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -0
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-index.js +8 -0
- package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.js +21 -5
- package/lib/commonjs/mol-model/structure/structure/util/superposition.d.ts +1 -0
- package/lib/commonjs/mol-model/structure/structure/util/superposition.js +2 -1
- package/lib/commonjs/mol-model/volume/volume.d.ts +35 -2
- package/lib/commonjs/mol-model/volume/volume.js +77 -2
- package/lib/commonjs/mol-model-formats/volume/segmentation.d.ts +23 -0
- package/lib/commonjs/mol-model-formats/volume/segmentation.js +138 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/representation.d.ts +2 -2
- package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +2 -1
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
- package/lib/commonjs/mol-plugin/commands.d.ts +1 -0
- package/lib/commonjs/mol-plugin-state/animation/built-in/model-index.js +4 -1
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +2 -0
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -0
- package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +13 -4
- package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.js +6 -1
- package/lib/commonjs/mol-plugin-state/builder/structure/representation.d.ts +1 -0
- package/lib/commonjs/mol-plugin-state/formats/provider.d.ts +2 -2
- package/lib/commonjs/mol-plugin-state/formats/provider.js +11 -3
- package/lib/commonjs/mol-plugin-state/formats/registry.js +6 -5
- package/lib/commonjs/mol-plugin-state/formats/volume.d.ts +27 -0
- package/lib/commonjs/mol-plugin-state/formats/volume.js +65 -1
- package/lib/commonjs/mol-plugin-state/manager/structure/component.d.ts +1 -1
- package/lib/commonjs/mol-plugin-state/manager/structure/component.js +18 -13
- package/lib/commonjs/mol-plugin-state/transforms/representation.d.ts +1 -2
- package/lib/commonjs/mol-plugin-state/transforms/representation.js +5 -6
- package/lib/commonjs/mol-plugin-state/transforms/volume.d.ts +11 -1
- package/lib/commonjs/mol-plugin-state/transforms/volume.js +55 -2
- package/lib/commonjs/mol-plugin-ui/controls/line-graph/line-graph-component.d.ts +1 -0
- package/lib/commonjs/mol-plugin-ui/controls/line-graph/line-graph-component.js +33 -13
- package/lib/commonjs/mol-plugin-ui/controls/parameters.d.ts +1 -0
- package/lib/commonjs/mol-plugin-ui/controls/parameters.js +22 -5
- package/lib/commonjs/mol-plugin-ui/sequence/sequence.d.ts +25 -17
- package/lib/commonjs/mol-plugin-ui/sequence.d.ts +19 -1
- package/lib/commonjs/mol-plugin-ui/sequence.js +8 -1
- package/lib/commonjs/mol-plugin-ui/state/apply-action.d.ts +2 -10
- package/lib/commonjs/mol-plugin-ui/state/apply-action.js +2 -2
- package/lib/commonjs/mol-plugin-ui/structure/quick-styles.js +2 -2
- package/lib/commonjs/mol-plugin-ui/structure/superposition.d.ts +1 -1
- package/lib/commonjs/mol-plugin-ui/structure/volume.d.ts +1 -1
- package/lib/commonjs/mol-plugin-ui/structure/volume.js +3 -2
- package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/params.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/registry.d.ts +12 -0
- package/lib/commonjs/mol-repr/structure/representation/backbone.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.d.ts +6 -0
- package/lib/commonjs/mol-repr/structure/representation/ellipsoid.d.ts +6 -0
- package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/line.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/point.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/spacefill.d.ts +6 -0
- package/lib/commonjs/mol-repr/structure/units-visual.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.js +2 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.js +1 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.js +1 -0
- package/lib/commonjs/mol-repr/structure/visual/element-cross.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/element-cross.js +2 -1
- package/lib/commonjs/mol-repr/structure/visual/element-point.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/element-point.js +2 -1
- package/lib/commonjs/mol-repr/structure/visual/element-sphere.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/element-sphere.js +3 -1
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.js +6 -2
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -1
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.js +3 -1
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.js +4 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.js +2 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/util/bond.d.ts +7 -0
- package/lib/commonjs/mol-repr/structure/visual/util/bond.js +18 -7
- package/lib/commonjs/mol-repr/structure/visual/util/common.d.ts +4 -1
- package/lib/commonjs/mol-repr/structure/visual/util/common.js +10 -6
- package/lib/commonjs/mol-repr/structure/visual/util/element.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/util/element.js +2 -3
- package/lib/commonjs/mol-repr/structure/visual/util/gaussian.d.ts +2 -0
- package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +4 -4
- package/lib/commonjs/mol-repr/volume/direct-volume.js +8 -6
- package/lib/commonjs/mol-repr/volume/isosurface.d.ts +4 -4
- package/lib/commonjs/mol-repr/volume/isosurface.js +17 -16
- package/lib/commonjs/mol-repr/volume/registry.d.ts +54 -1
- package/lib/commonjs/mol-repr/volume/registry.js +3 -1
- package/lib/commonjs/mol-repr/volume/representation.d.ts +11 -7
- package/lib/commonjs/mol-repr/volume/representation.js +142 -47
- package/lib/commonjs/mol-repr/volume/segment.d.ts +291 -0
- package/lib/commonjs/mol-repr/volume/segment.js +289 -0
- package/lib/commonjs/mol-repr/volume/slice.d.ts +2 -2
- package/lib/commonjs/mol-repr/volume/slice.js +5 -5
- package/lib/commonjs/mol-repr/volume/util.d.ts +12 -3
- package/lib/commonjs/mol-repr/volume/util.js +72 -6
- package/lib/commonjs/mol-script/language/builder.d.ts +1 -0
- package/lib/commonjs/mol-theme/color/volume-segment.d.ts +41 -0
- package/lib/commonjs/mol-theme/color/volume-segment.js +58 -0
- package/lib/commonjs/mol-theme/color/volume-value.js +2 -1
- package/lib/commonjs/mol-theme/color.d.ts +15 -0
- package/lib/commonjs/mol-theme/color.js +2 -0
- package/lib/commonjs/mol-theme/label.d.ts +1 -1
- package/lib/commonjs/mol-theme/label.js +13 -1
- package/lib/commonjs/mol-util/param-definition.d.ts +4 -1
- package/lib/commonjs/mol-util/param-definition.js +5 -2
- package/lib/examples/alpha-orbitals/index.html +72 -72
- package/lib/examples/basic-wrapper/index.html +137 -137
- package/lib/examples/lighting/index.html +88 -88
- package/lib/examples/lighting/index.js +1 -1
- package/lib/examples/proteopedia-wrapper/index.html +236 -236
- package/lib/extensions/anvil/behavior.d.ts +1 -0
- package/lib/extensions/cellpack/model.js +2 -1
- package/lib/extensions/dnatco/confal-pyramids/behavior.d.ts +1 -0
- package/lib/extensions/meshes/choice.d.ts +26 -0
- package/lib/extensions/meshes/choice.js +28 -0
- package/lib/extensions/meshes/examples.d.ts +26 -0
- package/lib/extensions/meshes/examples.js +325 -0
- package/lib/extensions/meshes/mesh-cif-schema.d.ts +29 -0
- package/lib/extensions/meshes/mesh-cif-schema.js +30 -0
- package/lib/extensions/meshes/mesh-extension.d.ts +66 -0
- package/lib/extensions/meshes/mesh-extension.js +218 -0
- package/lib/extensions/meshes/mesh-streaming/behavior.d.ts +105 -0
- package/lib/extensions/meshes/mesh-streaming/behavior.js +375 -0
- package/lib/extensions/meshes/mesh-streaming/server-info.d.ts +54 -0
- package/lib/extensions/meshes/mesh-streaming/server-info.js +26 -0
- package/lib/extensions/meshes/mesh-streaming/transformers.d.ts +42 -0
- package/lib/extensions/meshes/mesh-streaming/transformers.js +270 -0
- package/lib/extensions/meshes/mesh-utils.d.ts +41 -0
- package/lib/extensions/meshes/mesh-utils.js +346 -0
- package/lib/extensions/meshes/metadata.d.ts +108 -0
- package/lib/extensions/meshes/metadata.js +69 -0
- package/lib/extensions/model-archive/quality-assessment/behavior.d.ts +2 -0
- package/lib/extensions/model-archive/quality-assessment/prop.d.ts +1 -0
- package/lib/extensions/model-archive/quality-assessment/prop.js +16 -4
- package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +4 -2
- package/lib/extensions/rcsb/validation-report/behavior.d.ts +3 -0
- package/lib/extensions/volumes-and-segmentations/entry-meshes.d.ts +17 -0
- package/lib/extensions/volumes-and-segmentations/entry-meshes.js +153 -0
- package/lib/extensions/volumes-and-segmentations/entry-models.d.ts +12 -0
- package/lib/extensions/volumes-and-segmentations/entry-models.js +93 -0
- package/lib/extensions/volumes-and-segmentations/entry-root.d.ts +122 -0
- package/lib/extensions/volumes-and-segmentations/entry-root.js +571 -0
- package/lib/extensions/volumes-and-segmentations/entry-segmentation.d.ts +20 -0
- package/lib/extensions/volumes-and-segmentations/entry-segmentation.js +197 -0
- package/lib/extensions/volumes-and-segmentations/entry-state.d.ts +88 -0
- package/lib/extensions/volumes-and-segmentations/entry-state.js +29 -0
- package/lib/extensions/volumes-and-segmentations/entry-volume.d.ts +35 -0
- package/lib/extensions/volumes-and-segmentations/entry-volume.js +231 -0
- package/lib/extensions/volumes-and-segmentations/external-api.d.ts +11 -0
- package/lib/extensions/volumes-and-segmentations/external-api.js +80 -0
- package/lib/extensions/volumes-and-segmentations/global-state.d.ts +51 -0
- package/lib/extensions/volumes-and-segmentations/global-state.js +80 -0
- package/lib/extensions/volumes-and-segmentations/helpers.d.ts +56 -0
- package/lib/extensions/volumes-and-segmentations/helpers.js +163 -0
- package/lib/extensions/volumes-and-segmentations/index.d.ts +20 -0
- package/lib/extensions/volumes-and-segmentations/index.js +127 -0
- package/lib/extensions/volumes-and-segmentations/transformers.d.ts +33 -0
- package/lib/extensions/volumes-and-segmentations/transformers.js +82 -0
- package/lib/extensions/volumes-and-segmentations/ui.d.ts +29 -0
- package/lib/extensions/volumes-and-segmentations/ui.js +229 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/api.d.ts +22 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/api.js +80 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/data.d.ts +92 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/data.js +6 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/utils.d.ts +23 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/utils.js +75 -0
- package/lib/mol-canvas3d/canvas3d.d.ts +2 -0
- package/lib/mol-canvas3d/passes/draw.js +3 -3
- package/lib/mol-canvas3d/passes/image.d.ts +1 -0
- package/lib/mol-canvas3d/passes/postprocessing.d.ts +2 -1
- package/lib/mol-canvas3d/passes/postprocessing.js +27 -13
- package/lib/mol-geo/geometry/cylinders/cylinders.d.ts +2 -1
- package/lib/mol-geo/geometry/cylinders/cylinders.js +3 -2
- package/lib/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/mol-geo/geometry/points/points.d.ts +1 -1
- package/lib/mol-geo/geometry/spheres/spheres.d.ts +1 -0
- package/lib/mol-geo/geometry/spheres/spheres.js +3 -2
- package/lib/mol-gl/compute/histogram-pyramid/reduction.js +1 -2
- package/lib/mol-gl/compute/marching-cubes/isosurface.js +4 -6
- package/lib/mol-gl/renderable/cylinders.d.ts +1 -0
- package/lib/mol-gl/renderable/cylinders.js +1 -1
- package/lib/mol-gl/renderable/spheres.d.ts +1 -0
- package/lib/mol-gl/renderable/spheres.js +1 -1
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/clip-instance.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/clip-instance.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/clip-pixel.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/clip-pixel.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/common-clip.glsl.d.ts +2 -2
- package/lib/mol-gl/shader/chunks/common-clip.glsl.js +2 -2
- package/lib/mol-gl/shader/cylinders.frag.d.ts +1 -1
- package/lib/mol-gl/shader/cylinders.frag.js +1 -1
- package/lib/mol-gl/shader/cylinders.vert.d.ts +2 -2
- package/lib/mol-gl/shader/cylinders.vert.js +2 -2
- package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/mol-gl/shader/outlines.frag.d.ts +1 -1
- package/lib/mol-gl/shader/outlines.frag.js +1 -1
- package/lib/mol-gl/shader/postprocessing.frag.d.ts +1 -1
- package/lib/mol-gl/shader/postprocessing.frag.js +1 -1
- package/lib/mol-gl/shader/spheres.frag.d.ts +1 -1
- package/lib/mol-gl/shader/spheres.frag.js +1 -1
- package/lib/mol-gl/shader/spheres.vert.d.ts +2 -2
- package/lib/mol-gl/shader/spheres.vert.js +2 -2
- package/lib/mol-gl/webgl/renderbuffer.d.ts +1 -1
- package/lib/mol-gl/webgl/renderbuffer.js +15 -0
- package/lib/mol-gl/webgl/state.d.ts +12 -0
- package/lib/mol-gl/webgl/state.js +136 -0
- package/lib/mol-io/reader/cif/schema/segmentation.d.ts +38 -0
- package/lib/mol-io/reader/cif/schema/segmentation.js +19 -0
- package/lib/mol-io/reader/cif.d.ts +3 -1
- package/lib/mol-io/reader/cif.js +3 -1
- package/lib/mol-model/location.d.ts +2 -1
- package/lib/mol-model/loci.d.ts +11 -11
- package/lib/mol-model/loci.js +13 -1
- package/lib/mol-model/sequence/alignment/sequence.d.ts +4 -1
- package/lib/mol-model/sequence/alignment/sequence.js +3 -2
- package/lib/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -0
- package/lib/mol-model/structure/model/properties/utils/atomic-index.js +8 -0
- package/lib/mol-model/structure/structure/unit/bonds/inter-compute.js +21 -5
- package/lib/mol-model/structure/structure/util/superposition.d.ts +1 -0
- package/lib/mol-model/structure/structure/util/superposition.js +1 -1
- package/lib/mol-model/volume/volume.d.ts +35 -2
- package/lib/mol-model/volume/volume.js +79 -4
- package/lib/mol-model-formats/volume/segmentation.d.ts +23 -0
- package/lib/mol-model-formats/volume/segmentation.js +135 -0
- package/lib/mol-plugin/behavior/dynamic/representation.d.ts +2 -2
- package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
- package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +2 -1
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
- package/lib/mol-plugin/commands.d.ts +1 -0
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/animation/built-in/model-index.js +4 -1
- package/lib/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +2 -0
- package/lib/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -0
- package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +13 -4
- package/lib/mol-plugin-state/builder/structure/representation-preset.js +6 -1
- package/lib/mol-plugin-state/builder/structure/representation.d.ts +1 -0
- package/lib/mol-plugin-state/formats/provider.d.ts +2 -2
- package/lib/mol-plugin-state/formats/provider.js +11 -3
- package/lib/mol-plugin-state/formats/registry.js +6 -5
- package/lib/mol-plugin-state/formats/volume.d.ts +27 -0
- package/lib/mol-plugin-state/formats/volume.js +64 -0
- package/lib/mol-plugin-state/manager/structure/component.d.ts +1 -1
- package/lib/mol-plugin-state/manager/structure/component.js +18 -13
- package/lib/mol-plugin-state/transforms/representation.d.ts +1 -2
- package/lib/mol-plugin-state/transforms/representation.js +5 -6
- package/lib/mol-plugin-state/transforms/volume.d.ts +11 -1
- package/lib/mol-plugin-state/transforms/volume.js +54 -1
- package/lib/mol-plugin-ui/controls/line-graph/line-graph-component.d.ts +1 -0
- package/lib/mol-plugin-ui/controls/line-graph/line-graph-component.js +33 -13
- package/lib/mol-plugin-ui/controls/parameters.d.ts +1 -0
- package/lib/mol-plugin-ui/controls/parameters.js +22 -5
- package/lib/mol-plugin-ui/sequence/sequence.d.ts +25 -17
- package/lib/mol-plugin-ui/sequence.d.ts +19 -1
- package/lib/mol-plugin-ui/sequence.js +7 -7
- package/lib/mol-plugin-ui/skin/base/base.scss +32 -32
- package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
- package/lib/mol-plugin-ui/skin/base/components/controls.scss +418 -418
- package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
- package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
- package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
- package/lib/mol-plugin-ui/skin/base/components/misc.scss +643 -643
- package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
- package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
- package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
- package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
- package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
- package/lib/mol-plugin-ui/skin/base/components/viewport.scss +137 -128
- package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
- package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
- package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
- package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
- package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
- package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
- package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/variables.scss +85 -85
- package/lib/mol-plugin-ui/skin/blue.scss +1 -1
- package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
- package/lib/mol-plugin-ui/skin/dark.scss +1 -1
- package/lib/mol-plugin-ui/skin/light.scss +1 -1
- package/lib/mol-plugin-ui/state/apply-action.d.ts +2 -10
- package/lib/mol-plugin-ui/state/apply-action.js +2 -2
- package/lib/mol-plugin-ui/structure/quick-styles.js +2 -2
- package/lib/mol-plugin-ui/structure/superposition.d.ts +1 -1
- package/lib/mol-plugin-ui/structure/volume.d.ts +1 -1
- package/lib/mol-plugin-ui/structure/volume.js +3 -2
- package/lib/mol-repr/structure/complex-visual.d.ts +1 -0
- package/lib/mol-repr/structure/params.d.ts +2 -0
- package/lib/mol-repr/structure/registry.d.ts +12 -0
- package/lib/mol-repr/structure/representation/backbone.d.ts +3 -0
- package/lib/mol-repr/structure/representation/ball-and-stick.d.ts +6 -0
- package/lib/mol-repr/structure/representation/ellipsoid.d.ts +6 -0
- package/lib/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
- package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
- package/lib/mol-repr/structure/representation/line.d.ts +3 -0
- package/lib/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
- package/lib/mol-repr/structure/representation/point.d.ts +3 -0
- package/lib/mol-repr/structure/representation/spacefill.d.ts +6 -0
- package/lib/mol-repr/structure/units-visual.d.ts +2 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +4 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.js +2 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.js +1 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +4 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.js +1 -0
- package/lib/mol-repr/structure/visual/element-cross.d.ts +1 -0
- package/lib/mol-repr/structure/visual/element-cross.js +2 -1
- package/lib/mol-repr/structure/visual/element-point.d.ts +1 -0
- package/lib/mol-repr/structure/visual/element-point.js +2 -1
- package/lib/mol-repr/structure/visual/element-sphere.d.ts +4 -0
- package/lib/mol-repr/structure/visual/element-sphere.js +3 -1
- package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
- package/lib/mol-repr/structure/visual/gaussian-density-volume.js +6 -2
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -1
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.js +3 -1
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.js +4 -0
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.js +2 -0
- package/lib/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
- package/lib/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
- package/lib/mol-repr/structure/visual/util/bond.d.ts +7 -0
- package/lib/mol-repr/structure/visual/util/bond.js +19 -8
- package/lib/mol-repr/structure/visual/util/common.d.ts +4 -1
- package/lib/mol-repr/structure/visual/util/common.js +10 -6
- package/lib/mol-repr/structure/visual/util/element.d.ts +1 -0
- package/lib/mol-repr/structure/visual/util/element.js +3 -4
- package/lib/mol-repr/structure/visual/util/gaussian.d.ts +2 -0
- package/lib/mol-repr/volume/direct-volume.d.ts +4 -4
- package/lib/mol-repr/volume/direct-volume.js +8 -6
- package/lib/mol-repr/volume/isosurface.d.ts +4 -4
- package/lib/mol-repr/volume/isosurface.js +17 -16
- package/lib/mol-repr/volume/registry.d.ts +54 -1
- package/lib/mol-repr/volume/registry.js +3 -1
- package/lib/mol-repr/volume/representation.d.ts +11 -7
- package/lib/mol-repr/volume/representation.js +144 -49
- package/lib/mol-repr/volume/segment.d.ts +291 -0
- package/lib/mol-repr/volume/segment.js +279 -0
- package/lib/mol-repr/volume/slice.d.ts +2 -2
- package/lib/mol-repr/volume/slice.js +5 -5
- package/lib/mol-repr/volume/util.d.ts +12 -3
- package/lib/mol-repr/volume/util.js +71 -6
- package/lib/mol-script/language/builder.d.ts +1 -0
- package/lib/mol-theme/color/volume-segment.d.ts +41 -0
- package/lib/mol-theme/color/volume-segment.js +53 -0
- package/lib/mol-theme/color/volume-value.js +2 -1
- package/lib/mol-theme/color.d.ts +15 -0
- package/lib/mol-theme/color.js +2 -0
- package/lib/mol-theme/label.d.ts +1 -1
- package/lib/mol-theme/label.js +13 -1
- package/lib/mol-util/param-definition.d.ts +4 -1
- package/lib/mol-util/param-definition.js +5 -2
- package/package.json +169 -168
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SegmentRepresentationProvider = exports.SegmentRepresentation = exports.getSegmentParams = exports.SegmentParams = exports.SegmentTextureMeshVisual = exports.SegmentMeshVisual = exports.SegmentMeshParams = exports.createVolumeSegmentMesh = exports.eachSegment = exports.SegmentVisual = exports.VolumeSegmentParams = void 0;
|
|
9
|
+
var tslib_1 = require("tslib");
|
|
10
|
+
var param_definition_1 = require("../../mol-util/param-definition");
|
|
11
|
+
var volume_1 = require("../../mol-model/volume");
|
|
12
|
+
var mesh_1 = require("../../mol-geo/geometry/mesh/mesh");
|
|
13
|
+
var algorithm_1 = require("../../mol-geo/util/marching-cubes/algorithm");
|
|
14
|
+
var representation_1 = require("./representation");
|
|
15
|
+
var location_iterator_1 = require("../../mol-geo/util/location-iterator");
|
|
16
|
+
var representation_2 = require("../representation");
|
|
17
|
+
var loci_1 = require("../../mol-model/loci");
|
|
18
|
+
var int_1 = require("../../mol-data/int");
|
|
19
|
+
var linear_algebra_1 = require("../../mol-math/linear-algebra");
|
|
20
|
+
var array_1 = require("../../mol-util/array");
|
|
21
|
+
var util_1 = require("./util");
|
|
22
|
+
var texture_mesh_1 = require("../../mol-geo/geometry/texture-mesh/texture-mesh");
|
|
23
|
+
var base_1 = require("../../mol-geo/geometry/base");
|
|
24
|
+
var value_cell_1 = require("../../mol-util/value-cell");
|
|
25
|
+
var isosurface_1 = require("../../mol-gl/compute/marching-cubes/isosurface");
|
|
26
|
+
var box3d_1 = require("../../mol-math/geometry/primitives/box3d");
|
|
27
|
+
exports.VolumeSegmentParams = {
|
|
28
|
+
segments: param_definition_1.ParamDefinition.Converted(function (v) { return v.map(function (x) { return "".concat(x); }); }, function (v) { return v.map(function (x) { return parseInt(x); }); }, param_definition_1.ParamDefinition.MultiSelect(['0'], param_definition_1.ParamDefinition.arrayToOptions(['0']), {
|
|
29
|
+
isEssential: true
|
|
30
|
+
}))
|
|
31
|
+
};
|
|
32
|
+
function gpuSupport(webgl) {
|
|
33
|
+
return webgl.extensions.colorBufferFloat && webgl.extensions.textureFloat && webgl.extensions.drawBuffers;
|
|
34
|
+
}
|
|
35
|
+
var Padding = 1;
|
|
36
|
+
function suitableForGpu(volume, webgl) {
|
|
37
|
+
// small volumes are about as fast or faster on CPU vs integrated GPU
|
|
38
|
+
if (volume.grid.cells.data.length < Math.pow(10, 3))
|
|
39
|
+
return false;
|
|
40
|
+
// the GPU is much more memory contraint, especially true for integrated GPUs,
|
|
41
|
+
// fallback to CPU for large volumes
|
|
42
|
+
var gridDim = volume.grid.cells.space.dimensions;
|
|
43
|
+
var powerOfTwoSize = (0, util_1.getVolumeTexture2dLayout)(gridDim, Padding).powerOfTwoSize;
|
|
44
|
+
return powerOfTwoSize <= webgl.maxTextureSize / 2;
|
|
45
|
+
}
|
|
46
|
+
var _translate = (0, linear_algebra_1.Mat4)();
|
|
47
|
+
function getSegmentTransform(grid, segmentBox) {
|
|
48
|
+
var transform = volume_1.Grid.getGridToCartesianTransform(grid);
|
|
49
|
+
var translate = linear_algebra_1.Mat4.fromTranslation(_translate, segmentBox.min);
|
|
50
|
+
return linear_algebra_1.Mat4.mul((0, linear_algebra_1.Mat4)(), transform, translate);
|
|
51
|
+
}
|
|
52
|
+
function SegmentVisual(materialId, volume, key, props, webgl) {
|
|
53
|
+
if (props.tryUseGpu && webgl && gpuSupport(webgl) && suitableForGpu(volume, webgl)) {
|
|
54
|
+
return SegmentTextureMeshVisual(materialId);
|
|
55
|
+
}
|
|
56
|
+
return SegmentMeshVisual(materialId);
|
|
57
|
+
}
|
|
58
|
+
exports.SegmentVisual = SegmentVisual;
|
|
59
|
+
function getLoci(volume, props) {
|
|
60
|
+
return volume_1.Volume.Segment.Loci(volume, props.segments);
|
|
61
|
+
}
|
|
62
|
+
function getSegmentLoci(pickingId, volume, key, props, id) {
|
|
63
|
+
var objectId = pickingId.objectId, groupId = pickingId.groupId;
|
|
64
|
+
if (id === objectId) {
|
|
65
|
+
var granularity = volume_1.Volume.PickingGranularity.get(volume);
|
|
66
|
+
if (granularity === 'volume') {
|
|
67
|
+
return volume_1.Volume.Loci(volume);
|
|
68
|
+
}
|
|
69
|
+
else if (granularity === 'object') {
|
|
70
|
+
return volume_1.Volume.Segment.Loci(volume, [key]);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return volume_1.Volume.Cell.Loci(volume, int_1.Interval.ofSingleton(groupId));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return loci_1.EmptyLoci;
|
|
77
|
+
}
|
|
78
|
+
function eachSegment(loci, volume, key, props, apply) {
|
|
79
|
+
var segments = int_1.SortedArray.ofSingleton(key);
|
|
80
|
+
return (0, util_1.eachVolumeLoci)(loci, volume, { segments: segments }, apply);
|
|
81
|
+
}
|
|
82
|
+
exports.eachSegment = eachSegment;
|
|
83
|
+
//
|
|
84
|
+
function getSegmentCells(set, bbox, cells) {
|
|
85
|
+
var data = cells.data;
|
|
86
|
+
var o = cells.space.dataOffset;
|
|
87
|
+
var dim = box3d_1.Box3D.size((0, linear_algebra_1.Vec3)(), bbox);
|
|
88
|
+
var xn = dim[0], yn = dim[1], zn = dim[2];
|
|
89
|
+
var xn1 = xn - 1;
|
|
90
|
+
var yn1 = yn - 1;
|
|
91
|
+
var zn1 = zn - 1;
|
|
92
|
+
var _a = bbox.min, minx = _a[0], miny = _a[1], minz = _a[2];
|
|
93
|
+
var _b = bbox.max, maxx = _b[0], maxy = _b[1], maxz = _b[2];
|
|
94
|
+
var axisOrder = tslib_1.__spreadArray([], cells.space.axisOrderSlowToFast, true);
|
|
95
|
+
var segmentSpace = linear_algebra_1.Tensor.Space(dim, axisOrder, Uint8Array);
|
|
96
|
+
var segmentCells = linear_algebra_1.Tensor.create(segmentSpace, segmentSpace.create());
|
|
97
|
+
var segData = segmentCells.data;
|
|
98
|
+
var segSet = segmentSpace.set;
|
|
99
|
+
for (var z = 0; z < zn; ++z) {
|
|
100
|
+
for (var y = 0; y < yn; ++y) {
|
|
101
|
+
for (var x = 0; x < xn; ++x) {
|
|
102
|
+
var v0 = set.includes(data[o(x + minx, y + miny, z + minz)]) ? 255 : 0;
|
|
103
|
+
var xp = set.includes(data[o(Math.min(xn1 + maxx, x + 1 + minx), y + miny, z + minz)]) ? 255 : 0;
|
|
104
|
+
var xn_1 = set.includes(data[o(Math.max(0, x - 1 + minx), y + miny, z + minz)]) ? 255 : 0;
|
|
105
|
+
var yp = set.includes(data[o(x + minx, Math.min(yn1 + maxy, y + 1 + miny), z + minz)]) ? 255 : 0;
|
|
106
|
+
var yn_1 = set.includes(data[o(x + minx, Math.max(0, y - 1 + miny), z + minz)]) ? 255 : 0;
|
|
107
|
+
var zp = set.includes(data[o(x + minx, y + miny, Math.min(zn1 + maxz, z + 1 + minz))]) ? 255 : 0;
|
|
108
|
+
var zn_1 = set.includes(data[o(x + minx, y + miny, Math.max(0, z - 1 + minz))]) ? 255 : 0;
|
|
109
|
+
segSet(segData, x, y, z, Math.round((v0 + v0 + xp + xn_1 + yp + yn_1 + zp + zn_1) / 8));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return segmentCells;
|
|
114
|
+
}
|
|
115
|
+
function createVolumeSegmentMesh(ctx, volume, key, theme, props, mesh) {
|
|
116
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var segmentation, bbox, set, cells, ids, surface, transform;
|
|
118
|
+
return tslib_1.__generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
segmentation = volume_1.Volume.Segmentation.get(volume);
|
|
122
|
+
if (!segmentation)
|
|
123
|
+
throw new Error('missing volume segmentation');
|
|
124
|
+
ctx.runtime.update({ message: 'Marching cubes...' });
|
|
125
|
+
bbox = box3d_1.Box3D.clone(segmentation.bounds[key]);
|
|
126
|
+
box3d_1.Box3D.expand(bbox, bbox, linear_algebra_1.Vec3.create(2, 2, 2));
|
|
127
|
+
set = Array.from(segmentation.segments.get(key).values());
|
|
128
|
+
cells = getSegmentCells(set, bbox, volume.grid.cells);
|
|
129
|
+
ids = (0, array_1.fillSerial)(new Int32Array(cells.data.length));
|
|
130
|
+
return [4 /*yield*/, (0, algorithm_1.computeMarchingCubesMesh)({
|
|
131
|
+
isoLevel: 128,
|
|
132
|
+
scalarField: cells,
|
|
133
|
+
idField: linear_algebra_1.Tensor.create(cells.space, linear_algebra_1.Tensor.Data1(ids))
|
|
134
|
+
}, mesh).runAsChild(ctx.runtime)];
|
|
135
|
+
case 1:
|
|
136
|
+
surface = _a.sent();
|
|
137
|
+
transform = getSegmentTransform(volume.grid, bbox);
|
|
138
|
+
mesh_1.Mesh.transform(surface, transform);
|
|
139
|
+
if (ctx.webgl && !ctx.webgl.isWebGL2) {
|
|
140
|
+
// 2nd arg means not to split triangles based on group id. Splitting triangles
|
|
141
|
+
// is too expensive if each cell has its own group id as is the case here.
|
|
142
|
+
mesh_1.Mesh.uniformTriangleGroup(surface, false);
|
|
143
|
+
value_cell_1.ValueCell.updateIfChanged(surface.varyingGroup, false);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
value_cell_1.ValueCell.updateIfChanged(surface.varyingGroup, true);
|
|
147
|
+
}
|
|
148
|
+
surface.setBoundingSphere(volume_1.Volume.Segment.getBoundingSphere(volume, [key]));
|
|
149
|
+
return [2 /*return*/, surface];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
exports.createVolumeSegmentMesh = createVolumeSegmentMesh;
|
|
155
|
+
exports.SegmentMeshParams = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, mesh_1.Mesh.Params), texture_mesh_1.TextureMesh.Params), exports.VolumeSegmentParams), { quality: tslib_1.__assign(tslib_1.__assign({}, mesh_1.Mesh.Params.quality), { isEssential: false }), tryUseGpu: param_definition_1.ParamDefinition.Boolean(true) });
|
|
156
|
+
function SegmentMeshVisual(materialId) {
|
|
157
|
+
return (0, representation_1.VolumeVisual)({
|
|
158
|
+
defaultProps: param_definition_1.ParamDefinition.getDefaultValues(exports.SegmentMeshParams),
|
|
159
|
+
createGeometry: createVolumeSegmentMesh,
|
|
160
|
+
createLocationIterator: function (volume, key) {
|
|
161
|
+
var l = volume_1.Volume.Segment.Location(volume, key);
|
|
162
|
+
return (0, location_iterator_1.LocationIterator)(volume.grid.cells.data.length, 1, 1, function () { return l; });
|
|
163
|
+
},
|
|
164
|
+
getLoci: getSegmentLoci,
|
|
165
|
+
eachLocation: eachSegment,
|
|
166
|
+
setUpdateState: function (state, volume, newProps, currentProps) {
|
|
167
|
+
},
|
|
168
|
+
geometryUtils: mesh_1.Mesh.Utils,
|
|
169
|
+
mustRecreate: function (volumeKey, props, webgl) {
|
|
170
|
+
return props.tryUseGpu && !!webgl && suitableForGpu(volumeKey.volume, webgl);
|
|
171
|
+
}
|
|
172
|
+
}, materialId);
|
|
173
|
+
}
|
|
174
|
+
exports.SegmentMeshVisual = SegmentMeshVisual;
|
|
175
|
+
//
|
|
176
|
+
var SegmentTextureName = 'segment-texture';
|
|
177
|
+
function getSegmentTexture(volume, segment, webgl) {
|
|
178
|
+
var segmentation = volume_1.Volume.Segmentation.get(volume);
|
|
179
|
+
if (!segmentation)
|
|
180
|
+
throw new Error('missing volume segmentation');
|
|
181
|
+
var resources = webgl.resources;
|
|
182
|
+
var bbox = box3d_1.Box3D.clone(segmentation.bounds[segment]);
|
|
183
|
+
box3d_1.Box3D.expand(bbox, bbox, linear_algebra_1.Vec3.create(2, 2, 2));
|
|
184
|
+
var transform = getSegmentTransform(volume.grid, bbox);
|
|
185
|
+
var gridDimension = box3d_1.Box3D.size((0, linear_algebra_1.Vec3)(), bbox);
|
|
186
|
+
var _a = (0, util_1.getVolumeTexture2dLayout)(gridDimension, Padding), width = _a.width, height = _a.height, texDim = _a.powerOfTwoSize;
|
|
187
|
+
var gridTexDim = linear_algebra_1.Vec3.create(width, height, 0);
|
|
188
|
+
var gridTexScale = linear_algebra_1.Vec2.create(width / texDim, height / texDim);
|
|
189
|
+
// console.log({ texDim, width, height, gridDimension });
|
|
190
|
+
if (texDim > webgl.maxTextureSize / 2) {
|
|
191
|
+
throw new Error('volume too large for gpu segment extraction');
|
|
192
|
+
}
|
|
193
|
+
if (!webgl.namedTextures[SegmentTextureName]) {
|
|
194
|
+
webgl.namedTextures[SegmentTextureName] = resources.texture('image-uint8', 'alpha', 'ubyte', 'linear');
|
|
195
|
+
}
|
|
196
|
+
var texture = webgl.namedTextures[SegmentTextureName];
|
|
197
|
+
texture.define(texDim, texDim);
|
|
198
|
+
// load volume into sub-section of texture
|
|
199
|
+
var set = Array.from(segmentation.segments.get(segment).values());
|
|
200
|
+
texture.load((0, util_1.createSegmentTexture2d)(volume, set, bbox, Padding), true);
|
|
201
|
+
gridDimension[0] += Padding;
|
|
202
|
+
gridDimension[1] += Padding;
|
|
203
|
+
return {
|
|
204
|
+
texture: texture,
|
|
205
|
+
transform: transform,
|
|
206
|
+
gridDimension: gridDimension,
|
|
207
|
+
gridTexDim: gridTexDim,
|
|
208
|
+
gridTexScale: gridTexScale
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function createVolumeSegmentTextureMesh(ctx, volume, segment, theme, props, textureMesh) {
|
|
212
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
213
|
+
var _a, texture, gridDimension, gridTexDim, gridTexScale, transform, axisOrder, buffer, gv, groupCount, surface;
|
|
214
|
+
return tslib_1.__generator(this, function (_b) {
|
|
215
|
+
if (!ctx.webgl)
|
|
216
|
+
throw new Error('webgl context required to create volume segment texture-mesh');
|
|
217
|
+
if (volume.grid.cells.data.length <= 1) {
|
|
218
|
+
return [2 /*return*/, texture_mesh_1.TextureMesh.createEmpty(textureMesh)];
|
|
219
|
+
}
|
|
220
|
+
_a = getSegmentTexture(volume, segment, ctx.webgl), texture = _a.texture, gridDimension = _a.gridDimension, gridTexDim = _a.gridTexDim, gridTexScale = _a.gridTexScale, transform = _a.transform;
|
|
221
|
+
axisOrder = volume.grid.cells.space.axisOrderSlowToFast;
|
|
222
|
+
buffer = textureMesh === null || textureMesh === void 0 ? void 0 : textureMesh.doubleBuffer.get();
|
|
223
|
+
gv = (0, isosurface_1.extractIsosurface)(ctx.webgl, texture, gridDimension, gridTexDim, gridTexScale, transform, 0.5, false, false, axisOrder, true, buffer === null || buffer === void 0 ? void 0 : buffer.vertex, buffer === null || buffer === void 0 ? void 0 : buffer.group, buffer === null || buffer === void 0 ? void 0 : buffer.normal);
|
|
224
|
+
groupCount = volume.grid.cells.data.length;
|
|
225
|
+
surface = texture_mesh_1.TextureMesh.create(gv.vertexCount, groupCount, gv.vertexTexture, gv.groupTexture, gv.normalTexture, volume_1.Volume.Segment.getBoundingSphere(volume, [segment]), textureMesh);
|
|
226
|
+
return [2 /*return*/, surface];
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function SegmentTextureMeshVisual(materialId) {
|
|
231
|
+
return (0, representation_1.VolumeVisual)({
|
|
232
|
+
defaultProps: param_definition_1.ParamDefinition.getDefaultValues(exports.SegmentMeshParams),
|
|
233
|
+
createGeometry: createVolumeSegmentTextureMesh,
|
|
234
|
+
createLocationIterator: function (volume, segment) {
|
|
235
|
+
var l = volume_1.Volume.Segment.Location(volume, segment);
|
|
236
|
+
return (0, location_iterator_1.LocationIterator)(volume.grid.cells.data.length, 1, 1, function () { return l; });
|
|
237
|
+
},
|
|
238
|
+
getLoci: getSegmentLoci,
|
|
239
|
+
eachLocation: eachSegment,
|
|
240
|
+
setUpdateState: function (state, volume, newProps, currentProps) {
|
|
241
|
+
},
|
|
242
|
+
geometryUtils: texture_mesh_1.TextureMesh.Utils,
|
|
243
|
+
mustRecreate: function (volumeKey, props, webgl) {
|
|
244
|
+
return !props.tryUseGpu || !webgl || !suitableForGpu(volumeKey.volume, webgl);
|
|
245
|
+
},
|
|
246
|
+
dispose: function (geometry) {
|
|
247
|
+
geometry.vertexTexture.ref.value.destroy();
|
|
248
|
+
geometry.groupTexture.ref.value.destroy();
|
|
249
|
+
geometry.normalTexture.ref.value.destroy();
|
|
250
|
+
geometry.doubleBuffer.destroy();
|
|
251
|
+
}
|
|
252
|
+
}, materialId);
|
|
253
|
+
}
|
|
254
|
+
exports.SegmentTextureMeshVisual = SegmentTextureMeshVisual;
|
|
255
|
+
//
|
|
256
|
+
function getSegments(props) {
|
|
257
|
+
return int_1.SortedArray.ofUnsortedArray(props.segments);
|
|
258
|
+
}
|
|
259
|
+
var SegmentVisuals = {
|
|
260
|
+
'segment': function (ctx, getParams) { return (0, representation_1.VolumeRepresentation)('Segment mesh', ctx, getParams, SegmentVisual, getLoci, getSegments); },
|
|
261
|
+
};
|
|
262
|
+
exports.SegmentParams = tslib_1.__assign(tslib_1.__assign({}, exports.SegmentMeshParams), { visuals: param_definition_1.ParamDefinition.MultiSelect(['segment'], param_definition_1.ParamDefinition.objectToOptions(SegmentVisuals)), bumpFrequency: param_definition_1.ParamDefinition.Numeric(1, { min: 0, max: 10, step: 0.1 }, base_1.BaseGeometry.ShadingCategory) });
|
|
263
|
+
function getSegmentParams(ctx, volume) {
|
|
264
|
+
var p = param_definition_1.ParamDefinition.clone(exports.SegmentParams);
|
|
265
|
+
var segmentation = volume_1.Volume.Segmentation.get(volume);
|
|
266
|
+
if (segmentation) {
|
|
267
|
+
var segments = Array.from(segmentation.segments.keys());
|
|
268
|
+
p.segments = param_definition_1.ParamDefinition.Converted(function (v) { return v.map(function (x) { return "".concat(x); }); }, function (v) { return v.map(function (x) { return parseInt(x); }); }, param_definition_1.ParamDefinition.MultiSelect(segments.map(function (x) { return "".concat(x); }), param_definition_1.ParamDefinition.arrayToOptions(segments.map(function (x) { return "".concat(x); })), {
|
|
269
|
+
isEssential: true
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
return p;
|
|
273
|
+
}
|
|
274
|
+
exports.getSegmentParams = getSegmentParams;
|
|
275
|
+
function SegmentRepresentation(ctx, getParams) {
|
|
276
|
+
return representation_2.Representation.createMulti('Segment', ctx, getParams, representation_2.Representation.StateBuilder, SegmentVisuals);
|
|
277
|
+
}
|
|
278
|
+
exports.SegmentRepresentation = SegmentRepresentation;
|
|
279
|
+
exports.SegmentRepresentationProvider = (0, representation_1.VolumeRepresentationProvider)({
|
|
280
|
+
name: 'segment',
|
|
281
|
+
label: 'Segment',
|
|
282
|
+
description: 'Displays a triangulated segment of volumetric data.',
|
|
283
|
+
factory: SegmentRepresentation,
|
|
284
|
+
getParams: getSegmentParams,
|
|
285
|
+
defaultValues: param_definition_1.ParamDefinition.getDefaultValues(exports.SegmentParams),
|
|
286
|
+
defaultColorTheme: { name: 'volume-segment' },
|
|
287
|
+
defaultSizeTheme: { name: 'uniform' },
|
|
288
|
+
isApplicable: function (volume) { return !volume_1.Volume.isEmpty(volume) && !!volume_1.Volume.Segmentation.get(volume); }
|
|
289
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
2
|
+
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
@@ -10,7 +10,7 @@ import { Volume } from '../../mol-model/volume';
|
|
|
10
10
|
import { VolumeVisual, VolumeRepresentation, VolumeRepresentationProvider } from './representation';
|
|
11
11
|
import { RepresentationContext, RepresentationParamsGetter } from '../representation';
|
|
12
12
|
import { VisualContext } from '../visual';
|
|
13
|
-
export declare function createImage(ctx: VisualContext, volume: Volume, theme: Theme, props: PD.Values<SliceParams>, image?: Image): Promise<Image>;
|
|
13
|
+
export declare function createImage(ctx: VisualContext, volume: Volume, key: number, theme: Theme, props: PD.Values<SliceParams>, image?: Image): Promise<Image>;
|
|
14
14
|
export declare const SliceParams: {
|
|
15
15
|
quality: {
|
|
16
16
|
isEssential: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -20,7 +20,7 @@ var color_1 = require("../../mol-util/color");
|
|
|
20
20
|
var color_2 = require("../../mol-theme/color");
|
|
21
21
|
var number_packing_1 = require("../../mol-util/number-packing");
|
|
22
22
|
var util_2 = require("./util");
|
|
23
|
-
function createImage(ctx, volume, theme, props, image) {
|
|
23
|
+
function createImage(ctx, volume, key, theme, props, image) {
|
|
24
24
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
25
25
|
var dim, isoValue, _a, space, data, _b, min, max, isoVal, color, _c, r, g, b, _d, width, height, x, y, z, x0, y0, z0, nx, ny, nz, corners, imageArray, groupArray, i, iy, ix, iz, val, normVal, imageTexture, groupTexture, transform;
|
|
26
26
|
return tslib_1.__generator(this, function (_e) {
|
|
@@ -130,7 +130,7 @@ function getLoci(volume, props) {
|
|
|
130
130
|
var groupArray = getGroupArray(volume.grid, props);
|
|
131
131
|
return volume_1.Volume.Cell.Loci(volume, int_1.SortedArray.ofUnsortedArray(groupArray));
|
|
132
132
|
}
|
|
133
|
-
function getSliceLoci(pickingId, volume, props, id) {
|
|
133
|
+
function getSliceLoci(pickingId, volume, key, props, id) {
|
|
134
134
|
var objectId = pickingId.objectId, groupId = pickingId.groupId;
|
|
135
135
|
if (id === objectId) {
|
|
136
136
|
var granularity = volume_1.Volume.PickingGranularity.get(volume);
|
|
@@ -146,7 +146,7 @@ function getSliceLoci(pickingId, volume, props, id) {
|
|
|
146
146
|
}
|
|
147
147
|
return loci_1.EmptyLoci;
|
|
148
148
|
}
|
|
149
|
-
function eachSlice(loci, volume, props, apply) {
|
|
149
|
+
function eachSlice(loci, volume, key, props, apply) {
|
|
150
150
|
return (0, util_2.eachVolumeLoci)(loci, volume, undefined, apply);
|
|
151
151
|
}
|
|
152
152
|
//
|
|
@@ -206,5 +206,5 @@ exports.SliceRepresentationProvider = (0, representation_1.VolumeRepresentationP
|
|
|
206
206
|
defaultValues: param_definition_1.ParamDefinition.getDefaultValues(exports.SliceParams),
|
|
207
207
|
defaultColorTheme: { name: 'uniform' },
|
|
208
208
|
defaultSizeTheme: { name: 'uniform' },
|
|
209
|
-
isApplicable: function (volume) { return !volume_1.Volume.isEmpty(volume); }
|
|
209
|
+
isApplicable: function (volume) { return !volume_1.Volume.isEmpty(volume) && !volume_1.Volume.Segmentation.get(volume); }
|
|
210
210
|
});
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
2
|
+
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
6
|
import { Volume } from '../../mol-model/volume';
|
|
7
7
|
import { Loci } from '../../mol-model/loci';
|
|
8
|
-
import { Interval } from '../../mol-data/int';
|
|
8
|
+
import { Interval, SortedArray } from '../../mol-data/int';
|
|
9
9
|
import { Vec3 } from '../../mol-math/linear-algebra/3d/vec3';
|
|
10
|
-
|
|
10
|
+
import { Box3D } from '../../mol-math/geometry';
|
|
11
|
+
export declare function eachVolumeLoci(loci: Loci, volume: Volume, props: {
|
|
12
|
+
isoValue?: Volume.IsoValue;
|
|
13
|
+
segments?: SortedArray;
|
|
14
|
+
} | undefined, apply: (interval: Interval) => boolean): boolean;
|
|
11
15
|
export declare function getVolumeTexture2dLayout(dim: Vec3, padding?: number): {
|
|
12
16
|
width: number;
|
|
13
17
|
height: number;
|
|
@@ -26,3 +30,8 @@ export declare function createVolumeTexture3d(volume: Volume): {
|
|
|
26
30
|
height: number;
|
|
27
31
|
depth: number;
|
|
28
32
|
};
|
|
33
|
+
export declare function createSegmentTexture2d(volume: Volume, set: number[], bbox: Box3D, padding?: number): {
|
|
34
|
+
array: Uint8Array;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createVolumeTexture3d = exports.createVolumeTexture2d = exports.getVolumeTexture2dLayout = exports.eachVolumeLoci = void 0;
|
|
8
|
+
exports.createSegmentTexture2d = exports.createVolumeTexture3d = exports.createVolumeTexture2d = exports.getVolumeTexture2dLayout = exports.eachVolumeLoci = void 0;
|
|
9
9
|
var volume_1 = require("../../mol-model/volume");
|
|
10
10
|
var int_1 = require("../../mol-data/int");
|
|
11
11
|
var common_1 = require("../../mol-math/linear-algebra/3d/common");
|
|
12
12
|
var vec3_1 = require("../../mol-math/linear-algebra/3d/vec3");
|
|
13
13
|
var number_packing_1 = require("../../mol-util/number-packing");
|
|
14
|
+
var set_1 = require("../../mol-util/set");
|
|
15
|
+
var geometry_1 = require("../../mol-math/geometry");
|
|
14
16
|
// avoiding namespace lookup improved performance in Chrome (Aug 2020)
|
|
15
17
|
var v3set = vec3_1.Vec3.set;
|
|
16
18
|
var v3normalize = vec3_1.Vec3.normalize;
|
|
@@ -18,7 +20,7 @@ var v3sub = vec3_1.Vec3.sub;
|
|
|
18
20
|
var v3addScalar = vec3_1.Vec3.addScalar;
|
|
19
21
|
var v3scale = vec3_1.Vec3.scale;
|
|
20
22
|
var v3toArray = vec3_1.Vec3.toArray;
|
|
21
|
-
function eachVolumeLoci(loci, volume,
|
|
23
|
+
function eachVolumeLoci(loci, volume, props, apply) {
|
|
22
24
|
var changed = false;
|
|
23
25
|
if (volume_1.Volume.isLoci(loci)) {
|
|
24
26
|
if (!volume_1.Volume.areEquivalent(loci.volume, volume))
|
|
@@ -29,14 +31,13 @@ function eachVolumeLoci(loci, volume, isoValue, apply) {
|
|
|
29
31
|
else if (volume_1.Volume.Isosurface.isLoci(loci)) {
|
|
30
32
|
if (!volume_1.Volume.areEquivalent(loci.volume, volume))
|
|
31
33
|
return false;
|
|
32
|
-
if (isoValue) {
|
|
33
|
-
if (!volume_1.Volume.IsoValue.areSame(loci.isoValue, isoValue, volume.grid.stats))
|
|
34
|
+
if (props === null || props === void 0 ? void 0 : props.isoValue) {
|
|
35
|
+
if (!volume_1.Volume.IsoValue.areSame(loci.isoValue, props.isoValue, volume.grid.stats))
|
|
34
36
|
return false;
|
|
35
37
|
if (apply(int_1.Interval.ofLength(volume.grid.cells.data.length)))
|
|
36
38
|
changed = true;
|
|
37
39
|
}
|
|
38
40
|
else {
|
|
39
|
-
// TODO find a cheaper way?
|
|
40
41
|
var _a = volume.grid, stats = _a.stats, data = _a.cells.data;
|
|
41
42
|
var eps = stats.sigma;
|
|
42
43
|
var v = volume_1.Volume.IsoValue.toAbsolute(loci.isoValue, stats).absoluteValue;
|
|
@@ -62,6 +63,33 @@ function eachVolumeLoci(loci, volume, isoValue, apply) {
|
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
}
|
|
66
|
+
else if (volume_1.Volume.Segment.isLoci(loci)) {
|
|
67
|
+
if (!volume_1.Volume.areEquivalent(loci.volume, volume))
|
|
68
|
+
return false;
|
|
69
|
+
if (props === null || props === void 0 ? void 0 : props.segments) {
|
|
70
|
+
if (!int_1.SortedArray.areIntersecting(loci.segments, props.segments))
|
|
71
|
+
return false;
|
|
72
|
+
if (apply(int_1.Interval.ofLength(volume.grid.cells.data.length)))
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
var segmentation = volume_1.Volume.Segmentation.get(volume);
|
|
77
|
+
if (segmentation) {
|
|
78
|
+
var set = new Set();
|
|
79
|
+
for (var i = 0, il = loci.segments.length; i < il; ++i) {
|
|
80
|
+
set_1.SetUtils.add(set, segmentation.segments.get(loci.segments[i]));
|
|
81
|
+
}
|
|
82
|
+
var s = Array.from(set.values());
|
|
83
|
+
var d = volume.grid.cells.data;
|
|
84
|
+
for (var i = 0, il = d.length; i < il; ++i) {
|
|
85
|
+
if (s.includes(d[i])) {
|
|
86
|
+
if (apply(int_1.Interval.ofSingleton(i)))
|
|
87
|
+
changed = true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
65
93
|
return changed;
|
|
66
94
|
}
|
|
67
95
|
exports.eachVolumeLoci = eachVolumeLoci;
|
|
@@ -165,3 +193,41 @@ function createVolumeTexture3d(volume) {
|
|
|
165
193
|
return textureVolume;
|
|
166
194
|
}
|
|
167
195
|
exports.createVolumeTexture3d = createVolumeTexture3d;
|
|
196
|
+
function createSegmentTexture2d(volume, set, bbox, padding) {
|
|
197
|
+
if (padding === void 0) { padding = 0; }
|
|
198
|
+
var data = volume.grid.cells.data;
|
|
199
|
+
var dim = geometry_1.Box3D.size((0, vec3_1.Vec3)(), bbox);
|
|
200
|
+
var o = volume.grid.cells.space.dataOffset;
|
|
201
|
+
var _a = getVolumeTexture2dLayout(dim, padding), width = _a.width, height = _a.height;
|
|
202
|
+
var itemSize = 1;
|
|
203
|
+
var array = new Uint8Array(width * height * itemSize);
|
|
204
|
+
var textureImage = { array: array, width: width, height: height };
|
|
205
|
+
var xn = dim[0], yn = dim[1], zn = dim[2];
|
|
206
|
+
var xn1 = xn - 1;
|
|
207
|
+
var yn1 = yn - 1;
|
|
208
|
+
var zn1 = zn - 1;
|
|
209
|
+
var xnp = xn + padding;
|
|
210
|
+
var ynp = yn + padding;
|
|
211
|
+
var _b = bbox.min, minx = _b[0], miny = _b[1], minz = _b[2];
|
|
212
|
+
var _c = bbox.max, maxx = _c[0], maxy = _c[1], maxz = _c[2];
|
|
213
|
+
for (var z = 0; z < zn; ++z) {
|
|
214
|
+
for (var y = 0; y < yn; ++y) {
|
|
215
|
+
for (var x = 0; x < xn; ++x) {
|
|
216
|
+
var column = Math.floor(((z * xnp) % width) / xnp);
|
|
217
|
+
var row = Math.floor((z * xnp) / width);
|
|
218
|
+
var px = column * xnp + x;
|
|
219
|
+
var index = itemSize * ((row * ynp * width) + (y * width) + px);
|
|
220
|
+
var v0 = set.includes(data[o(x + minx, y + miny, z + minz)]) ? 255 : 0;
|
|
221
|
+
var xp = set.includes(data[o(Math.min(xn1 + maxx, x + 1 + minx), y + miny, z + minz)]) ? 255 : 0;
|
|
222
|
+
var xn_1 = set.includes(data[o(Math.max(0, x - 1 + minx), y + miny, z + minz)]) ? 255 : 0;
|
|
223
|
+
var yp = set.includes(data[o(x + minx, Math.min(yn1 + maxy, y + 1 + miny), z + minz)]) ? 255 : 0;
|
|
224
|
+
var yn_1 = set.includes(data[o(x + minx, Math.max(0, y - 1 + miny), z + minz)]) ? 255 : 0;
|
|
225
|
+
var zp = set.includes(data[o(x + minx, y + miny, Math.min(zn1 + maxz, z + 1 + minz))]) ? 255 : 0;
|
|
226
|
+
var zn_1 = set.includes(data[o(x + minx, y + miny, Math.max(0, z - 1 + minz))]) ? 255 : 0;
|
|
227
|
+
array[index] = Math.round((v0 + v0 + xp + xn_1 + yp + yn_1 + zp + zn_1) / 8);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return textureImage;
|
|
232
|
+
}
|
|
233
|
+
exports.createSegmentTexture2d = createSegmentTexture2d;
|
|
@@ -10,6 +10,7 @@ export declare namespace MolScriptBuilder {
|
|
|
10
10
|
'@header': string;
|
|
11
11
|
type: {
|
|
12
12
|
'@header': string;
|
|
13
|
+
/** atom macromolecular property set */
|
|
13
14
|
bool: MSymbol<import("./symbol").Arguments<import("./symbol").Arguments.PropTypes<{
|
|
14
15
|
0: import("./symbol").Argument<import("./type").Type.AnyValue>;
|
|
15
16
|
}>>, import("./type").Type.OneOf<boolean>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
|
+
*/
|
|
6
|
+
import { ColorTheme } from '../color';
|
|
7
|
+
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
8
|
+
import { ThemeDataContext } from '../../mol-theme/theme';
|
|
9
|
+
export declare const VolumeSegmentColorThemeParams: {
|
|
10
|
+
palette: PD.Mapped<PD.NamedParams<PD.Normalize<{
|
|
11
|
+
maxCount: number;
|
|
12
|
+
hue: [number, number];
|
|
13
|
+
chroma: [number, number];
|
|
14
|
+
luminance: [number, number];
|
|
15
|
+
clusteringStepCount: number;
|
|
16
|
+
minSampleCount: number;
|
|
17
|
+
}>, "generate"> | PD.NamedParams<PD.Normalize<{
|
|
18
|
+
list: {
|
|
19
|
+
kind: "set" | "interpolate";
|
|
20
|
+
colors: import("../../mol-util/color/color").ColorListEntry[];
|
|
21
|
+
};
|
|
22
|
+
}>, "colors">>;
|
|
23
|
+
};
|
|
24
|
+
export type VolumeSegmentColorThemeParams = typeof VolumeSegmentColorThemeParams;
|
|
25
|
+
export declare function getVolumeSegmentColorThemeParams(ctx: ThemeDataContext): {
|
|
26
|
+
palette: PD.Mapped<PD.NamedParams<PD.Normalize<{
|
|
27
|
+
maxCount: number;
|
|
28
|
+
hue: [number, number];
|
|
29
|
+
chroma: [number, number];
|
|
30
|
+
luminance: [number, number];
|
|
31
|
+
clusteringStepCount: number;
|
|
32
|
+
minSampleCount: number;
|
|
33
|
+
}>, "generate"> | PD.NamedParams<PD.Normalize<{
|
|
34
|
+
list: {
|
|
35
|
+
kind: "set" | "interpolate";
|
|
36
|
+
colors: import("../../mol-util/color/color").ColorListEntry[];
|
|
37
|
+
};
|
|
38
|
+
}>, "colors">>;
|
|
39
|
+
};
|
|
40
|
+
export declare function VolumeSegmentColorTheme(ctx: ThemeDataContext, props: PD.Values<VolumeSegmentColorThemeParams>): ColorTheme<VolumeSegmentColorThemeParams>;
|
|
41
|
+
export declare const VolumeSegmentColorThemeProvider: ColorTheme.Provider<VolumeSegmentColorThemeParams, 'volume-segment'>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VolumeSegmentColorThemeProvider = exports.VolumeSegmentColorTheme = exports.getVolumeSegmentColorThemeParams = exports.VolumeSegmentColorThemeParams = void 0;
|
|
9
|
+
var tslib_1 = require("tslib");
|
|
10
|
+
var color_1 = require("../../mol-util/color");
|
|
11
|
+
var param_definition_1 = require("../../mol-util/param-definition");
|
|
12
|
+
var palette_1 = require("../../mol-util/color/palette");
|
|
13
|
+
var volume_1 = require("../../mol-model/volume/volume");
|
|
14
|
+
var DefaultColor = (0, color_1.Color)(0xCCCCCC);
|
|
15
|
+
var Description = 'Gives every volume segment a unique color.';
|
|
16
|
+
exports.VolumeSegmentColorThemeParams = tslib_1.__assign({}, (0, palette_1.getPaletteParams)({ type: 'colors', colorList: 'many-distinct' }));
|
|
17
|
+
function getVolumeSegmentColorThemeParams(ctx) {
|
|
18
|
+
return param_definition_1.ParamDefinition.clone(exports.VolumeSegmentColorThemeParams);
|
|
19
|
+
}
|
|
20
|
+
exports.getVolumeSegmentColorThemeParams = getVolumeSegmentColorThemeParams;
|
|
21
|
+
function VolumeSegmentColorTheme(ctx, props) {
|
|
22
|
+
var color;
|
|
23
|
+
var legend;
|
|
24
|
+
var segmentation = ctx.volume && volume_1.Volume.Segmentation.get(ctx.volume);
|
|
25
|
+
if (segmentation) {
|
|
26
|
+
var size = segmentation.segments.size;
|
|
27
|
+
var segments_1 = Array.from(segmentation.segments.keys());
|
|
28
|
+
var palette_2 = (0, palette_1.getPalette)(size, props);
|
|
29
|
+
legend = palette_2.legend;
|
|
30
|
+
color = function (location) {
|
|
31
|
+
if (volume_1.Volume.Segment.isLocation(location)) {
|
|
32
|
+
return palette_2.color(segments_1.indexOf(location.segment));
|
|
33
|
+
}
|
|
34
|
+
return DefaultColor;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
color = function () { return DefaultColor; };
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
factory: VolumeSegmentColorTheme,
|
|
42
|
+
granularity: 'instance',
|
|
43
|
+
color: color,
|
|
44
|
+
props: props,
|
|
45
|
+
description: Description,
|
|
46
|
+
legend: legend
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.VolumeSegmentColorTheme = VolumeSegmentColorTheme;
|
|
50
|
+
exports.VolumeSegmentColorThemeProvider = {
|
|
51
|
+
name: 'volume-segment',
|
|
52
|
+
label: 'Volume Segment',
|
|
53
|
+
category: "Miscellaneous" /* ColorTheme.Category.Misc */,
|
|
54
|
+
factory: VolumeSegmentColorTheme,
|
|
55
|
+
getParams: getVolumeSegmentColorThemeParams,
|
|
56
|
+
defaultValues: param_definition_1.ParamDefinition.getDefaultValues(exports.VolumeSegmentColorThemeParams),
|
|
57
|
+
isApplicable: function (ctx) { return !!ctx.volume && !!volume_1.Volume.Segmentation.get(ctx.volume); }
|
|
58
|
+
};
|
|
@@ -9,6 +9,7 @@ exports.VolumeValueColorThemeProvider = exports.VolumeValueColorTheme = exports.
|
|
|
9
9
|
var color_1 = require("../../mol-util/color");
|
|
10
10
|
var param_definition_1 = require("../../mol-util/param-definition");
|
|
11
11
|
var names_1 = require("../../mol-util/color/names");
|
|
12
|
+
var volume_1 = require("../../mol-model/volume/volume");
|
|
12
13
|
var Description = 'Assign color based on the given value of a volume cell.';
|
|
13
14
|
exports.VolumeValueColorThemeParams = {
|
|
14
15
|
colorList: param_definition_1.ParamDefinition.ColorList({
|
|
@@ -50,5 +51,5 @@ exports.VolumeValueColorThemeProvider = {
|
|
|
50
51
|
factory: VolumeValueColorTheme,
|
|
51
52
|
getParams: getVolumeValueColorThemeParams,
|
|
52
53
|
defaultValues: param_definition_1.ParamDefinition.getDefaultValues(exports.VolumeValueColorThemeParams),
|
|
53
|
-
isApplicable: function (ctx) { return !!ctx.volume; },
|
|
54
|
+
isApplicable: function (ctx) { return !!ctx.volume && !volume_1.Volume.Segmentation.get(ctx.volume); },
|
|
54
55
|
};
|
|
@@ -629,6 +629,21 @@ declare namespace ColorTheme {
|
|
|
629
629
|
uniform: Provider<{
|
|
630
630
|
value: PD.Color;
|
|
631
631
|
}, "uniform", ColorType>;
|
|
632
|
+
'volume-segment': Provider<{
|
|
633
|
+
palette: PD.Mapped<PD.NamedParams<PD.Normalize<{
|
|
634
|
+
maxCount: number;
|
|
635
|
+
hue: [number, number];
|
|
636
|
+
chroma: [number, number];
|
|
637
|
+
luminance: [number, number];
|
|
638
|
+
clusteringStepCount: number;
|
|
639
|
+
minSampleCount: number;
|
|
640
|
+
}>, "generate"> | PD.NamedParams<PD.Normalize<{
|
|
641
|
+
list: {
|
|
642
|
+
kind: "set" | "interpolate";
|
|
643
|
+
colors: import("../mol-util/color/color").ColorListEntry[];
|
|
644
|
+
};
|
|
645
|
+
}>, "colors">>;
|
|
646
|
+
}, "volume-segment", ColorType>;
|
|
632
647
|
'volume-value': Provider<{
|
|
633
648
|
colorList: PD.ColorList;
|
|
634
649
|
}, "volume-value", ColorType>;
|