UNPKG

molstar

Version:

A comprehensive macromolecular library.

186 lines (185 loc) 6.88 kB
/** * Copyright (c) 2020-2025 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { Grid } from './grid'; import { OrderedSet, SortedArray } from '../../mol-data/int'; import { Box3D, Sphere3D } from '../../mol-math/geometry'; import { ModelFormat } from '../../mol-model-formats/format'; import { CustomProperties } from '../custom-property'; import { ParamDefinition as PD } from '../../mol-util/param-definition'; export interface Volume { readonly label?: string; readonly entryId?: string; readonly grid: Grid; readonly sourceData: ModelFormat; customProperties: CustomProperties; /** * Not to be accessed directly, each custom property descriptor * defines property accessors that use this field to store the data. */ _propertyData: { [name: string]: any; }; readonly colorVolume?: Volume; } export declare namespace Volume { function is(x: any): x is Volume; type CellIndex = { readonly '@type': 'cell-index'; } & number; type IsoValue = IsoValue.Absolute | IsoValue.Relative; namespace IsoValue { type Relative = Readonly<{ kind: 'relative'; relativeValue: number; }>; type Absolute = Readonly<{ kind: 'absolute'; absoluteValue: number; }>; function areSame(a: IsoValue, b: IsoValue, stats: Grid['stats']): boolean; function absolute(value: number): Absolute; function relative(value: number): Relative; function calcAbsolute(stats: Grid['stats'], relativeValue: number): number; function calcRelative(stats: Grid['stats'], absoluteValue: number): number; function toAbsolute(value: IsoValue, stats: Grid['stats']): Absolute; function toRelative(value: IsoValue, stats: Grid['stats']): Relative; function toString(value: IsoValue): string; } function adjustedIsoValue(volume: Volume, value: number, kind: 'absolute' | 'relative'): Readonly<{ kind: "absolute"; absoluteValue: number; }> | Readonly<{ kind: "relative"; relativeValue: number; }>; function createIsoValueParam(defaultValue: Volume.IsoValue, stats?: Grid['stats']): PD.Conditioned<Readonly<{ kind: "absolute"; absoluteValue: number; }> | Readonly<{ kind: "relative"; relativeValue: number; }>, PD.Base<Readonly<{ kind: "absolute"; absoluteValue: number; }> | Readonly<{ kind: "relative"; relativeValue: number; }>>, { absolute: PD.Converted<Readonly<{ kind: "absolute"; absoluteValue: number; }>, number>; relative: PD.Converted<Readonly<{ kind: "relative"; relativeValue: number; }>, number>; }>; const IsoValueParam: PD.Conditioned<Readonly<{ kind: "absolute"; absoluteValue: number; }> | Readonly<{ kind: "relative"; relativeValue: number; }>, PD.Base<Readonly<{ kind: "absolute"; absoluteValue: number; }> | Readonly<{ kind: "relative"; relativeValue: number; }>>, { absolute: PD.Converted<Readonly<{ kind: "absolute"; absoluteValue: number; }>, number>; relative: PD.Converted<Readonly<{ kind: "relative"; relativeValue: number; }>, number>; }>; type IsoValueParam = typeof IsoValueParam; const One: Volume; function areEquivalent(volA: Volume, volB: Volume): boolean; function isEmpty(vol: Volume): boolean; function isOrbitals(volume: Volume): boolean; interface Loci { readonly kind: 'volume-loci'; readonly volume: Volume; } function Loci(volume: Volume): Loci; function isLoci(x: any): x is Loci; function areLociEqual(a: Loci, b: Loci): boolean; function isLociEmpty(loci: Loci): boolean; function getBoundingSphere(volume: Volume, boundingSphere?: Sphere3D): Sphere3D; namespace Isosurface { interface Loci { readonly kind: 'isosurface-loci'; readonly volume: Volume; readonly isoValue: Volume.IsoValue; } function Loci(volume: Volume, isoValue: Volume.IsoValue): Loci; function isLoci(x: any): x is Loci; function areLociEqual(a: Loci, b: Loci): boolean; function isLociEmpty(loci: Loci): boolean; function getBoundingSphere(volume: Volume, isoValue: Volume.IsoValue, boundingSphere?: Sphere3D): Sphere3D; } namespace Cell { interface Loci { readonly kind: 'cell-loci'; readonly volume: Volume; readonly indices: OrderedSet<CellIndex>; } function Loci(volume: Volume, indices: OrderedSet<CellIndex>): Loci; function isLoci(x: any): x is Loci; function areLociEqual(a: Loci, b: Loci): boolean; function isLociEmpty(loci: Loci): boolean; interface Location { readonly kind: 'cell-location'; volume: Volume; cell: CellIndex; } function Location(volume?: Volume, cell?: CellIndex): Location; function isLocation(x: any): x is Location; function getBoundingSphere(volume: Volume, indices: OrderedSet<CellIndex>, boundingSphere?: Sphere3D): Sphere3D; } namespace Segment { interface Loci { readonly kind: 'segment-loci'; readonly volume: Volume; readonly segments: SortedArray; } function Loci(volume: Volume, segments: ArrayLike<number>): Loci; function isLoci(x: any): x is Loci; function areLociEqual(a: Loci, b: Loci): boolean; function isLociEmpty(loci: Loci): boolean; function getBoundingSphere(volume: Volume, segments: ArrayLike<number>, boundingSphere?: Sphere3D): Sphere3D; interface Location { readonly kind: 'segment-location'; volume: Volume; segment: number; } function Location(volume?: Volume, segment?: number): Location; function isLocation(x: any): x is Location; } type PickingGranularity = 'volume' | 'object' | 'voxel'; const PickingGranularity: { set(volume: Volume, granularity: PickingGranularity): void; get(volume: Volume): PickingGranularity; }; type Segmentation = { segments: Map<number, Set<number>>; sets: Map<number, Set<number>>; bounds: { [k: number]: Box3D; }; labels: { [k: number]: string; }; }; const Segmentation: { set(volume: Volume, segmentation: Segmentation): void; get(volume: Volume): Segmentation | undefined; }; }