@niivue/nv-web-component 1.0.0-rc.2 → 1.0.0-rc.5
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.
- package/dist/layouts.d.ts +20 -0
- package/dist/niivue-web-component.d.ts +107 -0
- package/dist/nv-web-component.js +1363 -0
- package/dist/nvscene-controller.d.ts +140 -0
- package/dist/types.d.ts +19 -0
- package/package.json +3 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CanvasPosition {
|
|
2
|
+
top: string;
|
|
3
|
+
left: string;
|
|
4
|
+
width: string;
|
|
5
|
+
height: string;
|
|
6
|
+
}
|
|
7
|
+
export type LayoutFunction = (containerElement: HTMLElement, index: number, total: number) => CanvasPosition;
|
|
8
|
+
export interface LayoutConfig {
|
|
9
|
+
slots: number;
|
|
10
|
+
label: string;
|
|
11
|
+
layoutFunction: LayoutFunction;
|
|
12
|
+
}
|
|
13
|
+
export declare const layout1x1: LayoutFunction;
|
|
14
|
+
export declare const layout2x2: LayoutFunction;
|
|
15
|
+
export declare const layout1x2: LayoutFunction;
|
|
16
|
+
export declare const layout2x1: LayoutFunction;
|
|
17
|
+
export declare const layout1x3: LayoutFunction;
|
|
18
|
+
export declare const layout3x1: LayoutFunction;
|
|
19
|
+
export declare const layout3x3: LayoutFunction;
|
|
20
|
+
export declare const defaultLayouts: Record<string, LayoutConfig>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { NiiVueOptions, NVImage, default as NiiVueGPU, DRAG_MODE, SLICE_TYPE } from '@niivue/niivue';
|
|
2
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
+
import { defaultLayouts } from './layouts';
|
|
4
|
+
import { defaultSliceLayouts, defaultViewerOptions, NvSceneController, NvSceneControllerSnapshot, SliceLayoutTile } from './nvscene-controller';
|
|
5
|
+
import { ImageFromUrlOptions } from './types';
|
|
6
|
+
export declare const defaultElementName = "niivue-viewer";
|
|
7
|
+
export declare const defaultSceneElementName = "niivue-scene";
|
|
8
|
+
export type NiivueWebComponentOptions = {
|
|
9
|
+
elementName?: string;
|
|
10
|
+
sceneElementName?: string;
|
|
11
|
+
};
|
|
12
|
+
type VolumeVisualProps = {
|
|
13
|
+
colormap?: string;
|
|
14
|
+
calMin?: number;
|
|
15
|
+
calMax?: number;
|
|
16
|
+
opacity?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const volumeKey: (opts: ImageFromUrlOptions) => string;
|
|
19
|
+
export declare const volumeIdentity: (volume: Pick<NVImage, "url" | "name">) => string;
|
|
20
|
+
export declare const extractVisualProps: (opts: ImageFromUrlOptions) => VolumeVisualProps;
|
|
21
|
+
export declare const volumeVisualUpdates: (next: VolumeVisualProps, prev: VolumeVisualProps) => Partial<VolumeVisualProps>;
|
|
22
|
+
export declare const volumeIndexByKey: (volumes: Pick<NVImage, "url" | "name">[], key: string) => number;
|
|
23
|
+
export declare class NiivueViewerElement extends LitElement {
|
|
24
|
+
static properties: {
|
|
25
|
+
volumes: {
|
|
26
|
+
attribute: boolean;
|
|
27
|
+
};
|
|
28
|
+
options: {
|
|
29
|
+
attribute: boolean;
|
|
30
|
+
};
|
|
31
|
+
sliceType: {
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
attribute: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
static styles: import('lit').CSSResult;
|
|
37
|
+
volumes: ImageFromUrlOptions[];
|
|
38
|
+
options: Partial<NiiVueOptions>;
|
|
39
|
+
sliceType: 0;
|
|
40
|
+
private niivue;
|
|
41
|
+
private resizeObserver;
|
|
42
|
+
private loadedVolumes;
|
|
43
|
+
private attachmentReady;
|
|
44
|
+
private attachmentGeneration;
|
|
45
|
+
get nv(): NiiVueGPU | null;
|
|
46
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
47
|
+
firstUpdated(): void;
|
|
48
|
+
updated(changed: PropertyValues<this>): void;
|
|
49
|
+
disconnectedCallback(): void;
|
|
50
|
+
private emitError;
|
|
51
|
+
private ownsAttachment;
|
|
52
|
+
private getAttachedNiivue;
|
|
53
|
+
setColormap(volumeIndex: number, colormap: string): Promise<void>;
|
|
54
|
+
setOpacity(volumeIndex: number, opacity: number): Promise<void>;
|
|
55
|
+
setCalMinMax(volumeIndex: number, calMin: number, calMax: number): Promise<void>;
|
|
56
|
+
setColorbarVisible(visible: boolean): void;
|
|
57
|
+
setCrosshairVisible(visible: boolean): void;
|
|
58
|
+
setPrimaryDragMode(mode: number): void;
|
|
59
|
+
setSecondaryDragMode(mode: number): void;
|
|
60
|
+
private syncVolumes;
|
|
61
|
+
private reconcileVolumeOrder;
|
|
62
|
+
}
|
|
63
|
+
export declare class NiivueSceneElement extends LitElement {
|
|
64
|
+
static properties: {
|
|
65
|
+
layout: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
};
|
|
68
|
+
broadcasting: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
reflect: boolean;
|
|
71
|
+
};
|
|
72
|
+
snapshot: {
|
|
73
|
+
attribute: boolean;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
static styles: import('lit').CSSResult;
|
|
77
|
+
layout: string;
|
|
78
|
+
broadcasting: boolean;
|
|
79
|
+
snapshot: NvSceneControllerSnapshot;
|
|
80
|
+
readonly scene: NvSceneController;
|
|
81
|
+
private unsubscribe;
|
|
82
|
+
private resizeObserver;
|
|
83
|
+
constructor();
|
|
84
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
85
|
+
firstUpdated(): void;
|
|
86
|
+
updated(changed: PropertyValues<this>): void;
|
|
87
|
+
disconnectedCallback(): void;
|
|
88
|
+
addViewer(options?: Partial<NiiVueOptions>): Promise<import('./nvscene-controller').ViewerSlot>;
|
|
89
|
+
removeViewer(index: number): void;
|
|
90
|
+
canAddViewer(): boolean;
|
|
91
|
+
setViewerSliceLayout(index: number, layout: SliceLayoutTile[] | null): void;
|
|
92
|
+
loadVolume(index: number, opts: ImageFromUrlOptions): Promise<NVImage>;
|
|
93
|
+
loadVolumes(index: number, opts: ImageFromUrlOptions[]): Promise<NVImage[]>;
|
|
94
|
+
removeVolume(index: number, url: string): Promise<void>;
|
|
95
|
+
setColormap(viewerIndex: number, volumeIndex: number, colormap: string): Promise<void>;
|
|
96
|
+
setOpacity(viewerIndex: number, volumeIndex: number, opacity: number): Promise<void>;
|
|
97
|
+
setCalMinMax(viewerIndex: number, volumeIndex: number, calMin: number, calMax: number): Promise<void>;
|
|
98
|
+
setColorbarVisible(visible: boolean, viewerIndex?: number): void;
|
|
99
|
+
setCrosshairVisible(visible: boolean, viewerIndex?: number): void;
|
|
100
|
+
setPrimaryDragMode(mode: number, viewerIndex?: number): void;
|
|
101
|
+
setSecondaryDragMode(mode: number, viewerIndex?: number): void;
|
|
102
|
+
private forEachTargetViewer;
|
|
103
|
+
private forwardSceneEvents;
|
|
104
|
+
}
|
|
105
|
+
export declare function defineNiivueWebComponents(options?: NiivueWebComponentOptions): void;
|
|
106
|
+
export type { ImageFromUrlOptions, NiiVueOptions, NVImage };
|
|
107
|
+
export { DRAG_MODE, defaultLayouts, defaultSliceLayouts, defaultViewerOptions, NvSceneController, SLICE_TYPE, };
|