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.
Files changed (499) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +202 -202
  3. package/build/viewer/embedded.html +52 -52
  4. package/build/viewer/index.html +115 -115
  5. package/build/viewer/molstar.css +1 -1
  6. package/build/viewer/molstar.js +1 -1
  7. package/lib/apps/docking-viewer/index.html +36 -36
  8. package/lib/apps/docking-viewer/viewport.d.ts +2 -0
  9. package/lib/apps/docking-viewer/viewport.js +1 -0
  10. package/lib/apps/viewer/app.d.ts +3 -1
  11. package/lib/apps/viewer/app.js +4 -0
  12. package/lib/apps/viewer/embedded.html +52 -52
  13. package/lib/apps/viewer/index.html +115 -115
  14. package/lib/cli/structure-info/volume.js +1 -1
  15. package/lib/commonjs/apps/docking-viewer/viewport.d.ts +2 -0
  16. package/lib/commonjs/apps/docking-viewer/viewport.js +1 -0
  17. package/lib/commonjs/apps/viewer/app.d.ts +3 -1
  18. package/lib/commonjs/apps/viewer/app.js +4 -0
  19. package/lib/commonjs/cli/structure-info/volume.js +1 -1
  20. package/lib/commonjs/examples/lighting/index.js +1 -1
  21. package/lib/commonjs/extensions/anvil/behavior.d.ts +1 -0
  22. package/lib/commonjs/extensions/cellpack/model.js +2 -1
  23. package/lib/commonjs/extensions/dnatco/confal-pyramids/behavior.d.ts +1 -0
  24. package/lib/commonjs/extensions/meshes/choice.d.ts +26 -0
  25. package/lib/commonjs/extensions/meshes/choice.js +31 -0
  26. package/lib/commonjs/extensions/meshes/examples.d.ts +26 -0
  27. package/lib/commonjs/extensions/meshes/examples.js +337 -0
  28. package/lib/commonjs/extensions/meshes/mesh-cif-schema.d.ts +29 -0
  29. package/lib/commonjs/extensions/meshes/mesh-cif-schema.js +34 -0
  30. package/lib/commonjs/extensions/meshes/mesh-extension.d.ts +66 -0
  31. package/lib/commonjs/extensions/meshes/mesh-extension.js +221 -0
  32. package/lib/commonjs/extensions/meshes/mesh-streaming/behavior.d.ts +105 -0
  33. package/lib/commonjs/extensions/meshes/mesh-streaming/behavior.js +379 -0
  34. package/lib/commonjs/extensions/meshes/mesh-streaming/server-info.d.ts +54 -0
  35. package/lib/commonjs/extensions/meshes/mesh-streaming/server-info.js +30 -0
  36. package/lib/commonjs/extensions/meshes/mesh-streaming/transformers.d.ts +42 -0
  37. package/lib/commonjs/extensions/meshes/mesh-streaming/transformers.js +273 -0
  38. package/lib/commonjs/extensions/meshes/mesh-utils.d.ts +41 -0
  39. package/lib/commonjs/extensions/meshes/mesh-utils.js +357 -0
  40. package/lib/commonjs/extensions/meshes/metadata.d.ts +108 -0
  41. package/lib/commonjs/extensions/meshes/metadata.js +72 -0
  42. package/lib/commonjs/extensions/model-archive/quality-assessment/behavior.d.ts +2 -0
  43. package/lib/commonjs/extensions/model-archive/quality-assessment/prop.d.ts +1 -0
  44. package/lib/commonjs/extensions/model-archive/quality-assessment/prop.js +16 -4
  45. package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +4 -2
  46. package/lib/commonjs/extensions/rcsb/validation-report/behavior.d.ts +3 -0
  47. package/lib/commonjs/extensions/volumes-and-segmentations/entry-meshes.d.ts +17 -0
  48. package/lib/commonjs/extensions/volumes-and-segmentations/entry-meshes.js +156 -0
  49. package/lib/commonjs/extensions/volumes-and-segmentations/entry-models.d.ts +12 -0
  50. package/lib/commonjs/extensions/volumes-and-segmentations/entry-models.js +96 -0
  51. package/lib/commonjs/extensions/volumes-and-segmentations/entry-root.d.ts +122 -0
  52. package/lib/commonjs/extensions/volumes-and-segmentations/entry-root.js +576 -0
  53. package/lib/commonjs/extensions/volumes-and-segmentations/entry-segmentation.d.ts +20 -0
  54. package/lib/commonjs/extensions/volumes-and-segmentations/entry-segmentation.js +200 -0
  55. package/lib/commonjs/extensions/volumes-and-segmentations/entry-state.d.ts +88 -0
  56. package/lib/commonjs/extensions/volumes-and-segmentations/entry-state.js +32 -0
  57. package/lib/commonjs/extensions/volumes-and-segmentations/entry-volume.d.ts +35 -0
  58. package/lib/commonjs/extensions/volumes-and-segmentations/entry-volume.js +234 -0
  59. package/lib/commonjs/extensions/volumes-and-segmentations/external-api.d.ts +11 -0
  60. package/lib/commonjs/extensions/volumes-and-segmentations/external-api.js +85 -0
  61. package/lib/commonjs/extensions/volumes-and-segmentations/global-state.d.ts +51 -0
  62. package/lib/commonjs/extensions/volumes-and-segmentations/global-state.js +83 -0
  63. package/lib/commonjs/extensions/volumes-and-segmentations/helpers.d.ts +56 -0
  64. package/lib/commonjs/extensions/volumes-and-segmentations/helpers.js +171 -0
  65. package/lib/commonjs/extensions/volumes-and-segmentations/index.d.ts +20 -0
  66. package/lib/commonjs/extensions/volumes-and-segmentations/index.js +130 -0
  67. package/lib/commonjs/extensions/volumes-and-segmentations/transformers.d.ts +33 -0
  68. package/lib/commonjs/extensions/volumes-and-segmentations/transformers.js +85 -0
  69. package/lib/commonjs/extensions/volumes-and-segmentations/ui.d.ts +29 -0
  70. package/lib/commonjs/extensions/volumes-and-segmentations/ui.js +232 -0
  71. package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/api.d.ts +22 -0
  72. package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/api.js +83 -0
  73. package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/data.d.ts +92 -0
  74. package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/data.js +7 -0
  75. package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/utils.d.ts +23 -0
  76. package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/utils.js +78 -0
  77. package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +2 -0
  78. package/lib/commonjs/mol-canvas3d/passes/draw.js +3 -3
  79. package/lib/commonjs/mol-canvas3d/passes/image.d.ts +1 -0
  80. package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +2 -1
  81. package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +27 -13
  82. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.d.ts +2 -1
  83. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +3 -2
  84. package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +0 -1
  85. package/lib/commonjs/mol-geo/geometry/points/points.d.ts +1 -1
  86. package/lib/commonjs/mol-geo/geometry/spheres/spheres.d.ts +1 -0
  87. package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +3 -2
  88. package/lib/commonjs/mol-gl/compute/histogram-pyramid/reduction.js +1 -2
  89. package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +4 -6
  90. package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +1 -0
  91. package/lib/commonjs/mol-gl/renderable/cylinders.js +1 -1
  92. package/lib/commonjs/mol-gl/renderable/spheres.d.ts +1 -0
  93. package/lib/commonjs/mol-gl/renderable/spheres.js +1 -1
  94. package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
  95. package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
  96. package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.d.ts +1 -1
  97. package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.js +1 -1
  98. package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.d.ts +1 -1
  99. package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.js +1 -1
  100. package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.d.ts +2 -2
  101. package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.js +2 -2
  102. package/lib/commonjs/mol-gl/shader/cylinders.frag.d.ts +1 -1
  103. package/lib/commonjs/mol-gl/shader/cylinders.frag.js +1 -1
  104. package/lib/commonjs/mol-gl/shader/cylinders.vert.d.ts +2 -2
  105. package/lib/commonjs/mol-gl/shader/cylinders.vert.js +2 -2
  106. package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
  107. package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
  108. package/lib/commonjs/mol-gl/shader/outlines.frag.d.ts +1 -1
  109. package/lib/commonjs/mol-gl/shader/outlines.frag.js +1 -1
  110. package/lib/commonjs/mol-gl/shader/postprocessing.frag.d.ts +1 -1
  111. package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +1 -1
  112. package/lib/commonjs/mol-gl/shader/spheres.frag.d.ts +1 -1
  113. package/lib/commonjs/mol-gl/shader/spheres.frag.js +1 -1
  114. package/lib/commonjs/mol-gl/shader/spheres.vert.d.ts +2 -2
  115. package/lib/commonjs/mol-gl/shader/spheres.vert.js +2 -2
  116. package/lib/commonjs/mol-gl/webgl/renderbuffer.d.ts +1 -1
  117. package/lib/commonjs/mol-gl/webgl/renderbuffer.js +15 -0
  118. package/lib/commonjs/mol-gl/webgl/state.d.ts +12 -0
  119. package/lib/commonjs/mol-gl/webgl/state.js +136 -0
  120. package/lib/commonjs/mol-io/reader/cif/schema/segmentation.d.ts +38 -0
  121. package/lib/commonjs/mol-io/reader/cif/schema/segmentation.js +22 -0
  122. package/lib/commonjs/mol-io/reader/cif.d.ts +3 -1
  123. package/lib/commonjs/mol-io/reader/cif.js +3 -1
  124. package/lib/commonjs/mol-model/location.d.ts +2 -1
  125. package/lib/commonjs/mol-model/loci.d.ts +11 -11
  126. package/lib/commonjs/mol-model/loci.js +13 -1
  127. package/lib/commonjs/mol-model/sequence/alignment/sequence.d.ts +4 -1
  128. package/lib/commonjs/mol-model/sequence/alignment/sequence.js +4 -1
  129. package/lib/commonjs/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -0
  130. package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-index.js +8 -0
  131. package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.js +21 -5
  132. package/lib/commonjs/mol-model/structure/structure/util/superposition.d.ts +1 -0
  133. package/lib/commonjs/mol-model/structure/structure/util/superposition.js +2 -1
  134. package/lib/commonjs/mol-model/volume/volume.d.ts +35 -2
  135. package/lib/commonjs/mol-model/volume/volume.js +77 -2
  136. package/lib/commonjs/mol-model-formats/volume/segmentation.d.ts +23 -0
  137. package/lib/commonjs/mol-model-formats/volume/segmentation.js +138 -0
  138. package/lib/commonjs/mol-plugin/behavior/dynamic/representation.d.ts +2 -2
  139. package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
  140. package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +2 -1
  141. package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
  142. package/lib/commonjs/mol-plugin/commands.d.ts +1 -0
  143. package/lib/commonjs/mol-plugin-state/animation/built-in/model-index.js +4 -1
  144. package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +2 -0
  145. package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -0
  146. package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +13 -4
  147. package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.js +6 -1
  148. package/lib/commonjs/mol-plugin-state/builder/structure/representation.d.ts +1 -0
  149. package/lib/commonjs/mol-plugin-state/formats/provider.d.ts +2 -2
  150. package/lib/commonjs/mol-plugin-state/formats/provider.js +11 -3
  151. package/lib/commonjs/mol-plugin-state/formats/registry.js +6 -5
  152. package/lib/commonjs/mol-plugin-state/formats/volume.d.ts +27 -0
  153. package/lib/commonjs/mol-plugin-state/formats/volume.js +65 -1
  154. package/lib/commonjs/mol-plugin-state/manager/structure/component.d.ts +1 -1
  155. package/lib/commonjs/mol-plugin-state/manager/structure/component.js +18 -13
  156. package/lib/commonjs/mol-plugin-state/transforms/representation.d.ts +1 -2
  157. package/lib/commonjs/mol-plugin-state/transforms/representation.js +5 -6
  158. package/lib/commonjs/mol-plugin-state/transforms/volume.d.ts +11 -1
  159. package/lib/commonjs/mol-plugin-state/transforms/volume.js +55 -2
  160. package/lib/commonjs/mol-plugin-ui/controls/line-graph/line-graph-component.d.ts +1 -0
  161. package/lib/commonjs/mol-plugin-ui/controls/line-graph/line-graph-component.js +33 -13
  162. package/lib/commonjs/mol-plugin-ui/controls/parameters.d.ts +1 -0
  163. package/lib/commonjs/mol-plugin-ui/controls/parameters.js +22 -5
  164. package/lib/commonjs/mol-plugin-ui/sequence/sequence.d.ts +25 -17
  165. package/lib/commonjs/mol-plugin-ui/sequence.d.ts +19 -1
  166. package/lib/commonjs/mol-plugin-ui/sequence.js +8 -1
  167. package/lib/commonjs/mol-plugin-ui/state/apply-action.d.ts +2 -10
  168. package/lib/commonjs/mol-plugin-ui/state/apply-action.js +2 -2
  169. package/lib/commonjs/mol-plugin-ui/structure/quick-styles.js +2 -2
  170. package/lib/commonjs/mol-plugin-ui/structure/superposition.d.ts +1 -1
  171. package/lib/commonjs/mol-plugin-ui/structure/volume.d.ts +1 -1
  172. package/lib/commonjs/mol-plugin-ui/structure/volume.js +3 -2
  173. package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +1 -0
  174. package/lib/commonjs/mol-repr/structure/params.d.ts +2 -0
  175. package/lib/commonjs/mol-repr/structure/registry.d.ts +12 -0
  176. package/lib/commonjs/mol-repr/structure/representation/backbone.d.ts +3 -0
  177. package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.d.ts +6 -0
  178. package/lib/commonjs/mol-repr/structure/representation/ellipsoid.d.ts +6 -0
  179. package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
  180. package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
  181. package/lib/commonjs/mol-repr/structure/representation/line.d.ts +3 -0
  182. package/lib/commonjs/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
  183. package/lib/commonjs/mol-repr/structure/representation/point.d.ts +3 -0
  184. package/lib/commonjs/mol-repr/structure/representation/spacefill.d.ts +6 -0
  185. package/lib/commonjs/mol-repr/structure/units-visual.d.ts +2 -0
  186. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +4 -0
  187. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.js +2 -0
  188. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
  189. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.js +1 -0
  190. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +4 -0
  191. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -0
  192. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
  193. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.js +1 -0
  194. package/lib/commonjs/mol-repr/structure/visual/element-cross.d.ts +1 -0
  195. package/lib/commonjs/mol-repr/structure/visual/element-cross.js +2 -1
  196. package/lib/commonjs/mol-repr/structure/visual/element-point.d.ts +1 -0
  197. package/lib/commonjs/mol-repr/structure/visual/element-point.js +2 -1
  198. package/lib/commonjs/mol-repr/structure/visual/element-sphere.d.ts +4 -0
  199. package/lib/commonjs/mol-repr/structure/visual/element-sphere.js +3 -1
  200. package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
  201. package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.js +6 -2
  202. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
  203. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -1
  204. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
  205. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.js +3 -1
  206. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
  207. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.js +4 -0
  208. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
  209. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.js +2 -0
  210. package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
  211. package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
  212. package/lib/commonjs/mol-repr/structure/visual/util/bond.d.ts +7 -0
  213. package/lib/commonjs/mol-repr/structure/visual/util/bond.js +18 -7
  214. package/lib/commonjs/mol-repr/structure/visual/util/common.d.ts +4 -1
  215. package/lib/commonjs/mol-repr/structure/visual/util/common.js +10 -6
  216. package/lib/commonjs/mol-repr/structure/visual/util/element.d.ts +1 -0
  217. package/lib/commonjs/mol-repr/structure/visual/util/element.js +2 -3
  218. package/lib/commonjs/mol-repr/structure/visual/util/gaussian.d.ts +2 -0
  219. package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +4 -4
  220. package/lib/commonjs/mol-repr/volume/direct-volume.js +8 -6
  221. package/lib/commonjs/mol-repr/volume/isosurface.d.ts +4 -4
  222. package/lib/commonjs/mol-repr/volume/isosurface.js +17 -16
  223. package/lib/commonjs/mol-repr/volume/registry.d.ts +54 -1
  224. package/lib/commonjs/mol-repr/volume/registry.js +3 -1
  225. package/lib/commonjs/mol-repr/volume/representation.d.ts +11 -7
  226. package/lib/commonjs/mol-repr/volume/representation.js +142 -47
  227. package/lib/commonjs/mol-repr/volume/segment.d.ts +291 -0
  228. package/lib/commonjs/mol-repr/volume/segment.js +289 -0
  229. package/lib/commonjs/mol-repr/volume/slice.d.ts +2 -2
  230. package/lib/commonjs/mol-repr/volume/slice.js +5 -5
  231. package/lib/commonjs/mol-repr/volume/util.d.ts +12 -3
  232. package/lib/commonjs/mol-repr/volume/util.js +72 -6
  233. package/lib/commonjs/mol-script/language/builder.d.ts +1 -0
  234. package/lib/commonjs/mol-theme/color/volume-segment.d.ts +41 -0
  235. package/lib/commonjs/mol-theme/color/volume-segment.js +58 -0
  236. package/lib/commonjs/mol-theme/color/volume-value.js +2 -1
  237. package/lib/commonjs/mol-theme/color.d.ts +15 -0
  238. package/lib/commonjs/mol-theme/color.js +2 -0
  239. package/lib/commonjs/mol-theme/label.d.ts +1 -1
  240. package/lib/commonjs/mol-theme/label.js +13 -1
  241. package/lib/commonjs/mol-util/param-definition.d.ts +4 -1
  242. package/lib/commonjs/mol-util/param-definition.js +5 -2
  243. package/lib/examples/alpha-orbitals/index.html +72 -72
  244. package/lib/examples/basic-wrapper/index.html +137 -137
  245. package/lib/examples/lighting/index.html +88 -88
  246. package/lib/examples/lighting/index.js +1 -1
  247. package/lib/examples/proteopedia-wrapper/index.html +236 -236
  248. package/lib/extensions/anvil/behavior.d.ts +1 -0
  249. package/lib/extensions/cellpack/model.js +2 -1
  250. package/lib/extensions/dnatco/confal-pyramids/behavior.d.ts +1 -0
  251. package/lib/extensions/meshes/choice.d.ts +26 -0
  252. package/lib/extensions/meshes/choice.js +28 -0
  253. package/lib/extensions/meshes/examples.d.ts +26 -0
  254. package/lib/extensions/meshes/examples.js +325 -0
  255. package/lib/extensions/meshes/mesh-cif-schema.d.ts +29 -0
  256. package/lib/extensions/meshes/mesh-cif-schema.js +30 -0
  257. package/lib/extensions/meshes/mesh-extension.d.ts +66 -0
  258. package/lib/extensions/meshes/mesh-extension.js +218 -0
  259. package/lib/extensions/meshes/mesh-streaming/behavior.d.ts +105 -0
  260. package/lib/extensions/meshes/mesh-streaming/behavior.js +375 -0
  261. package/lib/extensions/meshes/mesh-streaming/server-info.d.ts +54 -0
  262. package/lib/extensions/meshes/mesh-streaming/server-info.js +26 -0
  263. package/lib/extensions/meshes/mesh-streaming/transformers.d.ts +42 -0
  264. package/lib/extensions/meshes/mesh-streaming/transformers.js +270 -0
  265. package/lib/extensions/meshes/mesh-utils.d.ts +41 -0
  266. package/lib/extensions/meshes/mesh-utils.js +346 -0
  267. package/lib/extensions/meshes/metadata.d.ts +108 -0
  268. package/lib/extensions/meshes/metadata.js +69 -0
  269. package/lib/extensions/model-archive/quality-assessment/behavior.d.ts +2 -0
  270. package/lib/extensions/model-archive/quality-assessment/prop.d.ts +1 -0
  271. package/lib/extensions/model-archive/quality-assessment/prop.js +16 -4
  272. package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +4 -2
  273. package/lib/extensions/rcsb/validation-report/behavior.d.ts +3 -0
  274. package/lib/extensions/volumes-and-segmentations/entry-meshes.d.ts +17 -0
  275. package/lib/extensions/volumes-and-segmentations/entry-meshes.js +153 -0
  276. package/lib/extensions/volumes-and-segmentations/entry-models.d.ts +12 -0
  277. package/lib/extensions/volumes-and-segmentations/entry-models.js +93 -0
  278. package/lib/extensions/volumes-and-segmentations/entry-root.d.ts +122 -0
  279. package/lib/extensions/volumes-and-segmentations/entry-root.js +571 -0
  280. package/lib/extensions/volumes-and-segmentations/entry-segmentation.d.ts +20 -0
  281. package/lib/extensions/volumes-and-segmentations/entry-segmentation.js +197 -0
  282. package/lib/extensions/volumes-and-segmentations/entry-state.d.ts +88 -0
  283. package/lib/extensions/volumes-and-segmentations/entry-state.js +29 -0
  284. package/lib/extensions/volumes-and-segmentations/entry-volume.d.ts +35 -0
  285. package/lib/extensions/volumes-and-segmentations/entry-volume.js +231 -0
  286. package/lib/extensions/volumes-and-segmentations/external-api.d.ts +11 -0
  287. package/lib/extensions/volumes-and-segmentations/external-api.js +80 -0
  288. package/lib/extensions/volumes-and-segmentations/global-state.d.ts +51 -0
  289. package/lib/extensions/volumes-and-segmentations/global-state.js +80 -0
  290. package/lib/extensions/volumes-and-segmentations/helpers.d.ts +56 -0
  291. package/lib/extensions/volumes-and-segmentations/helpers.js +163 -0
  292. package/lib/extensions/volumes-and-segmentations/index.d.ts +20 -0
  293. package/lib/extensions/volumes-and-segmentations/index.js +127 -0
  294. package/lib/extensions/volumes-and-segmentations/transformers.d.ts +33 -0
  295. package/lib/extensions/volumes-and-segmentations/transformers.js +82 -0
  296. package/lib/extensions/volumes-and-segmentations/ui.d.ts +29 -0
  297. package/lib/extensions/volumes-and-segmentations/ui.js +229 -0
  298. package/lib/extensions/volumes-and-segmentations/volseg-api/api.d.ts +22 -0
  299. package/lib/extensions/volumes-and-segmentations/volseg-api/api.js +80 -0
  300. package/lib/extensions/volumes-and-segmentations/volseg-api/data.d.ts +92 -0
  301. package/lib/extensions/volumes-and-segmentations/volseg-api/data.js +6 -0
  302. package/lib/extensions/volumes-and-segmentations/volseg-api/utils.d.ts +23 -0
  303. package/lib/extensions/volumes-and-segmentations/volseg-api/utils.js +75 -0
  304. package/lib/mol-canvas3d/canvas3d.d.ts +2 -0
  305. package/lib/mol-canvas3d/passes/draw.js +3 -3
  306. package/lib/mol-canvas3d/passes/image.d.ts +1 -0
  307. package/lib/mol-canvas3d/passes/postprocessing.d.ts +2 -1
  308. package/lib/mol-canvas3d/passes/postprocessing.js +27 -13
  309. package/lib/mol-geo/geometry/cylinders/cylinders.d.ts +2 -1
  310. package/lib/mol-geo/geometry/cylinders/cylinders.js +3 -2
  311. package/lib/mol-geo/geometry/lines/lines.d.ts +0 -1
  312. package/lib/mol-geo/geometry/points/points.d.ts +1 -1
  313. package/lib/mol-geo/geometry/spheres/spheres.d.ts +1 -0
  314. package/lib/mol-geo/geometry/spheres/spheres.js +3 -2
  315. package/lib/mol-gl/compute/histogram-pyramid/reduction.js +1 -2
  316. package/lib/mol-gl/compute/marching-cubes/isosurface.js +4 -6
  317. package/lib/mol-gl/renderable/cylinders.d.ts +1 -0
  318. package/lib/mol-gl/renderable/cylinders.js +1 -1
  319. package/lib/mol-gl/renderable/spheres.d.ts +1 -0
  320. package/lib/mol-gl/renderable/spheres.js +1 -1
  321. package/lib/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
  322. package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
  323. package/lib/mol-gl/shader/chunks/clip-instance.glsl.d.ts +1 -1
  324. package/lib/mol-gl/shader/chunks/clip-instance.glsl.js +1 -1
  325. package/lib/mol-gl/shader/chunks/clip-pixel.glsl.d.ts +1 -1
  326. package/lib/mol-gl/shader/chunks/clip-pixel.glsl.js +1 -1
  327. package/lib/mol-gl/shader/chunks/common-clip.glsl.d.ts +2 -2
  328. package/lib/mol-gl/shader/chunks/common-clip.glsl.js +2 -2
  329. package/lib/mol-gl/shader/cylinders.frag.d.ts +1 -1
  330. package/lib/mol-gl/shader/cylinders.frag.js +1 -1
  331. package/lib/mol-gl/shader/cylinders.vert.d.ts +2 -2
  332. package/lib/mol-gl/shader/cylinders.vert.js +2 -2
  333. package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
  334. package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
  335. package/lib/mol-gl/shader/outlines.frag.d.ts +1 -1
  336. package/lib/mol-gl/shader/outlines.frag.js +1 -1
  337. package/lib/mol-gl/shader/postprocessing.frag.d.ts +1 -1
  338. package/lib/mol-gl/shader/postprocessing.frag.js +1 -1
  339. package/lib/mol-gl/shader/spheres.frag.d.ts +1 -1
  340. package/lib/mol-gl/shader/spheres.frag.js +1 -1
  341. package/lib/mol-gl/shader/spheres.vert.d.ts +2 -2
  342. package/lib/mol-gl/shader/spheres.vert.js +2 -2
  343. package/lib/mol-gl/webgl/renderbuffer.d.ts +1 -1
  344. package/lib/mol-gl/webgl/renderbuffer.js +15 -0
  345. package/lib/mol-gl/webgl/state.d.ts +12 -0
  346. package/lib/mol-gl/webgl/state.js +136 -0
  347. package/lib/mol-io/reader/cif/schema/segmentation.d.ts +38 -0
  348. package/lib/mol-io/reader/cif/schema/segmentation.js +19 -0
  349. package/lib/mol-io/reader/cif.d.ts +3 -1
  350. package/lib/mol-io/reader/cif.js +3 -1
  351. package/lib/mol-model/location.d.ts +2 -1
  352. package/lib/mol-model/loci.d.ts +11 -11
  353. package/lib/mol-model/loci.js +13 -1
  354. package/lib/mol-model/sequence/alignment/sequence.d.ts +4 -1
  355. package/lib/mol-model/sequence/alignment/sequence.js +3 -2
  356. package/lib/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -0
  357. package/lib/mol-model/structure/model/properties/utils/atomic-index.js +8 -0
  358. package/lib/mol-model/structure/structure/unit/bonds/inter-compute.js +21 -5
  359. package/lib/mol-model/structure/structure/util/superposition.d.ts +1 -0
  360. package/lib/mol-model/structure/structure/util/superposition.js +1 -1
  361. package/lib/mol-model/volume/volume.d.ts +35 -2
  362. package/lib/mol-model/volume/volume.js +79 -4
  363. package/lib/mol-model-formats/volume/segmentation.d.ts +23 -0
  364. package/lib/mol-model-formats/volume/segmentation.js +135 -0
  365. package/lib/mol-plugin/behavior/dynamic/representation.d.ts +2 -2
  366. package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
  367. package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +2 -1
  368. package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
  369. package/lib/mol-plugin/commands.d.ts +1 -0
  370. package/lib/mol-plugin/version.js +2 -2
  371. package/lib/mol-plugin-state/animation/built-in/model-index.js +4 -1
  372. package/lib/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +2 -0
  373. package/lib/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -0
  374. package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +13 -4
  375. package/lib/mol-plugin-state/builder/structure/representation-preset.js +6 -1
  376. package/lib/mol-plugin-state/builder/structure/representation.d.ts +1 -0
  377. package/lib/mol-plugin-state/formats/provider.d.ts +2 -2
  378. package/lib/mol-plugin-state/formats/provider.js +11 -3
  379. package/lib/mol-plugin-state/formats/registry.js +6 -5
  380. package/lib/mol-plugin-state/formats/volume.d.ts +27 -0
  381. package/lib/mol-plugin-state/formats/volume.js +64 -0
  382. package/lib/mol-plugin-state/manager/structure/component.d.ts +1 -1
  383. package/lib/mol-plugin-state/manager/structure/component.js +18 -13
  384. package/lib/mol-plugin-state/transforms/representation.d.ts +1 -2
  385. package/lib/mol-plugin-state/transforms/representation.js +5 -6
  386. package/lib/mol-plugin-state/transforms/volume.d.ts +11 -1
  387. package/lib/mol-plugin-state/transforms/volume.js +54 -1
  388. package/lib/mol-plugin-ui/controls/line-graph/line-graph-component.d.ts +1 -0
  389. package/lib/mol-plugin-ui/controls/line-graph/line-graph-component.js +33 -13
  390. package/lib/mol-plugin-ui/controls/parameters.d.ts +1 -0
  391. package/lib/mol-plugin-ui/controls/parameters.js +22 -5
  392. package/lib/mol-plugin-ui/sequence/sequence.d.ts +25 -17
  393. package/lib/mol-plugin-ui/sequence.d.ts +19 -1
  394. package/lib/mol-plugin-ui/sequence.js +7 -7
  395. package/lib/mol-plugin-ui/skin/base/base.scss +32 -32
  396. package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
  397. package/lib/mol-plugin-ui/skin/base/components/controls.scss +418 -418
  398. package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
  399. package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
  400. package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
  401. package/lib/mol-plugin-ui/skin/base/components/misc.scss +643 -643
  402. package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
  403. package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
  404. package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
  405. package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
  406. package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
  407. package/lib/mol-plugin-ui/skin/base/components/viewport.scss +137 -128
  408. package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
  409. package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
  410. package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
  411. package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
  412. package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
  413. package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
  414. package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
  415. package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
  416. package/lib/mol-plugin-ui/skin/base/variables.scss +85 -85
  417. package/lib/mol-plugin-ui/skin/blue.scss +1 -1
  418. package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
  419. package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
  420. package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
  421. package/lib/mol-plugin-ui/skin/dark.scss +1 -1
  422. package/lib/mol-plugin-ui/skin/light.scss +1 -1
  423. package/lib/mol-plugin-ui/state/apply-action.d.ts +2 -10
  424. package/lib/mol-plugin-ui/state/apply-action.js +2 -2
  425. package/lib/mol-plugin-ui/structure/quick-styles.js +2 -2
  426. package/lib/mol-plugin-ui/structure/superposition.d.ts +1 -1
  427. package/lib/mol-plugin-ui/structure/volume.d.ts +1 -1
  428. package/lib/mol-plugin-ui/structure/volume.js +3 -2
  429. package/lib/mol-repr/structure/complex-visual.d.ts +1 -0
  430. package/lib/mol-repr/structure/params.d.ts +2 -0
  431. package/lib/mol-repr/structure/registry.d.ts +12 -0
  432. package/lib/mol-repr/structure/representation/backbone.d.ts +3 -0
  433. package/lib/mol-repr/structure/representation/ball-and-stick.d.ts +6 -0
  434. package/lib/mol-repr/structure/representation/ellipsoid.d.ts +6 -0
  435. package/lib/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
  436. package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
  437. package/lib/mol-repr/structure/representation/line.d.ts +3 -0
  438. package/lib/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
  439. package/lib/mol-repr/structure/representation/point.d.ts +3 -0
  440. package/lib/mol-repr/structure/representation/spacefill.d.ts +6 -0
  441. package/lib/mol-repr/structure/units-visual.d.ts +2 -0
  442. package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +4 -0
  443. package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.js +2 -0
  444. package/lib/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
  445. package/lib/mol-repr/structure/visual/bond-inter-unit-line.js +1 -0
  446. package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +4 -0
  447. package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -0
  448. package/lib/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
  449. package/lib/mol-repr/structure/visual/bond-intra-unit-line.js +1 -0
  450. package/lib/mol-repr/structure/visual/element-cross.d.ts +1 -0
  451. package/lib/mol-repr/structure/visual/element-cross.js +2 -1
  452. package/lib/mol-repr/structure/visual/element-point.d.ts +1 -0
  453. package/lib/mol-repr/structure/visual/element-point.js +2 -1
  454. package/lib/mol-repr/structure/visual/element-sphere.d.ts +4 -0
  455. package/lib/mol-repr/structure/visual/element-sphere.js +3 -1
  456. package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
  457. package/lib/mol-repr/structure/visual/gaussian-density-volume.js +6 -2
  458. package/lib/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
  459. package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -1
  460. package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
  461. package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.js +3 -1
  462. package/lib/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
  463. package/lib/mol-repr/structure/visual/molecular-surface-mesh.js +4 -0
  464. package/lib/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
  465. package/lib/mol-repr/structure/visual/molecular-surface-wireframe.js +2 -0
  466. package/lib/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
  467. package/lib/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
  468. package/lib/mol-repr/structure/visual/util/bond.d.ts +7 -0
  469. package/lib/mol-repr/structure/visual/util/bond.js +19 -8
  470. package/lib/mol-repr/structure/visual/util/common.d.ts +4 -1
  471. package/lib/mol-repr/structure/visual/util/common.js +10 -6
  472. package/lib/mol-repr/structure/visual/util/element.d.ts +1 -0
  473. package/lib/mol-repr/structure/visual/util/element.js +3 -4
  474. package/lib/mol-repr/structure/visual/util/gaussian.d.ts +2 -0
  475. package/lib/mol-repr/volume/direct-volume.d.ts +4 -4
  476. package/lib/mol-repr/volume/direct-volume.js +8 -6
  477. package/lib/mol-repr/volume/isosurface.d.ts +4 -4
  478. package/lib/mol-repr/volume/isosurface.js +17 -16
  479. package/lib/mol-repr/volume/registry.d.ts +54 -1
  480. package/lib/mol-repr/volume/registry.js +3 -1
  481. package/lib/mol-repr/volume/representation.d.ts +11 -7
  482. package/lib/mol-repr/volume/representation.js +144 -49
  483. package/lib/mol-repr/volume/segment.d.ts +291 -0
  484. package/lib/mol-repr/volume/segment.js +279 -0
  485. package/lib/mol-repr/volume/slice.d.ts +2 -2
  486. package/lib/mol-repr/volume/slice.js +5 -5
  487. package/lib/mol-repr/volume/util.d.ts +12 -3
  488. package/lib/mol-repr/volume/util.js +71 -6
  489. package/lib/mol-script/language/builder.d.ts +1 -0
  490. package/lib/mol-theme/color/volume-segment.d.ts +41 -0
  491. package/lib/mol-theme/color/volume-segment.js +53 -0
  492. package/lib/mol-theme/color/volume-value.js +2 -1
  493. package/lib/mol-theme/color.d.ts +15 -0
  494. package/lib/mol-theme/color.js +2 -0
  495. package/lib/mol-theme/label.d.ts +1 -1
  496. package/lib/mol-theme/label.js +13 -1
  497. package/lib/mol-util/param-definition.d.ts +4 -1
  498. package/lib/mol-util/param-definition.js +5 -2
  499. package/package.json +169 -168
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ *
4
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
+ */
6
+ import { __assign, __awaiter, __generator, __spreadArray } from "tslib";
7
+ import { ParamDefinition as PD } from '../../mol-util/param-definition';
8
+ import { Grid, Volume } from '../../mol-model/volume';
9
+ import { Mesh } from '../../mol-geo/geometry/mesh/mesh';
10
+ import { computeMarchingCubesMesh } from '../../mol-geo/util/marching-cubes/algorithm';
11
+ import { VolumeVisual, VolumeRepresentation, VolumeRepresentationProvider } from './representation';
12
+ import { LocationIterator } from '../../mol-geo/util/location-iterator';
13
+ import { Representation } from '../representation';
14
+ import { EmptyLoci } from '../../mol-model/loci';
15
+ import { Interval, SortedArray } from '../../mol-data/int';
16
+ import { Mat4, Tensor, Vec2, Vec3 } from '../../mol-math/linear-algebra';
17
+ import { fillSerial } from '../../mol-util/array';
18
+ import { createSegmentTexture2d, eachVolumeLoci, getVolumeTexture2dLayout } from './util';
19
+ import { TextureMesh } from '../../mol-geo/geometry/texture-mesh/texture-mesh';
20
+ import { BaseGeometry } from '../../mol-geo/geometry/base';
21
+ import { ValueCell } from '../../mol-util/value-cell';
22
+ import { extractIsosurface } from '../../mol-gl/compute/marching-cubes/isosurface';
23
+ import { Box3D } from '../../mol-math/geometry/primitives/box3d';
24
+ export var VolumeSegmentParams = {
25
+ segments: PD.Converted(function (v) { return v.map(function (x) { return "".concat(x); }); }, function (v) { return v.map(function (x) { return parseInt(x); }); }, PD.MultiSelect(['0'], PD.arrayToOptions(['0']), {
26
+ isEssential: true
27
+ }))
28
+ };
29
+ function gpuSupport(webgl) {
30
+ return webgl.extensions.colorBufferFloat && webgl.extensions.textureFloat && webgl.extensions.drawBuffers;
31
+ }
32
+ var Padding = 1;
33
+ function suitableForGpu(volume, webgl) {
34
+ // small volumes are about as fast or faster on CPU vs integrated GPU
35
+ if (volume.grid.cells.data.length < Math.pow(10, 3))
36
+ return false;
37
+ // the GPU is much more memory contraint, especially true for integrated GPUs,
38
+ // fallback to CPU for large volumes
39
+ var gridDim = volume.grid.cells.space.dimensions;
40
+ var powerOfTwoSize = getVolumeTexture2dLayout(gridDim, Padding).powerOfTwoSize;
41
+ return powerOfTwoSize <= webgl.maxTextureSize / 2;
42
+ }
43
+ var _translate = Mat4();
44
+ function getSegmentTransform(grid, segmentBox) {
45
+ var transform = Grid.getGridToCartesianTransform(grid);
46
+ var translate = Mat4.fromTranslation(_translate, segmentBox.min);
47
+ return Mat4.mul(Mat4(), transform, translate);
48
+ }
49
+ export function SegmentVisual(materialId, volume, key, props, webgl) {
50
+ if (props.tryUseGpu && webgl && gpuSupport(webgl) && suitableForGpu(volume, webgl)) {
51
+ return SegmentTextureMeshVisual(materialId);
52
+ }
53
+ return SegmentMeshVisual(materialId);
54
+ }
55
+ function getLoci(volume, props) {
56
+ return Volume.Segment.Loci(volume, props.segments);
57
+ }
58
+ function getSegmentLoci(pickingId, volume, key, props, id) {
59
+ var objectId = pickingId.objectId, groupId = pickingId.groupId;
60
+ if (id === objectId) {
61
+ var granularity = Volume.PickingGranularity.get(volume);
62
+ if (granularity === 'volume') {
63
+ return Volume.Loci(volume);
64
+ }
65
+ else if (granularity === 'object') {
66
+ return Volume.Segment.Loci(volume, [key]);
67
+ }
68
+ else {
69
+ return Volume.Cell.Loci(volume, Interval.ofSingleton(groupId));
70
+ }
71
+ }
72
+ return EmptyLoci;
73
+ }
74
+ export function eachSegment(loci, volume, key, props, apply) {
75
+ var segments = SortedArray.ofSingleton(key);
76
+ return eachVolumeLoci(loci, volume, { segments: segments }, apply);
77
+ }
78
+ //
79
+ function getSegmentCells(set, bbox, cells) {
80
+ var data = cells.data;
81
+ var o = cells.space.dataOffset;
82
+ var dim = Box3D.size(Vec3(), bbox);
83
+ var xn = dim[0], yn = dim[1], zn = dim[2];
84
+ var xn1 = xn - 1;
85
+ var yn1 = yn - 1;
86
+ var zn1 = zn - 1;
87
+ var _a = bbox.min, minx = _a[0], miny = _a[1], minz = _a[2];
88
+ var _b = bbox.max, maxx = _b[0], maxy = _b[1], maxz = _b[2];
89
+ var axisOrder = __spreadArray([], cells.space.axisOrderSlowToFast, true);
90
+ var segmentSpace = Tensor.Space(dim, axisOrder, Uint8Array);
91
+ var segmentCells = Tensor.create(segmentSpace, segmentSpace.create());
92
+ var segData = segmentCells.data;
93
+ var segSet = segmentSpace.set;
94
+ for (var z = 0; z < zn; ++z) {
95
+ for (var y = 0; y < yn; ++y) {
96
+ for (var x = 0; x < xn; ++x) {
97
+ var v0 = set.includes(data[o(x + minx, y + miny, z + minz)]) ? 255 : 0;
98
+ var xp = set.includes(data[o(Math.min(xn1 + maxx, x + 1 + minx), y + miny, z + minz)]) ? 255 : 0;
99
+ var xn_1 = set.includes(data[o(Math.max(0, x - 1 + minx), y + miny, z + minz)]) ? 255 : 0;
100
+ var yp = set.includes(data[o(x + minx, Math.min(yn1 + maxy, y + 1 + miny), z + minz)]) ? 255 : 0;
101
+ var yn_1 = set.includes(data[o(x + minx, Math.max(0, y - 1 + miny), z + minz)]) ? 255 : 0;
102
+ var zp = set.includes(data[o(x + minx, y + miny, Math.min(zn1 + maxz, z + 1 + minz))]) ? 255 : 0;
103
+ var zn_1 = set.includes(data[o(x + minx, y + miny, Math.max(0, z - 1 + minz))]) ? 255 : 0;
104
+ segSet(segData, x, y, z, Math.round((v0 + v0 + xp + xn_1 + yp + yn_1 + zp + zn_1) / 8));
105
+ }
106
+ }
107
+ }
108
+ return segmentCells;
109
+ }
110
+ export function createVolumeSegmentMesh(ctx, volume, key, theme, props, mesh) {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ var segmentation, bbox, set, cells, ids, surface, transform;
113
+ return __generator(this, function (_a) {
114
+ switch (_a.label) {
115
+ case 0:
116
+ segmentation = Volume.Segmentation.get(volume);
117
+ if (!segmentation)
118
+ throw new Error('missing volume segmentation');
119
+ ctx.runtime.update({ message: 'Marching cubes...' });
120
+ bbox = Box3D.clone(segmentation.bounds[key]);
121
+ Box3D.expand(bbox, bbox, Vec3.create(2, 2, 2));
122
+ set = Array.from(segmentation.segments.get(key).values());
123
+ cells = getSegmentCells(set, bbox, volume.grid.cells);
124
+ ids = fillSerial(new Int32Array(cells.data.length));
125
+ return [4 /*yield*/, computeMarchingCubesMesh({
126
+ isoLevel: 128,
127
+ scalarField: cells,
128
+ idField: Tensor.create(cells.space, Tensor.Data1(ids))
129
+ }, mesh).runAsChild(ctx.runtime)];
130
+ case 1:
131
+ surface = _a.sent();
132
+ transform = getSegmentTransform(volume.grid, bbox);
133
+ Mesh.transform(surface, transform);
134
+ if (ctx.webgl && !ctx.webgl.isWebGL2) {
135
+ // 2nd arg means not to split triangles based on group id. Splitting triangles
136
+ // is too expensive if each cell has its own group id as is the case here.
137
+ Mesh.uniformTriangleGroup(surface, false);
138
+ ValueCell.updateIfChanged(surface.varyingGroup, false);
139
+ }
140
+ else {
141
+ ValueCell.updateIfChanged(surface.varyingGroup, true);
142
+ }
143
+ surface.setBoundingSphere(Volume.Segment.getBoundingSphere(volume, [key]));
144
+ return [2 /*return*/, surface];
145
+ }
146
+ });
147
+ });
148
+ }
149
+ export var SegmentMeshParams = __assign(__assign(__assign(__assign({}, Mesh.Params), TextureMesh.Params), VolumeSegmentParams), { quality: __assign(__assign({}, Mesh.Params.quality), { isEssential: false }), tryUseGpu: PD.Boolean(true) });
150
+ export function SegmentMeshVisual(materialId) {
151
+ return VolumeVisual({
152
+ defaultProps: PD.getDefaultValues(SegmentMeshParams),
153
+ createGeometry: createVolumeSegmentMesh,
154
+ createLocationIterator: function (volume, key) {
155
+ var l = Volume.Segment.Location(volume, key);
156
+ return LocationIterator(volume.grid.cells.data.length, 1, 1, function () { return l; });
157
+ },
158
+ getLoci: getSegmentLoci,
159
+ eachLocation: eachSegment,
160
+ setUpdateState: function (state, volume, newProps, currentProps) {
161
+ },
162
+ geometryUtils: Mesh.Utils,
163
+ mustRecreate: function (volumeKey, props, webgl) {
164
+ return props.tryUseGpu && !!webgl && suitableForGpu(volumeKey.volume, webgl);
165
+ }
166
+ }, materialId);
167
+ }
168
+ //
169
+ var SegmentTextureName = 'segment-texture';
170
+ function getSegmentTexture(volume, segment, webgl) {
171
+ var segmentation = Volume.Segmentation.get(volume);
172
+ if (!segmentation)
173
+ throw new Error('missing volume segmentation');
174
+ var resources = webgl.resources;
175
+ var bbox = Box3D.clone(segmentation.bounds[segment]);
176
+ Box3D.expand(bbox, bbox, Vec3.create(2, 2, 2));
177
+ var transform = getSegmentTransform(volume.grid, bbox);
178
+ var gridDimension = Box3D.size(Vec3(), bbox);
179
+ var _a = getVolumeTexture2dLayout(gridDimension, Padding), width = _a.width, height = _a.height, texDim = _a.powerOfTwoSize;
180
+ var gridTexDim = Vec3.create(width, height, 0);
181
+ var gridTexScale = Vec2.create(width / texDim, height / texDim);
182
+ // console.log({ texDim, width, height, gridDimension });
183
+ if (texDim > webgl.maxTextureSize / 2) {
184
+ throw new Error('volume too large for gpu segment extraction');
185
+ }
186
+ if (!webgl.namedTextures[SegmentTextureName]) {
187
+ webgl.namedTextures[SegmentTextureName] = resources.texture('image-uint8', 'alpha', 'ubyte', 'linear');
188
+ }
189
+ var texture = webgl.namedTextures[SegmentTextureName];
190
+ texture.define(texDim, texDim);
191
+ // load volume into sub-section of texture
192
+ var set = Array.from(segmentation.segments.get(segment).values());
193
+ texture.load(createSegmentTexture2d(volume, set, bbox, Padding), true);
194
+ gridDimension[0] += Padding;
195
+ gridDimension[1] += Padding;
196
+ return {
197
+ texture: texture,
198
+ transform: transform,
199
+ gridDimension: gridDimension,
200
+ gridTexDim: gridTexDim,
201
+ gridTexScale: gridTexScale
202
+ };
203
+ }
204
+ function createVolumeSegmentTextureMesh(ctx, volume, segment, theme, props, textureMesh) {
205
+ return __awaiter(this, void 0, void 0, function () {
206
+ var _a, texture, gridDimension, gridTexDim, gridTexScale, transform, axisOrder, buffer, gv, groupCount, surface;
207
+ return __generator(this, function (_b) {
208
+ if (!ctx.webgl)
209
+ throw new Error('webgl context required to create volume segment texture-mesh');
210
+ if (volume.grid.cells.data.length <= 1) {
211
+ return [2 /*return*/, TextureMesh.createEmpty(textureMesh)];
212
+ }
213
+ _a = getSegmentTexture(volume, segment, ctx.webgl), texture = _a.texture, gridDimension = _a.gridDimension, gridTexDim = _a.gridTexDim, gridTexScale = _a.gridTexScale, transform = _a.transform;
214
+ axisOrder = volume.grid.cells.space.axisOrderSlowToFast;
215
+ buffer = textureMesh === null || textureMesh === void 0 ? void 0 : textureMesh.doubleBuffer.get();
216
+ gv = extractIsosurface(ctx.webgl, texture, gridDimension, gridTexDim, gridTexScale, transform, 0.5, false, false, axisOrder, true, buffer === null || buffer === void 0 ? void 0 : buffer.vertex, buffer === null || buffer === void 0 ? void 0 : buffer.group, buffer === null || buffer === void 0 ? void 0 : buffer.normal);
217
+ groupCount = volume.grid.cells.data.length;
218
+ surface = TextureMesh.create(gv.vertexCount, groupCount, gv.vertexTexture, gv.groupTexture, gv.normalTexture, Volume.Segment.getBoundingSphere(volume, [segment]), textureMesh);
219
+ return [2 /*return*/, surface];
220
+ });
221
+ });
222
+ }
223
+ export function SegmentTextureMeshVisual(materialId) {
224
+ return VolumeVisual({
225
+ defaultProps: PD.getDefaultValues(SegmentMeshParams),
226
+ createGeometry: createVolumeSegmentTextureMesh,
227
+ createLocationIterator: function (volume, segment) {
228
+ var l = Volume.Segment.Location(volume, segment);
229
+ return LocationIterator(volume.grid.cells.data.length, 1, 1, function () { return l; });
230
+ },
231
+ getLoci: getSegmentLoci,
232
+ eachLocation: eachSegment,
233
+ setUpdateState: function (state, volume, newProps, currentProps) {
234
+ },
235
+ geometryUtils: TextureMesh.Utils,
236
+ mustRecreate: function (volumeKey, props, webgl) {
237
+ return !props.tryUseGpu || !webgl || !suitableForGpu(volumeKey.volume, webgl);
238
+ },
239
+ dispose: function (geometry) {
240
+ geometry.vertexTexture.ref.value.destroy();
241
+ geometry.groupTexture.ref.value.destroy();
242
+ geometry.normalTexture.ref.value.destroy();
243
+ geometry.doubleBuffer.destroy();
244
+ }
245
+ }, materialId);
246
+ }
247
+ //
248
+ function getSegments(props) {
249
+ return SortedArray.ofUnsortedArray(props.segments);
250
+ }
251
+ var SegmentVisuals = {
252
+ 'segment': function (ctx, getParams) { return VolumeRepresentation('Segment mesh', ctx, getParams, SegmentVisual, getLoci, getSegments); },
253
+ };
254
+ export var SegmentParams = __assign(__assign({}, SegmentMeshParams), { visuals: PD.MultiSelect(['segment'], PD.objectToOptions(SegmentVisuals)), bumpFrequency: PD.Numeric(1, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory) });
255
+ export function getSegmentParams(ctx, volume) {
256
+ var p = PD.clone(SegmentParams);
257
+ var segmentation = Volume.Segmentation.get(volume);
258
+ if (segmentation) {
259
+ var segments = Array.from(segmentation.segments.keys());
260
+ p.segments = PD.Converted(function (v) { return v.map(function (x) { return "".concat(x); }); }, function (v) { return v.map(function (x) { return parseInt(x); }); }, PD.MultiSelect(segments.map(function (x) { return "".concat(x); }), PD.arrayToOptions(segments.map(function (x) { return "".concat(x); })), {
261
+ isEssential: true
262
+ }));
263
+ }
264
+ return p;
265
+ }
266
+ export function SegmentRepresentation(ctx, getParams) {
267
+ return Representation.createMulti('Segment', ctx, getParams, Representation.StateBuilder, SegmentVisuals);
268
+ }
269
+ export var SegmentRepresentationProvider = VolumeRepresentationProvider({
270
+ name: 'segment',
271
+ label: 'Segment',
272
+ description: 'Displays a triangulated segment of volumetric data.',
273
+ factory: SegmentRepresentation,
274
+ getParams: getSegmentParams,
275
+ defaultValues: PD.getDefaultValues(SegmentParams),
276
+ defaultColorTheme: { name: 'volume-segment' },
277
+ defaultSizeTheme: { name: 'uniform' },
278
+ isApplicable: function (volume) { return !Volume.isEmpty(volume) && !!Volume.Segmentation.get(volume); }
279
+ });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
@@ -10,7 +10,7 @@ import { Volume } from '../../mol-model/volume';
10
10
  import { VolumeVisual, VolumeRepresentation, VolumeRepresentationProvider } from './representation';
11
11
  import { RepresentationContext, RepresentationParamsGetter } from '../representation';
12
12
  import { VisualContext } from '../visual';
13
- export declare function createImage(ctx: VisualContext, volume: Volume, theme: Theme, props: PD.Values<SliceParams>, image?: Image): Promise<Image>;
13
+ export declare function createImage(ctx: VisualContext, volume: Volume, key: number, theme: Theme, props: PD.Values<SliceParams>, image?: Image): Promise<Image>;
14
14
  export declare const SliceParams: {
15
15
  quality: {
16
16
  isEssential: boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
@@ -17,7 +17,7 @@ import { Color } from '../../mol-util/color';
17
17
  import { ColorTheme } from '../../mol-theme/color';
18
18
  import { packIntToRGBArray } from '../../mol-util/number-packing';
19
19
  import { eachVolumeLoci } from './util';
20
- export function createImage(ctx, volume, theme, props, image) {
20
+ export function createImage(ctx, volume, key, theme, props, image) {
21
21
  return __awaiter(this, void 0, void 0, function () {
22
22
  var dim, isoValue, _a, space, data, _b, min, max, isoVal, color, _c, r, g, b, _d, width, height, x, y, z, x0, y0, z0, nx, ny, nz, corners, imageArray, groupArray, i, iy, ix, iz, val, normVal, imageTexture, groupTexture, transform;
23
23
  return __generator(this, function (_e) {
@@ -126,7 +126,7 @@ function getLoci(volume, props) {
126
126
  var groupArray = getGroupArray(volume.grid, props);
127
127
  return Volume.Cell.Loci(volume, SortedArray.ofUnsortedArray(groupArray));
128
128
  }
129
- function getSliceLoci(pickingId, volume, props, id) {
129
+ function getSliceLoci(pickingId, volume, key, props, id) {
130
130
  var objectId = pickingId.objectId, groupId = pickingId.groupId;
131
131
  if (id === objectId) {
132
132
  var granularity = Volume.PickingGranularity.get(volume);
@@ -142,7 +142,7 @@ function getSliceLoci(pickingId, volume, props, id) {
142
142
  }
143
143
  return EmptyLoci;
144
144
  }
145
- function eachSlice(loci, volume, props, apply) {
145
+ function eachSlice(loci, volume, key, props, apply) {
146
146
  return eachVolumeLoci(loci, volume, undefined, apply);
147
147
  }
148
148
  //
@@ -199,5 +199,5 @@ export var SliceRepresentationProvider = VolumeRepresentationProvider({
199
199
  defaultValues: PD.getDefaultValues(SliceParams),
200
200
  defaultColorTheme: { name: 'uniform' },
201
201
  defaultSizeTheme: { name: 'uniform' },
202
- isApplicable: function (volume) { return !Volume.isEmpty(volume); }
202
+ isApplicable: function (volume) { return !Volume.isEmpty(volume) && !Volume.Segmentation.get(volume); }
203
203
  });
@@ -1,13 +1,17 @@
1
1
  /**
2
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
6
  import { Volume } from '../../mol-model/volume';
7
7
  import { Loci } from '../../mol-model/loci';
8
- import { Interval } from '../../mol-data/int';
8
+ import { Interval, SortedArray } from '../../mol-data/int';
9
9
  import { Vec3 } from '../../mol-math/linear-algebra/3d/vec3';
10
- export declare function eachVolumeLoci(loci: Loci, volume: Volume, isoValue: Volume.IsoValue | undefined, apply: (interval: Interval) => boolean): boolean;
10
+ import { Box3D } from '../../mol-math/geometry';
11
+ export declare function eachVolumeLoci(loci: Loci, volume: Volume, props: {
12
+ isoValue?: Volume.IsoValue;
13
+ segments?: SortedArray;
14
+ } | undefined, apply: (interval: Interval) => boolean): boolean;
11
15
  export declare function getVolumeTexture2dLayout(dim: Vec3, padding?: number): {
12
16
  width: number;
13
17
  height: number;
@@ -26,3 +30,8 @@ export declare function createVolumeTexture3d(volume: Volume): {
26
30
  height: number;
27
31
  depth: number;
28
32
  };
33
+ export declare function createSegmentTexture2d(volume: Volume, set: number[], bbox: Box3D, padding?: number): {
34
+ array: Uint8Array;
35
+ width: number;
36
+ height: number;
37
+ };
@@ -1,13 +1,15 @@
1
1
  /**
2
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
6
  import { Volume } from '../../mol-model/volume';
7
- import { Interval, OrderedSet } from '../../mol-data/int';
7
+ import { Interval, OrderedSet, SortedArray } from '../../mol-data/int';
8
8
  import { equalEps } from '../../mol-math/linear-algebra/3d/common';
9
9
  import { Vec3 } from '../../mol-math/linear-algebra/3d/vec3';
10
10
  import { packIntToRGBArray } from '../../mol-util/number-packing';
11
+ import { SetUtils } from '../../mol-util/set';
12
+ import { Box3D } from '../../mol-math/geometry';
11
13
  // avoiding namespace lookup improved performance in Chrome (Aug 2020)
12
14
  var v3set = Vec3.set;
13
15
  var v3normalize = Vec3.normalize;
@@ -15,7 +17,7 @@ var v3sub = Vec3.sub;
15
17
  var v3addScalar = Vec3.addScalar;
16
18
  var v3scale = Vec3.scale;
17
19
  var v3toArray = Vec3.toArray;
18
- export function eachVolumeLoci(loci, volume, isoValue, apply) {
20
+ export function eachVolumeLoci(loci, volume, props, apply) {
19
21
  var changed = false;
20
22
  if (Volume.isLoci(loci)) {
21
23
  if (!Volume.areEquivalent(loci.volume, volume))
@@ -26,14 +28,13 @@ export function eachVolumeLoci(loci, volume, isoValue, apply) {
26
28
  else if (Volume.Isosurface.isLoci(loci)) {
27
29
  if (!Volume.areEquivalent(loci.volume, volume))
28
30
  return false;
29
- if (isoValue) {
30
- if (!Volume.IsoValue.areSame(loci.isoValue, isoValue, volume.grid.stats))
31
+ if (props === null || props === void 0 ? void 0 : props.isoValue) {
32
+ if (!Volume.IsoValue.areSame(loci.isoValue, props.isoValue, volume.grid.stats))
31
33
  return false;
32
34
  if (apply(Interval.ofLength(volume.grid.cells.data.length)))
33
35
  changed = true;
34
36
  }
35
37
  else {
36
- // TODO find a cheaper way?
37
38
  var _a = volume.grid, stats = _a.stats, data = _a.cells.data;
38
39
  var eps = stats.sigma;
39
40
  var v = Volume.IsoValue.toAbsolute(loci.isoValue, stats).absoluteValue;
@@ -59,6 +60,33 @@ export function eachVolumeLoci(loci, volume, isoValue, apply) {
59
60
  });
60
61
  }
61
62
  }
63
+ else if (Volume.Segment.isLoci(loci)) {
64
+ if (!Volume.areEquivalent(loci.volume, volume))
65
+ return false;
66
+ if (props === null || props === void 0 ? void 0 : props.segments) {
67
+ if (!SortedArray.areIntersecting(loci.segments, props.segments))
68
+ return false;
69
+ if (apply(Interval.ofLength(volume.grid.cells.data.length)))
70
+ changed = true;
71
+ }
72
+ else {
73
+ var segmentation = Volume.Segmentation.get(volume);
74
+ if (segmentation) {
75
+ var set = new Set();
76
+ for (var i = 0, il = loci.segments.length; i < il; ++i) {
77
+ SetUtils.add(set, segmentation.segments.get(loci.segments[i]));
78
+ }
79
+ var s = Array.from(set.values());
80
+ var d = volume.grid.cells.data;
81
+ for (var i = 0, il = d.length; i < il; ++i) {
82
+ if (s.includes(d[i])) {
83
+ if (apply(Interval.ofSingleton(i)))
84
+ changed = true;
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
62
90
  return changed;
63
91
  }
64
92
  //
@@ -158,3 +186,40 @@ export function createVolumeTexture3d(volume) {
158
186
  }
159
187
  return textureVolume;
160
188
  }
189
+ export function createSegmentTexture2d(volume, set, bbox, padding) {
190
+ if (padding === void 0) { padding = 0; }
191
+ var data = volume.grid.cells.data;
192
+ var dim = Box3D.size(Vec3(), bbox);
193
+ var o = volume.grid.cells.space.dataOffset;
194
+ var _a = getVolumeTexture2dLayout(dim, padding), width = _a.width, height = _a.height;
195
+ var itemSize = 1;
196
+ var array = new Uint8Array(width * height * itemSize);
197
+ var textureImage = { array: array, width: width, height: height };
198
+ var xn = dim[0], yn = dim[1], zn = dim[2];
199
+ var xn1 = xn - 1;
200
+ var yn1 = yn - 1;
201
+ var zn1 = zn - 1;
202
+ var xnp = xn + padding;
203
+ var ynp = yn + padding;
204
+ var _b = bbox.min, minx = _b[0], miny = _b[1], minz = _b[2];
205
+ var _c = bbox.max, maxx = _c[0], maxy = _c[1], maxz = _c[2];
206
+ for (var z = 0; z < zn; ++z) {
207
+ for (var y = 0; y < yn; ++y) {
208
+ for (var x = 0; x < xn; ++x) {
209
+ var column = Math.floor(((z * xnp) % width) / xnp);
210
+ var row = Math.floor((z * xnp) / width);
211
+ var px = column * xnp + x;
212
+ var index = itemSize * ((row * ynp * width) + (y * width) + px);
213
+ var v0 = set.includes(data[o(x + minx, y + miny, z + minz)]) ? 255 : 0;
214
+ var xp = set.includes(data[o(Math.min(xn1 + maxx, x + 1 + minx), y + miny, z + minz)]) ? 255 : 0;
215
+ var xn_1 = set.includes(data[o(Math.max(0, x - 1 + minx), y + miny, z + minz)]) ? 255 : 0;
216
+ var yp = set.includes(data[o(x + minx, Math.min(yn1 + maxy, y + 1 + miny), z + minz)]) ? 255 : 0;
217
+ var yn_1 = set.includes(data[o(x + minx, Math.max(0, y - 1 + miny), z + minz)]) ? 255 : 0;
218
+ var zp = set.includes(data[o(x + minx, y + miny, Math.min(zn1 + maxz, z + 1 + minz))]) ? 255 : 0;
219
+ var zn_1 = set.includes(data[o(x + minx, y + miny, Math.max(0, z - 1 + minz))]) ? 255 : 0;
220
+ array[index] = Math.round((v0 + v0 + xp + xn_1 + yp + yn_1 + zp + zn_1) / 8);
221
+ }
222
+ }
223
+ }
224
+ return textureImage;
225
+ }
@@ -10,6 +10,7 @@ export declare namespace MolScriptBuilder {
10
10
  '@header': string;
11
11
  type: {
12
12
  '@header': string;
13
+ /** atom macromolecular property set */
13
14
  bool: MSymbol<import("./symbol").Arguments<import("./symbol").Arguments.PropTypes<{
14
15
  0: import("./symbol").Argument<import("./type").Type.AnyValue>;
15
16
  }>>, import("./type").Type.OneOf<boolean>>;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ *
4
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
+ */
6
+ import { ColorTheme } from '../color';
7
+ import { ParamDefinition as PD } from '../../mol-util/param-definition';
8
+ import { ThemeDataContext } from '../../mol-theme/theme';
9
+ export declare const VolumeSegmentColorThemeParams: {
10
+ palette: PD.Mapped<PD.NamedParams<PD.Normalize<{
11
+ maxCount: number;
12
+ hue: [number, number];
13
+ chroma: [number, number];
14
+ luminance: [number, number];
15
+ clusteringStepCount: number;
16
+ minSampleCount: number;
17
+ }>, "generate"> | PD.NamedParams<PD.Normalize<{
18
+ list: {
19
+ kind: "set" | "interpolate";
20
+ colors: import("../../mol-util/color/color").ColorListEntry[];
21
+ };
22
+ }>, "colors">>;
23
+ };
24
+ export type VolumeSegmentColorThemeParams = typeof VolumeSegmentColorThemeParams;
25
+ export declare function getVolumeSegmentColorThemeParams(ctx: ThemeDataContext): {
26
+ palette: PD.Mapped<PD.NamedParams<PD.Normalize<{
27
+ maxCount: number;
28
+ hue: [number, number];
29
+ chroma: [number, number];
30
+ luminance: [number, number];
31
+ clusteringStepCount: number;
32
+ minSampleCount: number;
33
+ }>, "generate"> | PD.NamedParams<PD.Normalize<{
34
+ list: {
35
+ kind: "set" | "interpolate";
36
+ colors: import("../../mol-util/color/color").ColorListEntry[];
37
+ };
38
+ }>, "colors">>;
39
+ };
40
+ export declare function VolumeSegmentColorTheme(ctx: ThemeDataContext, props: PD.Values<VolumeSegmentColorThemeParams>): ColorTheme<VolumeSegmentColorThemeParams>;
41
+ export declare const VolumeSegmentColorThemeProvider: ColorTheme.Provider<VolumeSegmentColorThemeParams, 'volume-segment'>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ *
4
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
+ */
6
+ import { __assign } from "tslib";
7
+ import { Color } from '../../mol-util/color';
8
+ import { ParamDefinition as PD } from '../../mol-util/param-definition';
9
+ import { getPaletteParams, getPalette } from '../../mol-util/color/palette';
10
+ import { Volume } from '../../mol-model/volume/volume';
11
+ var DefaultColor = Color(0xCCCCCC);
12
+ var Description = 'Gives every volume segment a unique color.';
13
+ export var VolumeSegmentColorThemeParams = __assign({}, getPaletteParams({ type: 'colors', colorList: 'many-distinct' }));
14
+ export function getVolumeSegmentColorThemeParams(ctx) {
15
+ return PD.clone(VolumeSegmentColorThemeParams);
16
+ }
17
+ export function VolumeSegmentColorTheme(ctx, props) {
18
+ var color;
19
+ var legend;
20
+ var segmentation = ctx.volume && Volume.Segmentation.get(ctx.volume);
21
+ if (segmentation) {
22
+ var size = segmentation.segments.size;
23
+ var segments_1 = Array.from(segmentation.segments.keys());
24
+ var palette_1 = getPalette(size, props);
25
+ legend = palette_1.legend;
26
+ color = function (location) {
27
+ if (Volume.Segment.isLocation(location)) {
28
+ return palette_1.color(segments_1.indexOf(location.segment));
29
+ }
30
+ return DefaultColor;
31
+ };
32
+ }
33
+ else {
34
+ color = function () { return DefaultColor; };
35
+ }
36
+ return {
37
+ factory: VolumeSegmentColorTheme,
38
+ granularity: 'instance',
39
+ color: color,
40
+ props: props,
41
+ description: Description,
42
+ legend: legend
43
+ };
44
+ }
45
+ export var VolumeSegmentColorThemeProvider = {
46
+ name: 'volume-segment',
47
+ label: 'Volume Segment',
48
+ category: "Miscellaneous" /* ColorTheme.Category.Misc */,
49
+ factory: VolumeSegmentColorTheme,
50
+ getParams: getVolumeSegmentColorThemeParams,
51
+ defaultValues: PD.getDefaultValues(VolumeSegmentColorThemeParams),
52
+ isApplicable: function (ctx) { return !!ctx.volume && !!Volume.Segmentation.get(ctx.volume); }
53
+ };
@@ -6,6 +6,7 @@
6
6
  import { ColorScale } from '../../mol-util/color';
7
7
  import { ParamDefinition as PD } from '../../mol-util/param-definition';
8
8
  import { ColorNames } from '../../mol-util/color/names';
9
+ import { Volume } from '../../mol-model/volume/volume';
9
10
  var Description = 'Assign color based on the given value of a volume cell.';
10
11
  export var VolumeValueColorThemeParams = {
11
12
  colorList: PD.ColorList({
@@ -45,5 +46,5 @@ export var VolumeValueColorThemeProvider = {
45
46
  factory: VolumeValueColorTheme,
46
47
  getParams: getVolumeValueColorThemeParams,
47
48
  defaultValues: PD.getDefaultValues(VolumeValueColorThemeParams),
48
- isApplicable: function (ctx) { return !!ctx.volume; },
49
+ isApplicable: function (ctx) { return !!ctx.volume && !Volume.Segmentation.get(ctx.volume); },
49
50
  };
@@ -629,6 +629,21 @@ declare namespace ColorTheme {
629
629
  uniform: Provider<{
630
630
  value: PD.Color;
631
631
  }, "uniform", ColorType>;
632
+ 'volume-segment': Provider<{
633
+ palette: PD.Mapped<PD.NamedParams<PD.Normalize<{
634
+ maxCount: number;
635
+ hue: [number, number];
636
+ chroma: [number, number];
637
+ luminance: [number, number];
638
+ clusteringStepCount: number;
639
+ minSampleCount: number;
640
+ }>, "generate"> | PD.NamedParams<PD.Normalize<{
641
+ list: {
642
+ kind: "set" | "interpolate";
643
+ colors: import("../mol-util/color/color").ColorListEntry[];
644
+ };
645
+ }>, "colors">>;
646
+ }, "volume-segment", ColorType>;
632
647
  'volume-value': Provider<{
633
648
  colorList: PD.ColorList;
634
649
  }, "volume-value", ColorType>;
@@ -33,6 +33,7 @@ import { EntityIdColorThemeProvider } from './color/entity-id';
33
33
  import { VolumeValueColorThemeProvider } from './color/volume-value';
34
34
  import { ModelIndexColorThemeProvider } from './color/model-index';
35
35
  import { StructureIndexColorThemeProvider } from './color/structure-index';
36
+ import { VolumeSegmentColorThemeProvider } from './color/volume-segment';
36
37
  import { ExternalVolumeColorThemeProvider } from './color/external-volume';
37
38
  export { ColorTheme };
38
39
  var ColorTheme;
@@ -82,6 +83,7 @@ var ColorTheme;
82
83
  'uncertainty': UncertaintyColorThemeProvider,
83
84
  'unit-index': UnitIndexColorThemeProvider,
84
85
  'uniform': UniformColorThemeProvider,
86
+ 'volume-segment': VolumeSegmentColorThemeProvider,
85
87
  'volume-value': VolumeValueColorThemeProvider,
86
88
  'external-volume': ExternalVolumeColorThemeProvider,
87
89
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  * @author David Sehnal <david.sehnal@gmail.com>