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,82 @@
|
|
|
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 { __awaiter, __generator } from "tslib";
|
|
7
|
+
import { PluginStateObject, PluginStateTransform } from '../../mol-plugin-state/objects';
|
|
8
|
+
import { StateTransformer } from '../../mol-state';
|
|
9
|
+
import { Task } from '../../mol-task';
|
|
10
|
+
import { VolsegEntry, VolsegEntryData, createVolsegEntryParams } from './entry-root';
|
|
11
|
+
import { VolsegState, VolsegStateParams, VOLSEG_STATE_FROM_ENTRY_TRANSFORMER_NAME } from './entry-state';
|
|
12
|
+
import { VolsegGlobalState, VolsegGlobalStateData, VolsegGlobalStateParams } from './global-state';
|
|
13
|
+
export var VolsegEntryFromRoot = PluginStateTransform.BuiltIn({
|
|
14
|
+
name: 'volseg-entry-from-root',
|
|
15
|
+
display: { name: 'Vol & Seg Entry', description: 'Vol & Seg Entry' },
|
|
16
|
+
from: PluginStateObject.Root,
|
|
17
|
+
to: VolsegEntry,
|
|
18
|
+
params: function (a, plugin) { return createVolsegEntryParams(plugin); },
|
|
19
|
+
})({
|
|
20
|
+
apply: function (_a, plugin) {
|
|
21
|
+
var _this = this;
|
|
22
|
+
var a = _a.a, params = _a.params;
|
|
23
|
+
return Task.create('Load Vol & Seg Entry', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
24
|
+
var data;
|
|
25
|
+
return __generator(this, function (_a) {
|
|
26
|
+
switch (_a.label) {
|
|
27
|
+
case 0: return [4 /*yield*/, VolsegEntryData.create(plugin, params)];
|
|
28
|
+
case 1:
|
|
29
|
+
data = _a.sent();
|
|
30
|
+
return [2 /*return*/, new VolsegEntry(data, { label: data.entryId, description: 'Vol & Seg Entry' })];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}); });
|
|
34
|
+
},
|
|
35
|
+
update: function (_a) {
|
|
36
|
+
var b = _a.b, oldParams = _a.oldParams, newParams = _a.newParams;
|
|
37
|
+
Object.assign(newParams, oldParams);
|
|
38
|
+
console.error('Changing params of existing VolsegEntry node is not allowed');
|
|
39
|
+
return StateTransformer.UpdateResult.Unchanged;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export var VolsegStateFromEntry = PluginStateTransform.BuiltIn({
|
|
43
|
+
name: VOLSEG_STATE_FROM_ENTRY_TRANSFORMER_NAME,
|
|
44
|
+
display: { name: 'Vol & Seg Entry State', description: 'Vol & Seg Entry State' },
|
|
45
|
+
from: VolsegEntry,
|
|
46
|
+
to: VolsegState,
|
|
47
|
+
params: VolsegStateParams,
|
|
48
|
+
})({
|
|
49
|
+
apply: function (_a, plugin) {
|
|
50
|
+
var _this = this;
|
|
51
|
+
var a = _a.a, params = _a.params;
|
|
52
|
+
return Task.create('Create Vol & Seg Entry State', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
return [2 /*return*/, new VolsegState(params, { label: 'State' })];
|
|
55
|
+
});
|
|
56
|
+
}); });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export var VolsegGlobalStateFromRoot = PluginStateTransform.BuiltIn({
|
|
60
|
+
name: 'volseg-global-state-from-root',
|
|
61
|
+
display: { name: 'Vol & Seg Global State', description: 'Vol & Seg Global State' },
|
|
62
|
+
from: PluginStateObject.Root,
|
|
63
|
+
to: VolsegGlobalState,
|
|
64
|
+
params: VolsegGlobalStateParams,
|
|
65
|
+
})({
|
|
66
|
+
apply: function (_a, plugin) {
|
|
67
|
+
var _this = this;
|
|
68
|
+
var a = _a.a, params = _a.params;
|
|
69
|
+
return Task.create('Create Vol & Seg Global State', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
70
|
+
var data;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
data = new VolsegGlobalStateData(plugin, params);
|
|
73
|
+
return [2 /*return*/, new VolsegGlobalState(data, { label: 'Global State', description: 'Vol & Seg Global State' })];
|
|
74
|
+
});
|
|
75
|
+
}); });
|
|
76
|
+
},
|
|
77
|
+
update: function (_a) {
|
|
78
|
+
var b = _a.b, oldParams = _a.oldParams, newParams = _a.newParams;
|
|
79
|
+
b.data.currentState.next(newParams);
|
|
80
|
+
return StateTransformer.UpdateResult.Updated;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
7
|
+
import { CollapsableControls, CollapsableState } from '../../mol-plugin-ui/base';
|
|
8
|
+
import { VolsegEntry } from './entry-root';
|
|
9
|
+
import { VolsegGlobalStateData } from './global-state';
|
|
10
|
+
interface VolsegUIData {
|
|
11
|
+
globalState?: VolsegGlobalStateData;
|
|
12
|
+
availableNodes: VolsegEntry[];
|
|
13
|
+
activeNode?: VolsegEntry;
|
|
14
|
+
}
|
|
15
|
+
declare namespace VolsegUIData {
|
|
16
|
+
function changeAvailableNodes(data: VolsegUIData, newNodes: VolsegEntry[]): VolsegUIData;
|
|
17
|
+
function changeActiveNode(data: VolsegUIData, newActiveRef: string): VolsegUIData;
|
|
18
|
+
function equals(data1: VolsegUIData, data2: VolsegUIData): boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class VolsegUI extends CollapsableControls<{}, {
|
|
21
|
+
data: VolsegUIData;
|
|
22
|
+
}> {
|
|
23
|
+
protected defaultState(): CollapsableState & {
|
|
24
|
+
data: VolsegUIData;
|
|
25
|
+
};
|
|
26
|
+
protected renderControls(): JSX.Element | null;
|
|
27
|
+
componentDidMount(): void;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
5
|
+
*
|
|
6
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
7
|
+
*/
|
|
8
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
|
+
import { CollapsableControls } from '../../mol-plugin-ui/base';
|
|
10
|
+
import { Button, ControlRow, ExpandGroup, IconButton } from '../../mol-plugin-ui/controls/common';
|
|
11
|
+
import * as Icons from '../../mol-plugin-ui/controls/icons';
|
|
12
|
+
import { ParameterControls } from '../../mol-plugin-ui/controls/parameters';
|
|
13
|
+
import { Slider } from '../../mol-plugin-ui/controls/slider';
|
|
14
|
+
import { useBehavior } from '../../mol-plugin-ui/hooks/use-behavior';
|
|
15
|
+
import { UpdateTransformControl } from '../../mol-plugin-ui/state/update-transform';
|
|
16
|
+
import { shallowEqualArrays } from '../../mol-util';
|
|
17
|
+
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
18
|
+
import { sleep } from '../../mol-util/sleep';
|
|
19
|
+
import { VolsegEntry } from './entry-root';
|
|
20
|
+
import { SimpleVolumeParams } from './entry-volume';
|
|
21
|
+
import { VolsegGlobalState, VolsegGlobalStateParams } from './global-state';
|
|
22
|
+
import { isDefined } from './helpers';
|
|
23
|
+
var VolsegUIData;
|
|
24
|
+
(function (VolsegUIData) {
|
|
25
|
+
function changeAvailableNodes(data, newNodes) {
|
|
26
|
+
var _a;
|
|
27
|
+
var newActiveNode = newNodes.length > data.availableNodes.length ?
|
|
28
|
+
newNodes[newNodes.length - 1]
|
|
29
|
+
: (_a = newNodes.find(function (node) { var _a; return node.data.ref === ((_a = data.activeNode) === null || _a === void 0 ? void 0 : _a.data.ref); })) !== null && _a !== void 0 ? _a : newNodes[0];
|
|
30
|
+
return __assign(__assign({}, data), { availableNodes: newNodes, activeNode: newActiveNode });
|
|
31
|
+
}
|
|
32
|
+
VolsegUIData.changeAvailableNodes = changeAvailableNodes;
|
|
33
|
+
function changeActiveNode(data, newActiveRef) {
|
|
34
|
+
var _a;
|
|
35
|
+
var newActiveNode = (_a = data.availableNodes.find(function (node) { return node.data.ref === newActiveRef; })) !== null && _a !== void 0 ? _a : data.availableNodes[0];
|
|
36
|
+
return __assign(__assign({}, data), { availableNodes: data.availableNodes, activeNode: newActiveNode });
|
|
37
|
+
}
|
|
38
|
+
VolsegUIData.changeActiveNode = changeActiveNode;
|
|
39
|
+
function equals(data1, data2) {
|
|
40
|
+
return shallowEqualArrays(data1.availableNodes, data2.availableNodes) && data1.activeNode === data2.activeNode && data1.globalState === data2.globalState;
|
|
41
|
+
}
|
|
42
|
+
VolsegUIData.equals = equals;
|
|
43
|
+
})(VolsegUIData || (VolsegUIData = {}));
|
|
44
|
+
var VolsegUI = /** @class */ (function (_super) {
|
|
45
|
+
__extends(VolsegUI, _super);
|
|
46
|
+
function VolsegUI() {
|
|
47
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
|
+
}
|
|
49
|
+
VolsegUI.prototype.defaultState = function () {
|
|
50
|
+
return {
|
|
51
|
+
header: 'Volume & Segmentation',
|
|
52
|
+
isCollapsed: true,
|
|
53
|
+
brand: { accent: 'orange', svg: Icons.ExtensionSvg },
|
|
54
|
+
data: {
|
|
55
|
+
globalState: undefined,
|
|
56
|
+
availableNodes: [],
|
|
57
|
+
activeNode: undefined,
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
VolsegUI.prototype.renderControls = function () {
|
|
62
|
+
var _this = this;
|
|
63
|
+
return _jsx(VolsegControls, { plugin: this.plugin, data: this.state.data, setData: function (d) { return _this.setState({ data: d }); } });
|
|
64
|
+
};
|
|
65
|
+
VolsegUI.prototype.componentDidMount = function () {
|
|
66
|
+
var _this = this;
|
|
67
|
+
this.setState({ isHidden: true, isCollapsed: false });
|
|
68
|
+
this.subscribe(this.plugin.state.data.events.changed, function (e) {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
var nodes = e.state.selectQ(function (q) { return q.ofType(VolsegEntry); }).map(function (cell) { return cell === null || cell === void 0 ? void 0 : cell.obj; }).filter(isDefined);
|
|
71
|
+
var isHidden = nodes.length === 0;
|
|
72
|
+
var newData = VolsegUIData.changeAvailableNodes(_this.state.data, nodes);
|
|
73
|
+
if (!((_a = _this.state.data.globalState) === null || _a === void 0 ? void 0 : _a.isRegistered())) {
|
|
74
|
+
var globalState = (_c = (_b = e.state.selectQ(function (q) { return q.ofType(VolsegGlobalState); })[0]) === null || _b === void 0 ? void 0 : _b.obj) === null || _c === void 0 ? void 0 : _c.data;
|
|
75
|
+
if (globalState)
|
|
76
|
+
newData.globalState = globalState;
|
|
77
|
+
}
|
|
78
|
+
if (!VolsegUIData.equals(_this.state.data, newData) || _this.state.isHidden !== isHidden) {
|
|
79
|
+
_this.setState({ data: newData, isHidden: isHidden });
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return VolsegUI;
|
|
84
|
+
}(CollapsableControls));
|
|
85
|
+
export { VolsegUI };
|
|
86
|
+
function VolsegControls(_a) {
|
|
87
|
+
var _this = this;
|
|
88
|
+
var _b;
|
|
89
|
+
var plugin = _a.plugin, data = _a.data, setData = _a.setData;
|
|
90
|
+
var entryData = (_b = data.activeNode) === null || _b === void 0 ? void 0 : _b.data;
|
|
91
|
+
if (!entryData) {
|
|
92
|
+
return _jsx("p", { children: "No data!" });
|
|
93
|
+
}
|
|
94
|
+
if (!data.globalState) {
|
|
95
|
+
return _jsx("p", { children: "No global state!" });
|
|
96
|
+
}
|
|
97
|
+
var params = {
|
|
98
|
+
/** Reference to the active VolsegEntry node */
|
|
99
|
+
entry: PD.Select(data.activeNode.data.ref, data.availableNodes.map(function (entry) { return [entry.data.ref, entry.data.entryId]; }))
|
|
100
|
+
};
|
|
101
|
+
var values = {
|
|
102
|
+
entry: data.activeNode.data.ref,
|
|
103
|
+
};
|
|
104
|
+
var globalState = useBehavior(data.globalState.currentState);
|
|
105
|
+
return _jsxs(_Fragment, { children: [_jsx(ParameterControls, { params: params, values: values, onChangeValues: function (next) { return setData(VolsegUIData.changeActiveNode(data, next.entry)); } }), _jsx(ExpandGroup, __assign({ header: 'Global options' }, { children: _jsx(WaitingParameterControls, { params: VolsegGlobalStateParams, values: globalState, onChangeValues: function (next) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
106
|
+
switch (_b.label) {
|
|
107
|
+
case 0: return [4 /*yield*/, ((_a = data.globalState) === null || _a === void 0 ? void 0 : _a.updateState(plugin, next))];
|
|
108
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
109
|
+
}
|
|
110
|
+
}); }); } }) })), _jsx(VolsegEntryControls, { entryData: entryData }, entryData.ref)] });
|
|
111
|
+
}
|
|
112
|
+
function VolsegEntryControls(_a) {
|
|
113
|
+
var _this = this;
|
|
114
|
+
var _b, _c, _d;
|
|
115
|
+
var entryData = _a.entryData;
|
|
116
|
+
var state = useBehavior(entryData.currentState);
|
|
117
|
+
var allSegments = entryData.metadata.allSegments;
|
|
118
|
+
var selectedSegment = entryData.metadata.getSegment(state.selectedSegment);
|
|
119
|
+
var visibleSegments = state.visibleSegments.map(function (seg) { return seg.segmentId; });
|
|
120
|
+
var visibleModels = state.visibleModels.map(function (model) { return model.pdbId; });
|
|
121
|
+
var allPdbs = entryData.pdbs;
|
|
122
|
+
return _jsxs(_Fragment, { children: [_jsx("div", __assign({ style: { fontWeight: 'bold', padding: 8, paddingTop: 6, paddingBottom: 4, overflow: 'hidden' } }, { children: (_c = (_b = entryData.metadata.raw.annotation) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : 'Unnamed Annotation' })), allPdbs.length > 0 && _jsx(ExpandGroup, __assign({ header: 'Fitted models in PDB', initiallyExpanded: true }, { children: allPdbs.map(function (pdb) {
|
|
123
|
+
return _jsx(WaitingButton, __assign({ onClick: function () { return entryData.actionShowFittedModel(visibleModels.includes(pdb) ? [] : [pdb]); }, style: { fontWeight: visibleModels.includes(pdb) ? 'bold' : undefined, textAlign: 'left', marginTop: 1 } }, { children: pdb }), pdb);
|
|
124
|
+
}) })), _jsx(VolumeControls, { entryData: entryData }), _jsxs(ExpandGroup, __assign({ header: 'Segmentation data', initiallyExpanded: true }, { children: [_jsx(ControlRow, { label: 'Opacity', control: _jsx(WaitingSlider, { min: 0, max: 1, value: state.segmentOpacity, step: 0.05, onChange: function (v) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
125
|
+
switch (_a.label) {
|
|
126
|
+
case 0: return [4 /*yield*/, entryData.actionSetOpacity(v)];
|
|
127
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
128
|
+
}
|
|
129
|
+
}); }); } }) }), allSegments.length > 0 && _jsxs(_Fragment, { children: [_jsx(WaitingButton, __assign({ onClick: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0: return [4 /*yield*/, sleep(20)];
|
|
132
|
+
case 1:
|
|
133
|
+
_a.sent();
|
|
134
|
+
return [4 /*yield*/, entryData.actionToggleAllSegments()];
|
|
135
|
+
case 2:
|
|
136
|
+
_a.sent();
|
|
137
|
+
return [2 /*return*/];
|
|
138
|
+
}
|
|
139
|
+
}); }); }, style: { marginTop: 1 } }, { children: "Toggle All segments" })), _jsx("div", __assign({ style: { maxHeight: 200, overflow: 'hidden', overflowY: 'auto', marginBlock: 1 } }, { children: allSegments.map(function (segment) {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
return _jsxs("div", __assign({ style: { display: 'flex', marginBottom: 1 }, onMouseEnter: function () { return entryData.actionHighlightSegment(segment); }, onMouseLeave: function () { return entryData.actionHighlightSegment(); } }, { children: [_jsx(Button, __assign({ onClick: function () { return entryData.actionSelectSegment(segment !== selectedSegment ? segment.id : undefined); }, style: { fontWeight: segment.id === (selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.id) ? 'bold' : undefined, marginRight: 1, flexGrow: 1, textAlign: 'left' } }, { children: _jsxs("div", __assign({ title: (_a = segment.biological_annotation.name) !== null && _a !== void 0 ? _a : 'Unnamed segment', style: { maxWidth: 240, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, { children: [(_b = segment.biological_annotation.name) !== null && _b !== void 0 ? _b : 'Unnamed segment', " (", segment.id, ")"] })) })), _jsx(IconButton, { svg: visibleSegments.includes(segment.id) ? Icons.VisibilityOutlinedSvg : Icons.VisibilityOffOutlinedSvg, onClick: function () { return entryData.actionToggleSegment(segment.id); } })] }), segment.id);
|
|
142
|
+
}) }))] })] })), _jsx(ExpandGroup, __assign({ header: 'Selected segment annotation', initiallyExpanded: true }, { children: _jsxs("div", __assign({ style: { paddingTop: 4, paddingRight: 8, maxHeight: 300, overflow: 'hidden', overflowY: 'auto' } }, { children: [!selectedSegment && 'No segment selected', selectedSegment && _jsxs("b", { children: ["Segment ", selectedSegment.id, ":", _jsx("br", {}), (_d = selectedSegment.biological_annotation.name) !== null && _d !== void 0 ? _d : 'Unnamed segment'] }), selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.biological_annotation.external_references.map(function (ref) {
|
|
143
|
+
return _jsxs("p", __assign({ style: { marginTop: 4 } }, { children: [_jsxs("small", { children: [ref.resource, ":", ref.accession] }), _jsx("br", {}), _jsx("b", { children: capitalize(ref.label) }), _jsx("br", {}), ref.description] }), ref.id);
|
|
144
|
+
})] })) }))] });
|
|
145
|
+
}
|
|
146
|
+
function VolumeControls(_a) {
|
|
147
|
+
var _this = this;
|
|
148
|
+
var _b, _c;
|
|
149
|
+
var entryData = _a.entryData;
|
|
150
|
+
var vol = useBehavior(entryData.currentVolume);
|
|
151
|
+
if (!vol)
|
|
152
|
+
return null;
|
|
153
|
+
var volumeValues = {
|
|
154
|
+
volumeType: vol.state.isHidden ? 'off' : (_b = vol.params) === null || _b === void 0 ? void 0 : _b.type.name,
|
|
155
|
+
opacity: (_c = vol.params) === null || _c === void 0 ? void 0 : _c.type.params.alpha,
|
|
156
|
+
};
|
|
157
|
+
return _jsxs(ExpandGroup, __assign({ header: 'Volume data', initiallyExpanded: true }, { children: [_jsx(WaitingParameterControls, { params: SimpleVolumeParams, values: volumeValues, onChangeValues: function (next) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0: return [4 /*yield*/, sleep(20)];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
return [4 /*yield*/, entryData.actionUpdateVolumeVisual(next)];
|
|
163
|
+
case 2:
|
|
164
|
+
_a.sent();
|
|
165
|
+
return [2 /*return*/];
|
|
166
|
+
}
|
|
167
|
+
}); }); } }), _jsx(ExpandGroup, __assign({ header: 'Detailed Volume Params', headerStyle: { marginTop: 1 } }, { children: _jsx(UpdateTransformControl, { state: entryData.plugin.state.data, transform: vol, customHeader: 'none' }) }))] }));
|
|
168
|
+
}
|
|
169
|
+
function WaitingSlider(_a) {
|
|
170
|
+
var value = _a.value, onChange = _a.onChange, etc = __rest(_a, ["value", "onChange"]);
|
|
171
|
+
var _b = useAsyncChange(value), changing = _b[0], sliderValue = _b[1], execute = _b[2];
|
|
172
|
+
return _jsx(Slider, __assign({ value: sliderValue, disabled: changing, onChange: function (newValue) { return execute(onChange, newValue); } }, etc));
|
|
173
|
+
}
|
|
174
|
+
function WaitingButton(_a) {
|
|
175
|
+
var onClick = _a.onClick, etc = __rest(_a, ["onClick"]);
|
|
176
|
+
var _b = useAsyncChange(undefined), changing = _b[0], _ = _b[1], execute = _b[2];
|
|
177
|
+
return _jsx(Button, __assign({ disabled: changing, onClick: function () { return execute(onClick, undefined); } }, etc, { children: etc.children }));
|
|
178
|
+
}
|
|
179
|
+
function WaitingParameterControls(_a) {
|
|
180
|
+
var values = _a.values, onChangeValues = _a.onChangeValues, etc = __rest(_a, ["values", "onChangeValues"]);
|
|
181
|
+
var _b = useAsyncChange(values), changing = _b[0], currentValues = _b[1], execute = _b[2];
|
|
182
|
+
return _jsx(ParameterControls, __assign({ isDisabled: changing, values: currentValues, onChangeValues: function (newValue) { return execute(onChangeValues, newValue); } }, etc));
|
|
183
|
+
}
|
|
184
|
+
function capitalize(text) {
|
|
185
|
+
var first = text.charAt(0);
|
|
186
|
+
var rest = text.slice(1);
|
|
187
|
+
return first.toUpperCase() + rest;
|
|
188
|
+
}
|
|
189
|
+
function useAsyncChange(initialValue) {
|
|
190
|
+
var _this = this;
|
|
191
|
+
var _a = useState(false), isExecuting = _a[0], setIsExecuting = _a[1];
|
|
192
|
+
var _b = useState(initialValue), value = _b[0], setValue = _b[1];
|
|
193
|
+
var isMounted = useRef(false);
|
|
194
|
+
useEffect(function () { return setValue(initialValue); }, [initialValue]);
|
|
195
|
+
useEffect(function () {
|
|
196
|
+
isMounted.current = true;
|
|
197
|
+
return function () { isMounted.current = false; };
|
|
198
|
+
}, []);
|
|
199
|
+
var execute = useCallback(function (func, val) { return __awaiter(_this, void 0, void 0, function () {
|
|
200
|
+
var err_1;
|
|
201
|
+
return __generator(this, function (_a) {
|
|
202
|
+
switch (_a.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
setIsExecuting(true);
|
|
205
|
+
setValue(val);
|
|
206
|
+
_a.label = 1;
|
|
207
|
+
case 1:
|
|
208
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
209
|
+
return [4 /*yield*/, func(val)];
|
|
210
|
+
case 2:
|
|
211
|
+
_a.sent();
|
|
212
|
+
return [3 /*break*/, 5];
|
|
213
|
+
case 3:
|
|
214
|
+
err_1 = _a.sent();
|
|
215
|
+
if (isMounted.current) {
|
|
216
|
+
setValue(initialValue);
|
|
217
|
+
}
|
|
218
|
+
throw err_1;
|
|
219
|
+
case 4:
|
|
220
|
+
if (isMounted.current) {
|
|
221
|
+
setIsExecuting(false);
|
|
222
|
+
}
|
|
223
|
+
return [7 /*endfinally*/];
|
|
224
|
+
case 5: return [2 /*return*/];
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}); }, []);
|
|
228
|
+
return [isExecuting, value, execute];
|
|
229
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { type Metadata } from './data';
|
|
7
|
+
export declare const DEFAULT_VOLSEG_SERVER = "https://molstarvolseg.ncbr.muni.cz/v2";
|
|
8
|
+
export declare class VolumeApiV2 {
|
|
9
|
+
volumeServerUrl: string;
|
|
10
|
+
constructor(volumeServerUrl?: string);
|
|
11
|
+
entryListUrl(maxEntries: number, keyword?: string): string;
|
|
12
|
+
metadataUrl(source: string, entryId: string): string;
|
|
13
|
+
volumeUrl(source: string, entryId: string, box: [[number, number, number], [number, number, number]] | null, maxPoints: number): string;
|
|
14
|
+
latticeUrl(source: string, entryId: string, segmentation: number, box: [[number, number, number], [number, number, number]] | null, maxPoints: number): string;
|
|
15
|
+
meshUrl_Json(source: string, entryId: string, segment: number, detailLevel: number): string;
|
|
16
|
+
meshUrl_Bcif(source: string, entryId: string, segment: number, detailLevel: number): string;
|
|
17
|
+
volumeInfoUrl(source: string, entryId: string): string;
|
|
18
|
+
getEntryList(maxEntries: number, keyword?: string): Promise<{
|
|
19
|
+
[source: string]: string[];
|
|
20
|
+
}>;
|
|
21
|
+
getMetadata(source: string, entryId: string): Promise<Metadata>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { __awaiter, __generator } from "tslib";
|
|
7
|
+
export var DEFAULT_VOLSEG_SERVER = 'https://molstarvolseg.ncbr.muni.cz/v2';
|
|
8
|
+
var VolumeApiV2 = /** @class */ (function () {
|
|
9
|
+
function VolumeApiV2(volumeServerUrl) {
|
|
10
|
+
if (volumeServerUrl === void 0) { volumeServerUrl = DEFAULT_VOLSEG_SERVER; }
|
|
11
|
+
this.volumeServerUrl = volumeServerUrl.replace(/\/$/, ''); // trim trailing slash
|
|
12
|
+
}
|
|
13
|
+
VolumeApiV2.prototype.entryListUrl = function (maxEntries, keyword) {
|
|
14
|
+
return "".concat(this.volumeServerUrl, "/list_entries/").concat(maxEntries, "/").concat(keyword !== null && keyword !== void 0 ? keyword : '');
|
|
15
|
+
};
|
|
16
|
+
VolumeApiV2.prototype.metadataUrl = function (source, entryId) {
|
|
17
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/metadata");
|
|
18
|
+
};
|
|
19
|
+
VolumeApiV2.prototype.volumeUrl = function (source, entryId, box, maxPoints) {
|
|
20
|
+
if (box) {
|
|
21
|
+
var _a = box[0], a1 = _a[0], a2 = _a[1], a3 = _a[2], _b = box[1], b1 = _b[0], b2 = _b[1], b3 = _b[2];
|
|
22
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/volume/box/").concat(a1, "/").concat(a2, "/").concat(a3, "/").concat(b1, "/").concat(b2, "/").concat(b3, "?max_points=").concat(maxPoints);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/volume/cell?max_points=").concat(maxPoints);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
VolumeApiV2.prototype.latticeUrl = function (source, entryId, segmentation, box, maxPoints) {
|
|
29
|
+
if (box) {
|
|
30
|
+
var _a = box[0], a1 = _a[0], a2 = _a[1], a3 = _a[2], _b = box[1], b1 = _b[0], b2 = _b[1], b3 = _b[2];
|
|
31
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/segmentation/box/").concat(segmentation, "/").concat(a1, "/").concat(a2, "/").concat(a3, "/").concat(b1, "/").concat(b2, "/").concat(b3, "?max_points=").concat(maxPoints);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/segmentation/cell/").concat(segmentation, "?max_points=").concat(maxPoints);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
VolumeApiV2.prototype.meshUrl_Json = function (source, entryId, segment, detailLevel) {
|
|
38
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/mesh/").concat(segment, "/").concat(detailLevel);
|
|
39
|
+
};
|
|
40
|
+
VolumeApiV2.prototype.meshUrl_Bcif = function (source, entryId, segment, detailLevel) {
|
|
41
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/mesh_bcif/").concat(segment, "/").concat(detailLevel);
|
|
42
|
+
};
|
|
43
|
+
VolumeApiV2.prototype.volumeInfoUrl = function (source, entryId) {
|
|
44
|
+
return "".concat(this.volumeServerUrl, "/").concat(source, "/").concat(entryId, "/volume_info");
|
|
45
|
+
};
|
|
46
|
+
VolumeApiV2.prototype.getEntryList = function (maxEntries, keyword) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
var response;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0: return [4 /*yield*/, fetch(this.entryListUrl(maxEntries, keyword))];
|
|
52
|
+
case 1:
|
|
53
|
+
response = _a.sent();
|
|
54
|
+
return [4 /*yield*/, response.json()];
|
|
55
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
VolumeApiV2.prototype.getMetadata = function (source, entryId) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
var url, response;
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
url = this.metadataUrl(source, entryId);
|
|
67
|
+
return [4 /*yield*/, fetch(url)];
|
|
68
|
+
case 1:
|
|
69
|
+
response = _a.sent();
|
|
70
|
+
if (!response.ok)
|
|
71
|
+
throw new Error("Failed to fetch metadata from ".concat(url));
|
|
72
|
+
return [4 /*yield*/, response.json()];
|
|
73
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return VolumeApiV2;
|
|
79
|
+
}());
|
|
80
|
+
export { VolumeApiV2 };
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
export interface Metadata {
|
|
7
|
+
grid: {
|
|
8
|
+
general: {
|
|
9
|
+
details: string;
|
|
10
|
+
source_db_name: string;
|
|
11
|
+
source_db_id: string;
|
|
12
|
+
};
|
|
13
|
+
volumes: Volumes;
|
|
14
|
+
segmentation_lattices: SegmentationLattices;
|
|
15
|
+
segmentation_meshes: SegmentationMeshes;
|
|
16
|
+
};
|
|
17
|
+
annotation: Annotation | null;
|
|
18
|
+
}
|
|
19
|
+
export interface Volumes {
|
|
20
|
+
volume_downsamplings: number[];
|
|
21
|
+
voxel_size: {
|
|
22
|
+
[downsampling: number]: Vector3;
|
|
23
|
+
};
|
|
24
|
+
origin: Vector3;
|
|
25
|
+
grid_dimensions: Vector3;
|
|
26
|
+
sampled_grid_dimensions: {
|
|
27
|
+
[downsampling: number]: Vector3;
|
|
28
|
+
};
|
|
29
|
+
mean: {
|
|
30
|
+
[downsampling: number]: number;
|
|
31
|
+
};
|
|
32
|
+
std: {
|
|
33
|
+
[downsampling: number]: number;
|
|
34
|
+
};
|
|
35
|
+
min: {
|
|
36
|
+
[downsampling: number]: number;
|
|
37
|
+
};
|
|
38
|
+
max: {
|
|
39
|
+
[downsampling: number]: number;
|
|
40
|
+
};
|
|
41
|
+
volume_force_dtype: string;
|
|
42
|
+
}
|
|
43
|
+
export interface SegmentationLattices {
|
|
44
|
+
segmentation_lattice_ids: number[];
|
|
45
|
+
segmentation_downsamplings: {
|
|
46
|
+
[lattice: number]: number[];
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface SegmentationMeshes {
|
|
50
|
+
mesh_component_numbers: {
|
|
51
|
+
segment_ids?: {
|
|
52
|
+
[segId: number]: {
|
|
53
|
+
detail_lvls: {
|
|
54
|
+
[detail: number]: {
|
|
55
|
+
mesh_ids: {
|
|
56
|
+
[meshId: number]: {
|
|
57
|
+
num_triangles: number;
|
|
58
|
+
num_vertices: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
detail_lvl_to_fraction: {
|
|
67
|
+
[lvl: number]: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface Annotation {
|
|
71
|
+
name: string;
|
|
72
|
+
details: string;
|
|
73
|
+
segment_list: Segment[];
|
|
74
|
+
}
|
|
75
|
+
export interface Segment {
|
|
76
|
+
id: number;
|
|
77
|
+
colour: number[];
|
|
78
|
+
biological_annotation: BiologicalAnnotation;
|
|
79
|
+
}
|
|
80
|
+
export interface BiologicalAnnotation {
|
|
81
|
+
name: string;
|
|
82
|
+
external_references: ExternalReference[];
|
|
83
|
+
}
|
|
84
|
+
export interface ExternalReference {
|
|
85
|
+
id: number;
|
|
86
|
+
resource: string;
|
|
87
|
+
accession: string;
|
|
88
|
+
label: string;
|
|
89
|
+
description: string;
|
|
90
|
+
}
|
|
91
|
+
type Vector3 = [number, number, number];
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { Metadata, Segment } from './data';
|
|
7
|
+
export declare class MetadataWrapper {
|
|
8
|
+
raw: Metadata;
|
|
9
|
+
private segmentMap?;
|
|
10
|
+
constructor(rawMetadata: Metadata);
|
|
11
|
+
get allSegments(): Segment[];
|
|
12
|
+
get allSegmentIds(): number[];
|
|
13
|
+
getSegment(segmentId: number): Segment | undefined;
|
|
14
|
+
/** Get the list of detail levels available for the given mesh segment. */
|
|
15
|
+
getMeshDetailLevels(segmentId: number): number[];
|
|
16
|
+
/** Get the worst available detail level that is not worse than preferredDetail.
|
|
17
|
+
* If preferredDetail is null, get the worst detail level overall.
|
|
18
|
+
* (worse = greater number) */
|
|
19
|
+
getSufficientMeshDetail(segmentId: number, preferredDetail: number | null): number;
|
|
20
|
+
/** IDs of all segments available as meshes */
|
|
21
|
+
get meshSegmentIds(): number[];
|
|
22
|
+
get gridTotalVolume(): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
var MetadataWrapper = /** @class */ (function () {
|
|
7
|
+
function MetadataWrapper(rawMetadata) {
|
|
8
|
+
this.raw = rawMetadata;
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(MetadataWrapper.prototype, "allSegments", {
|
|
11
|
+
get: function () {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return (_b = (_a = this.raw.annotation) === null || _a === void 0 ? void 0 : _a.segment_list) !== null && _b !== void 0 ? _b : [];
|
|
14
|
+
},
|
|
15
|
+
enumerable: false,
|
|
16
|
+
configurable: true
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(MetadataWrapper.prototype, "allSegmentIds", {
|
|
19
|
+
get: function () {
|
|
20
|
+
return this.allSegments.map(function (segment) { return segment.id; });
|
|
21
|
+
},
|
|
22
|
+
enumerable: false,
|
|
23
|
+
configurable: true
|
|
24
|
+
});
|
|
25
|
+
MetadataWrapper.prototype.getSegment = function (segmentId) {
|
|
26
|
+
if (!this.segmentMap) {
|
|
27
|
+
this.segmentMap = {};
|
|
28
|
+
for (var _i = 0, _a = this.allSegments; _i < _a.length; _i++) {
|
|
29
|
+
var segment = _a[_i];
|
|
30
|
+
this.segmentMap[segment.id] = segment;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return this.segmentMap[segmentId];
|
|
34
|
+
};
|
|
35
|
+
/** Get the list of detail levels available for the given mesh segment. */
|
|
36
|
+
MetadataWrapper.prototype.getMeshDetailLevels = function (segmentId) {
|
|
37
|
+
var segmentIds = this.raw.grid.segmentation_meshes.mesh_component_numbers.segment_ids;
|
|
38
|
+
if (!segmentIds)
|
|
39
|
+
return [];
|
|
40
|
+
var details = segmentIds[segmentId].detail_lvls;
|
|
41
|
+
return Object.keys(details).map(function (s) { return parseInt(s); });
|
|
42
|
+
};
|
|
43
|
+
/** Get the worst available detail level that is not worse than preferredDetail.
|
|
44
|
+
* If preferredDetail is null, get the worst detail level overall.
|
|
45
|
+
* (worse = greater number) */
|
|
46
|
+
MetadataWrapper.prototype.getSufficientMeshDetail = function (segmentId, preferredDetail) {
|
|
47
|
+
var availDetails = this.getMeshDetailLevels(segmentId);
|
|
48
|
+
if (preferredDetail !== null) {
|
|
49
|
+
availDetails = availDetails.filter(function (det) { return det <= preferredDetail; });
|
|
50
|
+
}
|
|
51
|
+
return Math.max.apply(Math, availDetails);
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(MetadataWrapper.prototype, "meshSegmentIds", {
|
|
54
|
+
/** IDs of all segments available as meshes */
|
|
55
|
+
get: function () {
|
|
56
|
+
var segmentIds = this.raw.grid.segmentation_meshes.mesh_component_numbers.segment_ids;
|
|
57
|
+
if (!segmentIds)
|
|
58
|
+
return [];
|
|
59
|
+
return Object.keys(segmentIds).map(function (s) { return parseInt(s); });
|
|
60
|
+
},
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(MetadataWrapper.prototype, "gridTotalVolume", {
|
|
65
|
+
get: function () {
|
|
66
|
+
var _a = this.raw.grid.volumes.voxel_size[1], vx = _a[0], vy = _a[1], vz = _a[2];
|
|
67
|
+
var _b = this.raw.grid.volumes.grid_dimensions, gx = _b[0], gy = _b[1], gz = _b[2];
|
|
68
|
+
return vx * vy * vz * gx * gy * gz;
|
|
69
|
+
},
|
|
70
|
+
enumerable: false,
|
|
71
|
+
configurable: true
|
|
72
|
+
});
|
|
73
|
+
return MetadataWrapper;
|
|
74
|
+
}());
|
|
75
|
+
export { MetadataWrapper };
|
|
@@ -81,6 +81,7 @@ export declare const Canvas3DParams: {
|
|
|
81
81
|
scale: any;
|
|
82
82
|
threshold: any;
|
|
83
83
|
color: any;
|
|
84
|
+
includeTransparent: any;
|
|
84
85
|
}>, "on">;
|
|
85
86
|
antialiasing: PD.NamedParams<PD.Normalize<unknown>, "off"> | PD.NamedParams<PD.Normalize<{
|
|
86
87
|
edgeThreshold: any;
|
|
@@ -250,6 +251,7 @@ export declare const DefaultCanvas3DParams: PD.Values<{
|
|
|
250
251
|
scale: any;
|
|
251
252
|
threshold: any;
|
|
252
253
|
color: any;
|
|
254
|
+
includeTransparent: any;
|
|
253
255
|
}>, "on">;
|
|
254
256
|
antialiasing: PD.NamedParams<PD.Normalize<unknown>, "off"> | PD.NamedParams<PD.Normalize<{
|
|
255
257
|
edgeThreshold: any;
|