/** * Copyright (c) 2020-2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose * @author David Sehnal */ import { Grid } from './grid.js'; import { OrderedSet } from '../../mol-data/int.js'; import { Box3D, Sphere3D } from '../../mol-math/geometry.js'; import { Vec3, Mat4 } from '../../mol-math/linear-algebra.js'; import { ModelFormat } from '../../mol-model-formats/format.js'; import { CustomProperties } from '../custom-property.js'; import { ParamDefinition as PD } from '../../mol-util/param-definition.js'; export interface Volume { readonly label?: string; readonly entryId?: string; readonly grid: Grid; readonly instances: ReadonlyArray<{ transform: Mat4; }>; 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; }; _localPropertyData: { [name: string]: any; }; readonly colorVolume?: Volume; readonly parent?: Volume; } export declare namespace Volume { export function is(x: any): x is Volume; export type CellIndex = { readonly '@type': 'cell-index'; } & number; export type InstanceIndex = { readonly '@type': 'instance-index'; } & number; export type SegmentIndex = { readonly '@type': 'segment-index'; } & number; export type IsoValue = IsoValue.Absolute | IsoValue.Relative; export 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; } export function adjustedIsoValue(volume: Volume, value: number, kind: 'absolute' | 'relative'): Readonly<{ kind: "absolute"; absoluteValue: number; }> | Readonly<{ kind: "relative"; relativeValue: number; }>; export function createIsoValueParam(defaultValue: Volume.IsoValue, stats?: Grid['stats']): PD.Conditioned | Readonly<{ kind: "relative"; relativeValue: number; }>, PD.Base | Readonly<{ kind: "relative"; relativeValue: number; }>>, { absolute: PD.Converted, number>; relative: PD.Converted, number>; }>; export const IsoValueParam: PD.Conditioned | Readonly<{ kind: "relative"; relativeValue: number; }>, PD.Base | Readonly<{ kind: "relative"; relativeValue: number; }>>, { absolute: PD.Converted, number>; relative: PD.Converted, number>; }>; export type IsoValueParam = typeof IsoValueParam; export const One: Volume; export function areEquivalent(volA: Volume, volB: Volume): boolean; export function areInstanceTransformsEqual(volA: Volume, volB: Volume): boolean; export function isEmpty(vol: Volume): boolean; export function isOrbitals(volume: Volume): boolean; export interface Loci { readonly kind: 'volume-loci'; readonly volume: Volume; readonly instances: OrderedSet; } export function Loci(volume: Volume, instances: OrderedSet): Loci; export function isLoci(x: any): x is Loci; export function areLociEqual(a: Loci, b: Loci): boolean; export function isLociEmpty(loci: Loci): boolean; export function getBoundingSphere(volume: Volume, boundingSphere?: Sphere3D): Sphere3D; export namespace Isosurface { interface Loci { readonly kind: 'isosurface-loci'; readonly volume: Volume; readonly isoValue: Volume.IsoValue; readonly instances: OrderedSet; } function Loci(volume: Volume, isoValue: Volume.IsoValue, instances: OrderedSet): 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; } export namespace Cell { interface Loci { readonly kind: 'cell-loci'; readonly volume: Volume; readonly elements: ReadonlyArray<{ readonly indices: OrderedSet; readonly instances: OrderedSet; }>; } function Loci(volume: Volume, elements: Loci['elements']): Loci; function isLoci(x: any): x is Loci; function areLociEqual(a: Loci, b: Loci): boolean; function isLociEmpty(loci: Loci): boolean; function getLociSize(loci: Loci): number; interface Location { readonly kind: 'cell-location'; volume: Volume; cell: CellIndex; instance: InstanceIndex; } function Location(volume?: Volume, cell?: CellIndex, instance?: InstanceIndex): Location; function isLocation(x: any): x is Location; function getBoundingSphere(volume: Volume, elements: Loci['elements'], boundingSphere?: Sphere3D): Sphere3D; } export namespace Segment { interface Loci { readonly kind: 'segment-loci'; readonly volume: Volume; readonly elements: ReadonlyArray<{ readonly segments: OrderedSet; readonly instances: OrderedSet; }>; } function Loci(volume: Volume, elements: Loci['elements']): Loci; function isLoci(x: any): x is Loci; function areLociEqual(a: Loci, b: Loci): boolean; function isLociEmpty(loci: Loci): boolean; function getLociSize(loci: Loci): number; function getBoundingSphere(volume: Volume, elements: Loci['elements'], boundingSphere?: Sphere3D): Sphere3D; interface Location { readonly kind: 'segment-location'; volume: Volume; segment: SegmentIndex; instance: InstanceIndex; } function Location(volume?: Volume, segment?: number, instance?: InstanceIndex): Location; function isLocation(x: any): x is Location; } export type PickingGranularity = 'volume' | 'object' | 'voxel'; export const PickingGranularity: { set(volume: Volume, granularity: PickingGranularity): void; get(volume: Volume): PickingGranularity; }; export type Segmentation = { segments: Map>; sets: Map>; bounds: { [k: Volume.SegmentIndex]: Box3D; }; labels: { [k: Volume.SegmentIndex]: string; }; }; export const Segmentation: { set(volume: Volume, segmentation: Segmentation): void; get(volume: Volume): Segmentation | undefined; }; type PeriodicRange = { min: Vec3; max: Vec3; }; export function getPeriodicRange(volume: Volume): PeriodicRange | undefined; export type PeriodicMapping = { get(x: number, y: number, z: number): { instance: InstanceIndex; cell: CellIndex; } | undefined; }; export function getPeriodicMapping(volume: Volume): PeriodicMapping | undefined; export function isPeriodic(volume: Volume): boolean; export {}; }