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,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VolsegLatticeSegmentationData = void 0;
|
|
9
|
+
var tslib_1 = require("tslib");
|
|
10
|
+
var volume_1 = require("../../mol-model/volume");
|
|
11
|
+
var volume_representation_params_1 = require("../../mol-plugin-state/helpers/volume-representation-params");
|
|
12
|
+
var transforms_1 = require("../../mol-plugin-state/transforms");
|
|
13
|
+
var data_1 = require("../../mol-plugin-state/transforms/data");
|
|
14
|
+
var misc_1 = require("../../mol-plugin-state/transforms/misc");
|
|
15
|
+
var volume_2 = require("../../mol-plugin-state/transforms/volume");
|
|
16
|
+
var commands_1 = require("../../mol-plugin/commands");
|
|
17
|
+
var color_1 = require("../../mol-util/color");
|
|
18
|
+
var entry_root_1 = require("./entry-root");
|
|
19
|
+
var global_state_1 = require("./global-state");
|
|
20
|
+
var GROUP_TAG = 'lattice-segmentation-group';
|
|
21
|
+
var SEGMENT_VISUAL_TAG = 'lattice-segment-visual';
|
|
22
|
+
var DEFAULT_SEGMENT_COLOR = color_1.Color.fromNormalizedRgb(0.8, 0.8, 0.8);
|
|
23
|
+
var VolsegLatticeSegmentationData = /** @class */ (function () {
|
|
24
|
+
function VolsegLatticeSegmentationData(rootData) {
|
|
25
|
+
this.entryData = rootData;
|
|
26
|
+
}
|
|
27
|
+
VolsegLatticeSegmentationData.prototype.loadSegmentation = function () {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
30
|
+
var hasLattices, url, group, newGroupNode, segmentLabels, volumeNode, volumeData, segmentation, segmentIds;
|
|
31
|
+
return tslib_1.__generator(this, function (_d) {
|
|
32
|
+
switch (_d.label) {
|
|
33
|
+
case 0:
|
|
34
|
+
hasLattices = this.entryData.metadata.raw.grid.segmentation_lattices.segmentation_lattice_ids.length > 0;
|
|
35
|
+
if (!hasLattices) return [3 /*break*/, 5];
|
|
36
|
+
url = this.entryData.api.latticeUrl(this.entryData.source, this.entryData.entryId, 0, entry_root_1.BOX, entry_root_1.MAX_VOXELS);
|
|
37
|
+
group = (_a = this.entryData.findNodesByTags(GROUP_TAG)[0]) === null || _a === void 0 ? void 0 : _a.transform.ref;
|
|
38
|
+
if (!!group) return [3 /*break*/, 2];
|
|
39
|
+
return [4 /*yield*/, this.entryData.newUpdate().apply(misc_1.CreateGroup, { label: 'Segmentation', description: 'Lattice' }, { tags: [GROUP_TAG], state: { isCollapsed: true } }).commit()];
|
|
40
|
+
case 1:
|
|
41
|
+
newGroupNode = _d.sent();
|
|
42
|
+
group = newGroupNode.ref;
|
|
43
|
+
_d.label = 2;
|
|
44
|
+
case 2:
|
|
45
|
+
segmentLabels = this.entryData.metadata.allSegments.map(function (seg) { return ({ id: seg.id, label: seg.biological_annotation.name ? "<b>".concat(seg.biological_annotation.name, "</b>") : '' }); });
|
|
46
|
+
return [4 /*yield*/, this.entryData.newUpdate().to(group)
|
|
47
|
+
.apply(data_1.Download, { url: url, isBinary: true, label: "Segmentation Data: ".concat(url) })
|
|
48
|
+
.apply(data_1.ParseCif)
|
|
49
|
+
.apply(volume_2.VolumeFromSegmentationCif, { blockHeader: 'SEGMENTATION_DATA', segmentLabels: segmentLabels, ownerId: this.entryData.ref })
|
|
50
|
+
.commit()];
|
|
51
|
+
case 3:
|
|
52
|
+
volumeNode = _d.sent();
|
|
53
|
+
volumeData = volumeNode.data;
|
|
54
|
+
segmentation = volume_1.Volume.Segmentation.get(volumeData);
|
|
55
|
+
segmentIds = Array.from((_b = segmentation === null || segmentation === void 0 ? void 0 : segmentation.segments.keys()) !== null && _b !== void 0 ? _b : []);
|
|
56
|
+
return [4 /*yield*/, this.entryData.newUpdate().to(volumeNode)
|
|
57
|
+
.apply(transforms_1.StateTransforms.Representation.VolumeRepresentation3D, (0, volume_representation_params_1.createVolumeRepresentationParams)(this.entryData.plugin, volumeData, {
|
|
58
|
+
type: 'segment',
|
|
59
|
+
typeParams: { tryUseGpu: (_c = global_state_1.VolsegGlobalStateData.getGlobalState(this.entryData.plugin)) === null || _c === void 0 ? void 0 : _c.tryUseGpu },
|
|
60
|
+
color: 'volume-segment',
|
|
61
|
+
colorParams: { palette: this.createPalette(segmentIds) },
|
|
62
|
+
}), { tags: [SEGMENT_VISUAL_TAG] }).commit()];
|
|
63
|
+
case 4:
|
|
64
|
+
_d.sent();
|
|
65
|
+
_d.label = 5;
|
|
66
|
+
case 5: return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
VolsegLatticeSegmentationData.prototype.createPalette = function (segmentIds) {
|
|
72
|
+
var colorMap = new Map();
|
|
73
|
+
for (var _i = 0, _a = this.entryData.metadata.allSegments; _i < _a.length; _i++) {
|
|
74
|
+
var segment = _a[_i];
|
|
75
|
+
var color = color_1.Color.fromNormalizedArray(segment.colour, 0);
|
|
76
|
+
colorMap.set(segment.id, color);
|
|
77
|
+
}
|
|
78
|
+
if (colorMap.size === 0)
|
|
79
|
+
return undefined;
|
|
80
|
+
for (var _b = 0, segmentIds_1 = segmentIds; _b < segmentIds_1.length; _b++) {
|
|
81
|
+
var segid = segmentIds_1[_b];
|
|
82
|
+
colorMap.get(segid);
|
|
83
|
+
}
|
|
84
|
+
var colors = segmentIds.map(function (segid) { var _a; return (_a = colorMap.get(segid)) !== null && _a !== void 0 ? _a : DEFAULT_SEGMENT_COLOR; });
|
|
85
|
+
return { name: 'colors', params: { list: { kind: 'set', colors: colors } } };
|
|
86
|
+
};
|
|
87
|
+
VolsegLatticeSegmentationData.prototype.updateOpacity = function (opacity) {
|
|
88
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
89
|
+
var reprs, update, _i, reprs_1, s;
|
|
90
|
+
return tslib_1.__generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
reprs = this.entryData.findNodesByTags(SEGMENT_VISUAL_TAG);
|
|
94
|
+
update = this.entryData.newUpdate();
|
|
95
|
+
for (_i = 0, reprs_1 = reprs; _i < reprs_1.length; _i++) {
|
|
96
|
+
s = reprs_1[_i];
|
|
97
|
+
update.to(s).update(transforms_1.StateTransforms.Representation.VolumeRepresentation3D, function (p) { p.type.params.alpha = opacity; });
|
|
98
|
+
}
|
|
99
|
+
return [4 /*yield*/, update.commit()];
|
|
100
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
VolsegLatticeSegmentationData.prototype.makeLoci = function (segments) {
|
|
106
|
+
var _a;
|
|
107
|
+
var vis = this.entryData.findNodesByTags(SEGMENT_VISUAL_TAG)[0];
|
|
108
|
+
if (!vis)
|
|
109
|
+
return undefined;
|
|
110
|
+
var repr = (_a = vis.obj) === null || _a === void 0 ? void 0 : _a.data.repr;
|
|
111
|
+
var wholeLoci = repr.getAllLoci()[0];
|
|
112
|
+
if (!wholeLoci || !volume_1.Volume.Segment.isLoci(wholeLoci))
|
|
113
|
+
return undefined;
|
|
114
|
+
return { loci: volume_1.Volume.Segment.Loci(wholeLoci.volume, segments), repr: repr };
|
|
115
|
+
};
|
|
116
|
+
VolsegLatticeSegmentationData.prototype.highlightSegment = function (segment) {
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var segmentLoci;
|
|
119
|
+
return tslib_1.__generator(this, function (_a) {
|
|
120
|
+
segmentLoci = this.makeLoci([segment.id]);
|
|
121
|
+
if (!segmentLoci)
|
|
122
|
+
return [2 /*return*/];
|
|
123
|
+
this.entryData.plugin.managers.interactivity.lociHighlights.highlight(segmentLoci, false);
|
|
124
|
+
return [2 /*return*/];
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
VolsegLatticeSegmentationData.prototype.selectSegment = function (segment) {
|
|
129
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var segmentLoci;
|
|
131
|
+
return tslib_1.__generator(this, function (_a) {
|
|
132
|
+
if (segment === undefined || segment < 0)
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
segmentLoci = this.makeLoci([segment]);
|
|
135
|
+
if (!segmentLoci)
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
this.entryData.plugin.managers.interactivity.lociSelects.select(segmentLoci, false);
|
|
138
|
+
return [2 /*return*/];
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
/** Make visible the specified set of lattice segments */
|
|
143
|
+
VolsegLatticeSegmentationData.prototype.showSegments = function (segments) {
|
|
144
|
+
var _a;
|
|
145
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
146
|
+
var repr, selectedSegment, mustReselect, update;
|
|
147
|
+
return tslib_1.__generator(this, function (_b) {
|
|
148
|
+
switch (_b.label) {
|
|
149
|
+
case 0:
|
|
150
|
+
repr = this.entryData.findNodesByTags(SEGMENT_VISUAL_TAG)[0];
|
|
151
|
+
if (!repr)
|
|
152
|
+
return [2 /*return*/];
|
|
153
|
+
selectedSegment = this.entryData.currentState.value.selectedSegment;
|
|
154
|
+
mustReselect = segments.includes(selectedSegment) && !((_a = repr.params) === null || _a === void 0 ? void 0 : _a.values.type.params.segments.includes(selectedSegment));
|
|
155
|
+
update = this.entryData.newUpdate();
|
|
156
|
+
update.to(repr).update(transforms_1.StateTransforms.Representation.VolumeRepresentation3D, function (p) { p.type.params.segments = segments; });
|
|
157
|
+
return [4 /*yield*/, update.commit()];
|
|
158
|
+
case 1:
|
|
159
|
+
_b.sent();
|
|
160
|
+
if (!mustReselect) return [3 /*break*/, 3];
|
|
161
|
+
return [4 /*yield*/, this.selectSegment(this.entryData.currentState.value.selectedSegment)];
|
|
162
|
+
case 2:
|
|
163
|
+
_b.sent();
|
|
164
|
+
_b.label = 3;
|
|
165
|
+
case 3: return [2 /*return*/];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
VolsegLatticeSegmentationData.prototype.setTryUseGpu = function (tryUseGpu) {
|
|
171
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
172
|
+
var visuals, _i, visuals_1, visual, oldParams, newParams, update;
|
|
173
|
+
return tslib_1.__generator(this, function (_a) {
|
|
174
|
+
switch (_a.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
visuals = this.entryData.findNodesByTags(SEGMENT_VISUAL_TAG);
|
|
177
|
+
_i = 0, visuals_1 = visuals;
|
|
178
|
+
_a.label = 1;
|
|
179
|
+
case 1:
|
|
180
|
+
if (!(_i < visuals_1.length)) return [3 /*break*/, 4];
|
|
181
|
+
visual = visuals_1[_i];
|
|
182
|
+
oldParams = visual.transform.params;
|
|
183
|
+
if (!(oldParams.type.params.tryUseGpu === !tryUseGpu)) return [3 /*break*/, 3];
|
|
184
|
+
newParams = tslib_1.__assign(tslib_1.__assign({}, oldParams), { type: tslib_1.__assign(tslib_1.__assign({}, oldParams.type), { params: tslib_1.__assign(tslib_1.__assign({}, oldParams.type.params), { tryUseGpu: tryUseGpu }) }) });
|
|
185
|
+
update = this.entryData.newUpdate().to(visual.transform.ref).update(newParams);
|
|
186
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.entryData.plugin, { state: this.entryData.plugin.state.data, tree: update, options: { doNotUpdateCurrent: true } })];
|
|
187
|
+
case 2:
|
|
188
|
+
_a.sent();
|
|
189
|
+
_a.label = 3;
|
|
190
|
+
case 3:
|
|
191
|
+
_i++;
|
|
192
|
+
return [3 /*break*/, 1];
|
|
193
|
+
case 4: return [2 /*return*/];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
return VolsegLatticeSegmentationData;
|
|
199
|
+
}());
|
|
200
|
+
exports.VolsegLatticeSegmentationData = VolsegLatticeSegmentationData;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { PluginStateObject } from '../../mol-plugin-state/objects';
|
|
7
|
+
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
8
|
+
import { Choice } from './helpers';
|
|
9
|
+
export declare const VolumeTypeChoice: Choice<"off" | "direct-volume" | "isosurface", "isosurface">;
|
|
10
|
+
export type VolumeType = Choice.Values<typeof VolumeTypeChoice>;
|
|
11
|
+
export declare const VolsegStateParams: {
|
|
12
|
+
volumeType: PD.Select<"off" | "direct-volume" | "isosurface">;
|
|
13
|
+
volumeIsovalueKind: PD.Select<string>;
|
|
14
|
+
volumeIsovalueValue: PD.Numeric;
|
|
15
|
+
volumeOpacity: PD.Numeric;
|
|
16
|
+
segmentOpacity: PD.Numeric;
|
|
17
|
+
selectedSegment: PD.Numeric;
|
|
18
|
+
visibleSegments: PD.ObjectList<PD.Normalize<{
|
|
19
|
+
segmentId: number;
|
|
20
|
+
}>>;
|
|
21
|
+
visibleModels: PD.ObjectList<PD.Normalize<{
|
|
22
|
+
pdbId: string;
|
|
23
|
+
}>>;
|
|
24
|
+
};
|
|
25
|
+
export type VolsegStateData = PD.Values<typeof VolsegStateParams>;
|
|
26
|
+
declare const VolsegState_base: {
|
|
27
|
+
new (data: PD.Values<{
|
|
28
|
+
volumeType: PD.Select<"off" | "direct-volume" | "isosurface">;
|
|
29
|
+
volumeIsovalueKind: PD.Select<string>;
|
|
30
|
+
volumeIsovalueValue: PD.Numeric;
|
|
31
|
+
volumeOpacity: PD.Numeric;
|
|
32
|
+
segmentOpacity: PD.Numeric;
|
|
33
|
+
selectedSegment: PD.Numeric;
|
|
34
|
+
visibleSegments: PD.ObjectList<PD.Normalize<{
|
|
35
|
+
segmentId: number;
|
|
36
|
+
}>>;
|
|
37
|
+
visibleModels: PD.ObjectList<PD.Normalize<{
|
|
38
|
+
pdbId: string;
|
|
39
|
+
}>>;
|
|
40
|
+
}>, props?: {
|
|
41
|
+
label: string;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
} | undefined): {
|
|
44
|
+
id: import("../../mol-util/uuid").UUID;
|
|
45
|
+
type: PluginStateObject.TypeInfo;
|
|
46
|
+
label: string;
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
data: PD.Values<{
|
|
49
|
+
volumeType: PD.Select<"off" | "direct-volume" | "isosurface">;
|
|
50
|
+
volumeIsovalueKind: PD.Select<string>;
|
|
51
|
+
volumeIsovalueValue: PD.Numeric;
|
|
52
|
+
volumeOpacity: PD.Numeric;
|
|
53
|
+
segmentOpacity: PD.Numeric;
|
|
54
|
+
selectedSegment: PD.Numeric;
|
|
55
|
+
visibleSegments: PD.ObjectList<PD.Normalize<{
|
|
56
|
+
segmentId: number;
|
|
57
|
+
}>>;
|
|
58
|
+
visibleModels: PD.ObjectList<PD.Normalize<{
|
|
59
|
+
pdbId: string;
|
|
60
|
+
}>>;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
63
|
+
type: PluginStateObject.TypeInfo;
|
|
64
|
+
is(obj?: import("../../mol-state/object").StateObject<any, import("../../mol-state/object").StateObject.Type<any>> | undefined): obj is {
|
|
65
|
+
id: import("../../mol-util/uuid").UUID;
|
|
66
|
+
type: PluginStateObject.TypeInfo;
|
|
67
|
+
label: string;
|
|
68
|
+
description?: string | undefined;
|
|
69
|
+
data: PD.Values<{
|
|
70
|
+
volumeType: PD.Select<"off" | "direct-volume" | "isosurface">;
|
|
71
|
+
volumeIsovalueKind: PD.Select<string>;
|
|
72
|
+
volumeIsovalueValue: PD.Numeric;
|
|
73
|
+
volumeOpacity: PD.Numeric;
|
|
74
|
+
segmentOpacity: PD.Numeric;
|
|
75
|
+
selectedSegment: PD.Numeric;
|
|
76
|
+
visibleSegments: PD.ObjectList<PD.Normalize<{
|
|
77
|
+
segmentId: number;
|
|
78
|
+
}>>;
|
|
79
|
+
visibleModels: PD.ObjectList<PD.Normalize<{
|
|
80
|
+
pdbId: string;
|
|
81
|
+
}>>;
|
|
82
|
+
}>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export declare class VolsegState extends VolsegState_base {
|
|
86
|
+
}
|
|
87
|
+
export declare const VOLSEG_STATE_FROM_ENTRY_TRANSFORMER_NAME = "volseg-state-from-entry";
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VOLSEG_STATE_FROM_ENTRY_TRANSFORMER_NAME = exports.VolsegState = exports.VolsegStateParams = exports.VolumeTypeChoice = void 0;
|
|
9
|
+
var tslib_1 = require("tslib");
|
|
10
|
+
var objects_1 = require("../../mol-plugin-state/objects");
|
|
11
|
+
var param_definition_1 = require("../../mol-util/param-definition");
|
|
12
|
+
var helpers_1 = require("./helpers");
|
|
13
|
+
exports.VolumeTypeChoice = new helpers_1.Choice({ 'isosurface': 'Isosurface', 'direct-volume': 'Direct volume', 'off': 'Off' }, 'isosurface');
|
|
14
|
+
exports.VolsegStateParams = {
|
|
15
|
+
volumeType: exports.VolumeTypeChoice.PDSelect(),
|
|
16
|
+
volumeIsovalueKind: param_definition_1.ParamDefinition.Select('relative', [['relative', 'Relative'], ['absolute', 'Absolute']]),
|
|
17
|
+
volumeIsovalueValue: param_definition_1.ParamDefinition.Numeric(1),
|
|
18
|
+
volumeOpacity: param_definition_1.ParamDefinition.Numeric(0.2, { min: 0, max: 1, step: 0.05 }),
|
|
19
|
+
segmentOpacity: param_definition_1.ParamDefinition.Numeric(1, { min: 0, max: 1, step: 0.05 }),
|
|
20
|
+
selectedSegment: param_definition_1.ParamDefinition.Numeric(-1, { step: 1 }),
|
|
21
|
+
visibleSegments: param_definition_1.ParamDefinition.ObjectList({ segmentId: param_definition_1.ParamDefinition.Numeric(0) }, function (s) { return s.segmentId.toString(); }),
|
|
22
|
+
visibleModels: param_definition_1.ParamDefinition.ObjectList({ pdbId: param_definition_1.ParamDefinition.Text('') }, function (s) { return s.pdbId.toString(); }),
|
|
23
|
+
};
|
|
24
|
+
var VolsegState = /** @class */ (function (_super) {
|
|
25
|
+
tslib_1.__extends(VolsegState, _super);
|
|
26
|
+
function VolsegState() {
|
|
27
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
}
|
|
29
|
+
return VolsegState;
|
|
30
|
+
}(objects_1.PluginStateObject.Create({ name: 'Vol & Seg Entry State', typeClass: 'Data' })));
|
|
31
|
+
exports.VolsegState = VolsegState;
|
|
32
|
+
exports.VOLSEG_STATE_FROM_ENTRY_TRANSFORMER_NAME = 'volseg-state-from-entry'; // defined here to avoid cyclic dependency
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { createVolumeRepresentationParams } from '../../mol-plugin-state/helpers/volume-representation-params';
|
|
7
|
+
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
8
|
+
import { VolsegEntryData } from './entry-root';
|
|
9
|
+
export declare const VOLUME_VISUAL_TAG = "volume-visual";
|
|
10
|
+
export type VolumeVisualParams = ReturnType<typeof createVolumeRepresentationParams>;
|
|
11
|
+
export declare const SimpleVolumeParams: {
|
|
12
|
+
volumeType: PD.Select<"off" | "direct-volume" | "isosurface">;
|
|
13
|
+
opacity: PD.Numeric;
|
|
14
|
+
};
|
|
15
|
+
export type SimpleVolumeParamValues = PD.Values<typeof SimpleVolumeParams>;
|
|
16
|
+
export declare class VolsegVolumeData {
|
|
17
|
+
private entryData;
|
|
18
|
+
private visualTypeParamCache;
|
|
19
|
+
constructor(rootData: VolsegEntryData);
|
|
20
|
+
loadVolume(): Promise<{
|
|
21
|
+
isovalue: Readonly<{
|
|
22
|
+
kind: "absolute";
|
|
23
|
+
absoluteValue: number;
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
kind: "relative";
|
|
26
|
+
relativeValue: number;
|
|
27
|
+
}>;
|
|
28
|
+
} | undefined>;
|
|
29
|
+
setVolumeVisual(type: 'isosurface' | 'direct-volume' | 'off'): Promise<void>;
|
|
30
|
+
updateVolumeVisual(newParams: SimpleVolumeParamValues): Promise<void>;
|
|
31
|
+
setTryUseGpu(tryUseGpu: boolean): Promise<void>;
|
|
32
|
+
private getIsovalueFromState;
|
|
33
|
+
private createVolumeVisualParams;
|
|
34
|
+
private changeIsovalueInVolumeVisualParams;
|
|
35
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VolsegVolumeData = exports.SimpleVolumeParams = exports.VOLUME_VISUAL_TAG = void 0;
|
|
9
|
+
var tslib_1 = require("tslib");
|
|
10
|
+
var linear_algebra_1 = require("../../mol-math/linear-algebra");
|
|
11
|
+
var volume_1 = require("../../mol-model/volume");
|
|
12
|
+
var volume_representation_params_1 = require("../../mol-plugin-state/helpers/volume-representation-params");
|
|
13
|
+
var transforms_1 = require("../../mol-plugin-state/transforms");
|
|
14
|
+
var data_1 = require("../../mol-plugin-state/transforms/data");
|
|
15
|
+
var misc_1 = require("../../mol-plugin-state/transforms/misc");
|
|
16
|
+
var state_1 = require("../../mol-plugin/behavior/static/state");
|
|
17
|
+
var commands_1 = require("../../mol-plugin/commands");
|
|
18
|
+
var color_1 = require("../../mol-util/color");
|
|
19
|
+
var param_definition_1 = require("../../mol-util/param-definition");
|
|
20
|
+
var entry_root_1 = require("./entry-root");
|
|
21
|
+
var entry_state_1 = require("./entry-state");
|
|
22
|
+
var ExternalAPIs = tslib_1.__importStar(require("./external-api"));
|
|
23
|
+
var global_state_1 = require("./global-state");
|
|
24
|
+
var GROUP_TAG = 'volume-group';
|
|
25
|
+
exports.VOLUME_VISUAL_TAG = 'volume-visual';
|
|
26
|
+
var DIRECT_VOLUME_RELATIVE_PEAK_HALFWIDTH = 0.5;
|
|
27
|
+
;
|
|
28
|
+
exports.SimpleVolumeParams = {
|
|
29
|
+
volumeType: entry_state_1.VolumeTypeChoice.PDSelect(),
|
|
30
|
+
opacity: param_definition_1.ParamDefinition.Numeric(0.2, { min: 0, max: 1, step: 0.05 }, { hideIf: function (p) { return p.volumeType === 'off'; } }),
|
|
31
|
+
};
|
|
32
|
+
var VolsegVolumeData = /** @class */ (function () {
|
|
33
|
+
function VolsegVolumeData(rootData) {
|
|
34
|
+
this.visualTypeParamCache = {};
|
|
35
|
+
this.entryData = rootData;
|
|
36
|
+
}
|
|
37
|
+
VolsegVolumeData.prototype.loadVolume = function () {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
40
|
+
var hasVolumes, isoLevelPromise, group, newGroupNode, url, data, parsed, volumeNode, volumeData, volumeType, isovalue, stats, maxRelative, adjustedIsovalue, visualParams;
|
|
41
|
+
return tslib_1.__generator(this, function (_e) {
|
|
42
|
+
switch (_e.label) {
|
|
43
|
+
case 0:
|
|
44
|
+
hasVolumes = this.entryData.metadata.raw.grid.volumes.volume_downsamplings.length > 0;
|
|
45
|
+
if (!hasVolumes) return [3 /*break*/, 7];
|
|
46
|
+
isoLevelPromise = ExternalAPIs.tryGetIsovalue((_a = this.entryData.metadata.raw.grid.general.source_db_id) !== null && _a !== void 0 ? _a : this.entryData.entryId);
|
|
47
|
+
group = (_b = this.entryData.findNodesByTags(GROUP_TAG)[0]) === null || _b === void 0 ? void 0 : _b.transform.ref;
|
|
48
|
+
if (!!group) return [3 /*break*/, 2];
|
|
49
|
+
return [4 /*yield*/, this.entryData.newUpdate().apply(misc_1.CreateGroup, { label: 'Volume' }, { tags: [GROUP_TAG], state: { isCollapsed: true } }).commit()];
|
|
50
|
+
case 1:
|
|
51
|
+
newGroupNode = _e.sent();
|
|
52
|
+
group = newGroupNode.ref;
|
|
53
|
+
_e.label = 2;
|
|
54
|
+
case 2:
|
|
55
|
+
url = this.entryData.api.volumeUrl(this.entryData.source, this.entryData.entryId, entry_root_1.BOX, entry_root_1.MAX_VOXELS);
|
|
56
|
+
return [4 /*yield*/, this.entryData.newUpdate().to(group).apply(data_1.Download, { url: url, isBinary: true, label: "Volume Data: ".concat(url) }).commit()];
|
|
57
|
+
case 3:
|
|
58
|
+
data = _e.sent();
|
|
59
|
+
return [4 /*yield*/, this.entryData.plugin.dataFormats.get('dscif').parse(this.entryData.plugin, data)];
|
|
60
|
+
case 4:
|
|
61
|
+
parsed = _e.sent();
|
|
62
|
+
volumeNode = (_d = (_c = parsed.volumes) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : parsed.volume;
|
|
63
|
+
volumeData = volumeNode.cell.obj.data;
|
|
64
|
+
volumeType = entry_state_1.VolsegStateParams.volumeType.defaultValue;
|
|
65
|
+
return [4 /*yield*/, isoLevelPromise];
|
|
66
|
+
case 5:
|
|
67
|
+
isovalue = _e.sent();
|
|
68
|
+
if (!isovalue) {
|
|
69
|
+
stats = volumeData.grid.stats;
|
|
70
|
+
maxRelative = (stats.max - stats.mean) / stats.sigma;
|
|
71
|
+
if (maxRelative > 1) {
|
|
72
|
+
isovalue = { kind: 'relative', value: 1.0 };
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
isovalue = { kind: 'relative', value: maxRelative * 0.5 };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
adjustedIsovalue = volume_1.Volume.adjustedIsoValue(volumeData, isovalue.value, isovalue.kind);
|
|
79
|
+
visualParams = this.createVolumeVisualParams(volumeData, volumeType);
|
|
80
|
+
this.changeIsovalueInVolumeVisualParams(visualParams, adjustedIsovalue, volumeData.grid.stats);
|
|
81
|
+
return [4 /*yield*/, this.entryData.newUpdate()
|
|
82
|
+
.to(volumeNode)
|
|
83
|
+
.apply(transforms_1.StateTransforms.Representation.VolumeRepresentation3D, visualParams, { tags: [exports.VOLUME_VISUAL_TAG], state: { isHidden: volumeType === 'off' } })
|
|
84
|
+
.commit()];
|
|
85
|
+
case 6:
|
|
86
|
+
_e.sent();
|
|
87
|
+
return [2 /*return*/, { isovalue: adjustedIsovalue }];
|
|
88
|
+
case 7: return [2 /*return*/];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
VolsegVolumeData.prototype.setVolumeVisual = function (type) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var visual, oldParams, newParams, volumeStats, update;
|
|
97
|
+
return tslib_1.__generator(this, function (_c) {
|
|
98
|
+
switch (_c.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
visual = this.entryData.findNodesByTags(exports.VOLUME_VISUAL_TAG)[0];
|
|
101
|
+
if (!visual)
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
oldParams = visual.transform.params;
|
|
104
|
+
this.visualTypeParamCache[oldParams.type.name] = oldParams.type.params;
|
|
105
|
+
if (!(type === 'off')) return [3 /*break*/, 1];
|
|
106
|
+
(0, state_1.setSubtreeVisibility)(this.entryData.plugin.state.data, visual.transform.ref, true); // true means hide, ¯\_(ツ)_/¯
|
|
107
|
+
return [3 /*break*/, 3];
|
|
108
|
+
case 1:
|
|
109
|
+
(0, state_1.setSubtreeVisibility)(this.entryData.plugin.state.data, visual.transform.ref, false); // true means hide, ¯\_(ツ)_/¯
|
|
110
|
+
if (oldParams.type.name === type)
|
|
111
|
+
return [2 /*return*/];
|
|
112
|
+
newParams = tslib_1.__assign(tslib_1.__assign({}, oldParams), { type: {
|
|
113
|
+
name: type,
|
|
114
|
+
params: (_a = this.visualTypeParamCache[type]) !== null && _a !== void 0 ? _a : oldParams.type.params,
|
|
115
|
+
} });
|
|
116
|
+
volumeStats = (_b = visual.obj) === null || _b === void 0 ? void 0 : _b.data.sourceData.grid.stats;
|
|
117
|
+
if (!volumeStats)
|
|
118
|
+
throw new Error("Cannot get volume stats from volume visual ".concat(visual.transform.ref));
|
|
119
|
+
this.changeIsovalueInVolumeVisualParams(newParams, undefined, volumeStats);
|
|
120
|
+
update = this.entryData.newUpdate().to(visual.transform.ref).update(newParams);
|
|
121
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.entryData.plugin, { state: this.entryData.plugin.state.data, tree: update, options: { doNotUpdateCurrent: true } })];
|
|
122
|
+
case 2:
|
|
123
|
+
_c.sent();
|
|
124
|
+
_c.label = 3;
|
|
125
|
+
case 3: return [2 /*return*/];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
VolsegVolumeData.prototype.updateVolumeVisual = function (newParams) {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
133
|
+
var volumeType, opacity, visual, oldVisualParams, newVisualParams, volumeStats, update;
|
|
134
|
+
return tslib_1.__generator(this, function (_c) {
|
|
135
|
+
switch (_c.label) {
|
|
136
|
+
case 0:
|
|
137
|
+
volumeType = newParams.volumeType, opacity = newParams.opacity;
|
|
138
|
+
visual = this.entryData.findNodesByTags(exports.VOLUME_VISUAL_TAG)[0];
|
|
139
|
+
if (!visual)
|
|
140
|
+
return [2 /*return*/];
|
|
141
|
+
oldVisualParams = visual.transform.params;
|
|
142
|
+
this.visualTypeParamCache[oldVisualParams.type.name] = oldVisualParams.type.params;
|
|
143
|
+
if (!(volumeType === 'off')) return [3 /*break*/, 1];
|
|
144
|
+
(0, state_1.setSubtreeVisibility)(this.entryData.plugin.state.data, visual.transform.ref, true); // true means hide, ¯\_(ツ)_/¯
|
|
145
|
+
return [3 /*break*/, 3];
|
|
146
|
+
case 1:
|
|
147
|
+
(0, state_1.setSubtreeVisibility)(this.entryData.plugin.state.data, visual.transform.ref, false); // true means hide, ¯\_(ツ)_/¯
|
|
148
|
+
newVisualParams = tslib_1.__assign(tslib_1.__assign({}, oldVisualParams), { type: {
|
|
149
|
+
name: volumeType,
|
|
150
|
+
params: (_a = this.visualTypeParamCache[volumeType]) !== null && _a !== void 0 ? _a : oldVisualParams.type.params,
|
|
151
|
+
} });
|
|
152
|
+
newVisualParams.type.params.alpha = opacity;
|
|
153
|
+
volumeStats = (_b = visual.obj) === null || _b === void 0 ? void 0 : _b.data.sourceData.grid.stats;
|
|
154
|
+
if (!volumeStats)
|
|
155
|
+
throw new Error("Cannot get volume stats from volume visual ".concat(visual.transform.ref));
|
|
156
|
+
this.changeIsovalueInVolumeVisualParams(newVisualParams, undefined, volumeStats);
|
|
157
|
+
update = this.entryData.newUpdate().to(visual.transform.ref).update(newVisualParams);
|
|
158
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.entryData.plugin, { state: this.entryData.plugin.state.data, tree: update, options: { doNotUpdateCurrent: true } })];
|
|
159
|
+
case 2:
|
|
160
|
+
_c.sent();
|
|
161
|
+
_c.label = 3;
|
|
162
|
+
case 3: return [2 /*return*/];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
VolsegVolumeData.prototype.setTryUseGpu = function (tryUseGpu) {
|
|
168
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
169
|
+
var visuals, _i, visuals_1, visual, oldParams, newParams, update;
|
|
170
|
+
return tslib_1.__generator(this, function (_a) {
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
visuals = this.entryData.findNodesByTags(exports.VOLUME_VISUAL_TAG);
|
|
174
|
+
_i = 0, visuals_1 = visuals;
|
|
175
|
+
_a.label = 1;
|
|
176
|
+
case 1:
|
|
177
|
+
if (!(_i < visuals_1.length)) return [3 /*break*/, 4];
|
|
178
|
+
visual = visuals_1[_i];
|
|
179
|
+
oldParams = visual.transform.params;
|
|
180
|
+
if (!(oldParams.type.params.tryUseGpu === !tryUseGpu)) return [3 /*break*/, 3];
|
|
181
|
+
newParams = tslib_1.__assign(tslib_1.__assign({}, oldParams), { type: tslib_1.__assign(tslib_1.__assign({}, oldParams.type), { params: tslib_1.__assign(tslib_1.__assign({}, oldParams.type.params), { tryUseGpu: tryUseGpu }) }) });
|
|
182
|
+
update = this.entryData.newUpdate().to(visual.transform.ref).update(newParams);
|
|
183
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.entryData.plugin, { state: this.entryData.plugin.state.data, tree: update, options: { doNotUpdateCurrent: true } })];
|
|
184
|
+
case 2:
|
|
185
|
+
_a.sent();
|
|
186
|
+
_a.label = 3;
|
|
187
|
+
case 3:
|
|
188
|
+
_i++;
|
|
189
|
+
return [3 /*break*/, 1];
|
|
190
|
+
case 4: return [2 /*return*/];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
VolsegVolumeData.prototype.getIsovalueFromState = function () {
|
|
196
|
+
var _a = this.entryData.currentState.value, volumeIsovalueKind = _a.volumeIsovalueKind, volumeIsovalueValue = _a.volumeIsovalueValue;
|
|
197
|
+
return volumeIsovalueKind === 'relative'
|
|
198
|
+
? volume_1.Volume.IsoValue.relative(volumeIsovalueValue)
|
|
199
|
+
: volume_1.Volume.IsoValue.absolute(volumeIsovalueValue);
|
|
200
|
+
};
|
|
201
|
+
VolsegVolumeData.prototype.createVolumeVisualParams = function (volume, type) {
|
|
202
|
+
var _a;
|
|
203
|
+
if (type === 'off')
|
|
204
|
+
type = 'isosurface';
|
|
205
|
+
return (0, volume_representation_params_1.createVolumeRepresentationParams)(this.entryData.plugin, volume, {
|
|
206
|
+
type: type,
|
|
207
|
+
typeParams: { alpha: 0.2, tryUseGpu: (_a = global_state_1.VolsegGlobalStateData.getGlobalState(this.entryData.plugin)) === null || _a === void 0 ? void 0 : _a.tryUseGpu },
|
|
208
|
+
color: 'uniform',
|
|
209
|
+
colorParams: { value: (0, color_1.Color)(0x121212) },
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
VolsegVolumeData.prototype.changeIsovalueInVolumeVisualParams = function (params, isovalue, stats) {
|
|
213
|
+
var _a;
|
|
214
|
+
isovalue !== null && isovalue !== void 0 ? isovalue : (isovalue = this.getIsovalueFromState());
|
|
215
|
+
switch (params.type.name) {
|
|
216
|
+
case 'isosurface':
|
|
217
|
+
params.type.params.isoValue = isovalue;
|
|
218
|
+
params.type.params.tryUseGpu = (_a = global_state_1.VolsegGlobalStateData.getGlobalState(this.entryData.plugin)) === null || _a === void 0 ? void 0 : _a.tryUseGpu;
|
|
219
|
+
break;
|
|
220
|
+
case 'direct-volume':
|
|
221
|
+
var absIso = volume_1.Volume.IsoValue.toAbsolute(isovalue, stats).absoluteValue;
|
|
222
|
+
var fractIso = (absIso - stats.min) / (stats.max - stats.min);
|
|
223
|
+
var peakHalfwidth = DIRECT_VOLUME_RELATIVE_PEAK_HALFWIDTH * stats.sigma / (stats.max - stats.min);
|
|
224
|
+
params.type.params.controlPoints = [
|
|
225
|
+
linear_algebra_1.Vec2.create(Math.max(fractIso - peakHalfwidth, 0), 0),
|
|
226
|
+
linear_algebra_1.Vec2.create(fractIso, 1),
|
|
227
|
+
linear_algebra_1.Vec2.create(Math.min(fractIso + peakHalfwidth, 1), 0),
|
|
228
|
+
];
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
return VolsegVolumeData;
|
|
233
|
+
}());
|
|
234
|
+
exports.VolsegVolumeData = VolsegVolumeData;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
/** Try to get author-defined contour value for isosurface from EMDB API. Return relative value 1.0, if not applicable or fails. */
|
|
7
|
+
export declare function tryGetIsovalue(entryId: string): Promise<{
|
|
8
|
+
kind: 'absolute' | 'relative';
|
|
9
|
+
value: number;
|
|
10
|
+
} | undefined>;
|
|
11
|
+
export declare function getPdbIdsForEmdbEntry(entryId: string): Promise<string[]>;
|