/** * Copyright (c) 2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * @author Tadej Satler */ import { BehaviorSubject } from 'rxjs'; import { PluginContext } from '../../mol-plugin/context.js'; import { Volume } from '../../mol-model/volume.js'; import { Structure } from '../../mol-model/structure.js'; import { Color } from '../../mol-util/color/index.js'; import { StateTransform } from '../../mol-state/index.js'; import type { MaskCreatorState, MaskSource, ViewMask } from '../../extensions/volume-tools/mask/types.js'; export declare const MASK_OVERLAY_COLOR: Color; export declare class VolumeMaskController { private plugin; readonly state: BehaviorSubject; private highlightedChains?; private thresholdPreviewTimer; private thresholdPreviewInFlight; private thresholdPreviewSession; private pendingThresholdPreview; /** Above-threshold voxel offsets, cached per (volume, threshold) for the selection preview. */ private candidates; private selectionPreviewTimer; private selectionPreviewInFlight; private selectionPreviewQueued; constructor(plugin: PluginContext); get current(): MaskCreatorState; private update; setTargetVolume(ref: StateTransform.Ref | undefined): void; setTargetStructure(ref: StateTransform.Ref | undefined): void; setSelectedChainIds(ids: string[]): void; toggleChainId(id: string): void; setDrawing(active: boolean): void; addViewMask(mask: ViewMask): void; removeViewMask(id: string): void; invertViewMask(id: string): void; setDilation(value: number): void; setSoftEdge(value: number): void; setMaskSource(value: MaskSource): void; setProteinRadius(value: number): void; setThreshold(value: Volume.IsoValue): void; /** Update threshold and schedule a coalesced live preview on the source isosurface. */ previewThreshold(value: Volume.IsoValue): void; /** Immediately preview the latest threshold value on the source isosurface. */ commitThresholdPreview(): void; private clearThresholdPreviewTimer; private clearPendingThresholdPreview; private flushThresholdPreview; private applyThresholdPreview; /** * Recomputes which voxels the current polygons select and recolors the source isosurface, * so the selection is visible before the mask is built. Coalesced: rapid edits (dragging * the threshold, adding polygons) collapse into one recompute. */ scheduleSelectionPreview(): void; private clearSelectionPreviewTimer; private runSelectionPreview; private applySelectionPreview; /** Switches the source isosurfaces to the selection theme, or back to a plain uniform color. */ private setSelectionTheme; setVolumeOpacity(value: number): Promise; toggleVolumeVisibility(): void; toggleStructureVisibility(): void; createMask(): Promise; clearMask(): Promise; invertMask(): Promise; applyMaskToVolume(): Promise; flipHandedness(): Promise; removeDust(minVoxels: number): Promise; private finalizeVolumeEdit; saveMask(): void; saveVolume(): void; dispose(): void; private clearSelectedChainHighlight; private syncSelectedChainHighlight; } export declare function getChainIds(structure: Structure): string[];