med-viewer-sdk 0.1.1 → 0.1.3

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.
@@ -1,29 +1,36 @@
1
- import type { MedViewerEngine } from "./Engine";
1
+ import "openseadragon-filtering";
2
2
  export interface ColorAdjustments {
3
3
  brightness?: number;
4
4
  contrast?: number;
5
5
  saturation?: number;
6
6
  gamma?: number;
7
- sharpen?: number;
8
- edgeEnhance?: number;
9
- pseudoColor?: boolean;
10
7
  invert?: boolean;
8
+ hue?: number;
9
+ sepia?: boolean;
10
+ greyscale?: boolean;
11
11
  }
12
+ /**
13
+ * 2. 插件初始化选项接口
14
+ */
12
15
  export interface ColorAdjustOptions {
13
- initial?: ColorAdjustments;
16
+ adjustments?: ColorAdjustments;
17
+ debounceMs?: number;
18
+ loadMode?: 'async' | 'sync';
14
19
  }
15
20
  export declare class ColorAdjustPlugin {
16
- private engine;
17
- private adjustments;
18
- private options;
19
- constructor(engine: MedViewerEngine, options?: ColorAdjustOptions);
20
- setAdjustments(adjustments: ColorAdjustments): void;
21
- getAdjustments(): ColorAdjustments;
21
+ private viewer;
22
+ private _adjustments;
23
+ get adjustments(): ColorAdjustments;
24
+ private debounceTimer;
25
+ private debounceMs;
26
+ private loadMode;
27
+ constructor(engine: any, options?: ColorAdjustOptions);
22
28
  destroy(): void;
23
- private apply;
24
- private isWebGLRenderer;
25
- private forceWebGLRenderer;
26
- private applyWebGLFilters;
27
- private setupCustomShader;
28
- private createShader;
29
+ /**
30
+ * 核心算法:单次循环处理所有滤镜 (高性能模式)
31
+ */
32
+ private combinedProcessor;
33
+ apply(): void;
34
+ setAdjustments(adj: ColorAdjustments): void;
35
+ reset(): void;
29
36
  }
@@ -1,10 +1,10 @@
1
1
  import OpenSeadragon from "openseadragon";
2
- import { KonvaAnnotator } from "./KonvaAnnotator";
3
2
  import { AnnoAnnotator } from "./AnnoAnnotator";
4
3
  import { MedToolbar, type ToolbarOptions } from "./Toolbar";
5
4
  import { ColorAdjustPlugin, type ColorAdjustOptions } from "./ColorAdjustPlugin";
6
5
  import { SelectionPlugin, type SelectionOptions } from './SelectionPlugin';
7
6
  import { ScalebarPlugin, type ScalebarOptions } from './Scalebar';
7
+ import { MagnificationPlugin, type MagnificationOptions } from './Magnification';
8
8
  /**
9
9
  * 引擎配置接口
10
10
  */
@@ -14,12 +14,12 @@ export interface MedEngineOptions {
14
14
  navigatorBorderRadius?: number;
15
15
  prefixUrl?: string;
16
16
  plugins?: {
17
- konva?: boolean | any;
18
17
  annotorious?: boolean | any;
19
18
  toolbar?: boolean | ToolbarOptions;
20
19
  colorAdjust?: boolean | ColorAdjustOptions;
21
20
  selection?: boolean | SelectionOptions;
22
21
  scalebar?: boolean | ScalebarOptions;
22
+ magnification?: boolean | MagnificationOptions;
23
23
  };
24
24
  }
25
25
  /**
@@ -28,12 +28,12 @@ export interface MedEngineOptions {
28
28
  */
29
29
  export declare class MedViewerEngine {
30
30
  viewer: OpenSeadragon.Viewer;
31
- konva: KonvaAnnotator | null;
32
31
  anno: AnnoAnnotator | null;
33
32
  toolbar: MedToolbar | null;
34
33
  colorAdjust: ColorAdjustPlugin | null;
35
34
  selection: SelectionPlugin | null;
36
35
  scalebar: ScalebarPlugin | null;
36
+ magnification: MagnificationPlugin | null;
37
37
  private options;
38
38
  constructor(options: MedEngineOptions);
39
39
  /**
@@ -0,0 +1,25 @@
1
+ import OpenSeadragon from "openseadragon";
2
+ export type MagnificationType = "LD" | "OSD";
3
+ export type MagnificationPosition = "TOP_LEFT" | "TOP_CENTER" | "TOP_RIGHT" | "BOTTOM_LEFT" | "BOTTOM_CENTER" | "BOTTOM_RIGHT" | "MIDDLE_LEFT" | "MIDDLE_RIGHT";
4
+ export interface MagnificationOptions {
5
+ type?: MagnificationType;
6
+ position?: MagnificationPosition;
7
+ offsetX?: number;
8
+ offsetY?: number;
9
+ pixelsPerMeter?: number;
10
+ }
11
+ export declare class MagnificationPlugin {
12
+ private viewer;
13
+ private options;
14
+ private magnificationElement;
15
+ private magnificationDisplay;
16
+ constructor(viewer: OpenSeadragon.Viewer, options?: MagnificationOptions);
17
+ private init;
18
+ private createButton;
19
+ private updateMagnificationDisplay;
20
+ private setMagnification;
21
+ private fitToScreen;
22
+ refresh(): void;
23
+ destroy(): void;
24
+ private injectStyles;
25
+ }
@@ -1,6 +1,7 @@
1
1
  import { MedViewerEngine } from './core/Engine';
2
- import { KonvaAnnotator } from './core/KonvaAnnotator';
3
2
  import { AnnoAnnotator } from './core/AnnoAnnotator';
4
3
  import { MedToolbar } from './core/Toolbar';
5
4
  import { SelectionPlugin } from './core/SelectionPlugin';
6
- export { MedViewerEngine, KonvaAnnotator, AnnoAnnotator, MedToolbar, SelectionPlugin };
5
+ import { ColorAdjustPlugin } from './core/ColorAdjustPlugin';
6
+ import { MagnificationPlugin } from './core/Magnification';
7
+ export { MedViewerEngine, AnnoAnnotator, MedToolbar, SelectionPlugin, ColorAdjustPlugin, MagnificationPlugin };