@lunit/insight-viewer
Advanced tools
Comparing version 6.2.1 to 7.0.0
@@ -36,21 +36,12 @@ export declare const IMAGE_LOADER_SCHEME: { | ||
}; | ||
export declare const DEFAULT_VIEWPORT_VIEWER_REF: { | ||
current: null; | ||
}; | ||
export declare const ERROR_MESSAGE: { | ||
readonly ENABLED_ELEMENT_NOT_READY: "enabledElement value is null, Please check the enabledElement value."; | ||
}; | ||
export declare const LINE_TEXT_POSITION_SPACING: { | ||
x: number; | ||
y: number; | ||
}; | ||
export declare const RULER_TEXT_POSITION_SPACING = 40; | ||
export declare const HALF_OF_RULER_TEXT_BOX = 4; | ||
export declare const CIRCLE_TEXT_POSITION_SPACING: { | ||
x: number; | ||
y: number; | ||
}; | ||
export declare const EDIT_CIRCLE_RADIUS = 3; | ||
export declare const CIRCLE_EDIT_POINT_ANGLE: { | ||
START_ANGLE: number; | ||
END_ANGLE: number; | ||
}; | ||
export declare const CIRCLE_TEXT_POINT_ANGLE = 135; | ||
export declare const TEXT_PADDING = 4; | ||
/** | ||
* The Annotation Overlay z index should keep the highest value. | ||
* When using z index, please use a value below that value. | ||
*/ | ||
export declare const ANNOTATION_OVERLAY_Z_INDEX = 10; |
/// <reference types="react" /> | ||
import { DRAG, PRIMARY_DRAG, SECONDARY_DRAG, PRIMARY_CLICK, SECONDARY_CLICK, MOUSEWHEEL } from './const'; | ||
import { DRAG, PRIMARY_DRAG, SECONDARY_DRAG, PRIMARY_CLICK, SECONDARY_CLICK, MOUSEWHEEL, MOUSE_WHEEL } from './const'; | ||
import { CornerstoneViewport, CornerstoneImage } from '../../utils/cornerstoneHelper'; | ||
import { Element, Viewport, OnViewportChange } from '../../types'; | ||
export declare type DragAction = keyof typeof DRAG; | ||
export declare type WheelAction = keyof typeof MOUSE_WHEEL; | ||
/** @deprecated in flavor of DragAction */ | ||
@@ -23,3 +24,8 @@ export declare type DragEvent = DragAction; | ||
export declare type DragEventHandler = (viewport: CornerstoneViewport, dragEvent: DragCoords) => Partial<Viewport>; | ||
export interface WheelCoords { | ||
deltaX: number; | ||
deltaY: number; | ||
} | ||
export declare type Wheel = (deltaX: number, deltaY: number) => void; | ||
export declare type WheelEventHandler = (viewport: CornerstoneViewport, wheelEvent: WheelCoords) => Partial<Viewport>; | ||
export interface DragInteraction { | ||
@@ -34,3 +40,3 @@ [PRIMARY_DRAG]: DragAction | Drag | undefined; | ||
export interface WheelInteraction { | ||
[MOUSEWHEEL]: Wheel | undefined; | ||
[MOUSEWHEEL]: WheelAction | Wheel | undefined; | ||
} | ||
@@ -37,0 +43,0 @@ export declare type Interaction = DragInteraction & ClickInteraction & WheelInteraction; |
@@ -1,2 +0,2 @@ | ||
import { ViewportInteraction } from '../types'; | ||
export default function useHandleWheel({ element, interaction }: ViewportInteraction): void; | ||
import type { ViewportInteraction } from '../types'; | ||
export default function useHandleWheel({ image, element, interaction, onViewportChange }: ViewportInteraction): void; |
@@ -0,21 +1,15 @@ | ||
export * from './const'; | ||
export { InsightViewer as default } from './Viewer'; | ||
export { AnnotationOverlay } from './Viewer/AnnotationOverlay'; | ||
export { AnnotationViewer } from './Viewer/AnnotationViewer'; | ||
export { AnnotationDrawer } from './Viewer/AnnotationDrawer'; | ||
export { MeasurementOverlay } from './Viewer/MeasurementOverlay'; | ||
export { MeasurementViewer } from './Viewer/MeasurementViewer'; | ||
export { MeasurementDrawer } from './Viewer/MeasurementDrawer'; | ||
export { HeatmapViewer } from './Viewer/HeatmapViewer'; | ||
export { useMultipleImages } from './hooks/useMultipleImages'; | ||
export { useViewport } from './hooks/useViewport'; | ||
export { useInteraction } from './hooks/useInteraction'; | ||
export { useAnnotation } from './hooks/useAnnotation'; | ||
export { useMeasurement } from './hooks/useMeasurement'; | ||
export { useDicomFile } from './hooks/useDicomFile'; | ||
export { useImage } from './hooks/useImage'; | ||
export { useFrame } from './hooks/useFrame'; | ||
export { useOverlayContext } from './contexts'; | ||
export * as cornerstoneHelper from './utils/cornerstoneHelper'; | ||
export type { Viewport, BasicViewport, ViewportOptions, ViewerError, Point, EditMode } from './types'; | ||
export type { Image } from './Viewer/types'; | ||
export type { Interaction, SetInteraction } from './hooks/useInteraction/types'; | ||
export type { Viewport, BasicViewport, ViewportOptions, ViewerError, Contours, Annotation, Point, LineHeadMode, AnnotationBase, PolygonAnnotation, LineAnnotation, FreeLineAnnotation, CircleAnnotation, TextAnnotation, AnnotationMode, AnnotationViewerProps, Measurement, MeasurementBase, MeasurementMode, RulerMeasurement, CircleMeasurement, } from './types'; | ||
export type { DragAction, DragEvent, Click, Drag, Wheel } from './hooks/useInteraction/types'; | ||
export { useDicomFile } from './hooks/useDicomFile'; | ||
export { useOverlayContext } from './contexts'; | ||
export type { OverlayContext } from './contexts'; |
{ | ||
"name": "@lunit/insight-viewer", | ||
"version": "6.2.1", | ||
"version": "7.0.0", | ||
"description": "cornerstone 라이브러리를 기반으로 Dicom Image를 다루기 위한 여러 Component들을 제공한다.", | ||
"peerDependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"module": "./index.js", | ||
"main": "./index.cjs", | ||
"type": "module", | ||
"types": "./index.d.ts", | ||
"dependencies": { | ||
"polylabel": "^1.1.0", | ||
"cornerstone-core": "^2.6.1", | ||
@@ -18,9 +11,15 @@ "dicom-parser": "^1.8.13", | ||
"react-resize-detector": "^6.7.0", | ||
"polylabel": "^1.1.0", | ||
"uid": "^2.0.0", | ||
"point-in-polygon": "^1.1.0", | ||
"cornerstone-wado-image-loader": "^4.1.3", | ||
"cornerstone-web-image-loader": "^2.1.1", | ||
"ky": "^0.30.0" | ||
} | ||
}, | ||
"peerDependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"module": "./index.js", | ||
"main": "./index.cjs", | ||
"type": "module", | ||
"types": "./index.d.ts" | ||
} |
# insight-viewer | ||
This library was generated with [Nx](https://nx.dev). | ||
Managing the core logic of the Insight viewer library.<br /> | ||
You can see how images are handled, how interactions are handled, how viewports are handled, and more. | ||
## Running unit tests | ||
Run `nx test insight-viewer` to execute the unit tests via [Jest](https://jestjs.io). | ||
> Please refer to the Root README for more information on how to use the library. |
@@ -1,2 +0,2 @@ | ||
import { Dispatch, SetStateAction, CSSProperties, SVGProps } from 'react'; | ||
import { Dispatch, SetStateAction } from 'react'; | ||
import { LOADING_STATE, LOADER_TYPE, IMAGE_LOADER_SCHEME } from '../const'; | ||
@@ -33,5 +33,9 @@ export declare type WithChildren<T = Record<string, unknown>> = T & { | ||
_viewportOptions: ViewportOptions; | ||
/** | ||
* Flag variable to check whether to use legacy useViewport | ||
* Will be deleted after 6.3.0 version | ||
*/ | ||
isLegacyViewport?: true; | ||
}; | ||
export declare type Point = [x: number, y: number]; | ||
export declare type Contours = Point[][]; | ||
export interface HTTP { | ||
@@ -60,86 +64,1 @@ onError: OnError; | ||
export declare type EditMode = 'startPoint' | 'endPoint' | 'move' | 'textMove'; | ||
export declare type ViewerStyleType = 'default' | 'select' | 'hover' | 'outline' | 'hoveredOutline' | 'selectedOutline' | 'highlight' | 'dashLine' | 'extendsArea' | 'selectedExtendsArea'; | ||
export declare type ViewerStyle = { | ||
[styleType in ViewerStyleType]?: CSSProperties; | ||
}; | ||
export declare type LineHeadMode = 'normal' | 'arrow'; | ||
export declare type AnnotationMode = 'line' | 'freeLine' | 'polygon' | 'circle' | 'text'; | ||
export interface AnnotationBase { | ||
/** Serves as id by contour */ | ||
id: number; | ||
type: AnnotationMode; | ||
/** If label is present, it will output instead of id */ | ||
label?: string; | ||
/** polygon label position = [x, y] */ | ||
labelPosition?: Point; | ||
/** | ||
* The data-attribute is added to the svg element | ||
* You can implement functions such as css styling based on the attributes | ||
*/ | ||
dataAttrs?: { | ||
[attr: string]: string; | ||
}; | ||
lineWidth?: number; | ||
} | ||
export interface LineAnnotation extends AnnotationBase { | ||
type: 'line'; | ||
points: [Point, Point]; | ||
hasArrowHead?: boolean; | ||
} | ||
export interface FreeLineAnnotation extends AnnotationBase { | ||
type: 'freeLine'; | ||
points: Point[]; | ||
} | ||
export interface PolygonAnnotation extends AnnotationBase { | ||
type: 'polygon'; | ||
points: Point[]; | ||
} | ||
export interface CircleAnnotation extends AnnotationBase { | ||
type: 'circle'; | ||
center: Point; | ||
radius: number; | ||
} | ||
export interface TextAnnotation extends AnnotationBase { | ||
type: 'text'; | ||
points: [Point, Point]; | ||
label: string; | ||
} | ||
export declare type Annotation = PolygonAnnotation | FreeLineAnnotation | LineAnnotation | CircleAnnotation | TextAnnotation; | ||
export interface AnnotationViewerProps<T extends AnnotationBase> { | ||
annotation: T; | ||
showOutline: boolean; | ||
showAnnotationLabel: boolean; | ||
hoveredAnnotation: Annotation | null; | ||
annotationAttrs?: (annotation: Annotation, showOutline: boolean) => SVGProps<SVGPolygonElement>; | ||
} | ||
export declare type MeasurementMode = 'ruler' | 'circle'; | ||
export interface MeasurementBase { | ||
id: number; | ||
type: MeasurementMode; | ||
lineWidth?: number; | ||
dataAttrs?: { | ||
[attr: string]: string; | ||
}; | ||
textPoint: Point | null; | ||
unit: 'px' | 'mm'; | ||
/** | ||
* This value is measured with a pixel space of the image and transformed into the physical unit(mm) | ||
* ruler: length, circle: radius | ||
*/ | ||
measuredValue: number; | ||
} | ||
export interface RulerMeasurement extends MeasurementBase { | ||
type: 'ruler'; | ||
startAndEndPoint: [startPoint: Point, endPoint: Point]; | ||
} | ||
export interface CircleMeasurement extends MeasurementBase { | ||
type: 'circle'; | ||
centerPoint: Point; | ||
radius: number; | ||
} | ||
export declare type Measurement = RulerMeasurement | CircleMeasurement; | ||
export interface MeasurementViewerProps<T extends MeasurementBase> { | ||
measurement: T; | ||
hoveredMeasurement: Measurement | null; | ||
} | ||
export declare type CursorStatus = 'drawing' | 'editing' | 'moving' | null; |
@@ -1,4 +0,1 @@ | ||
import { Viewport } from '../../types'; | ||
export declare const DefaultViewport: Viewport; | ||
export declare const ERROR_UNKNOWN = "error unknown"; | ||
export declare const IMAGER_PIXEL_SPACING = "x00181164"; |
export * from './utils'; | ||
export * from './formatViewport'; | ||
export type { CornerstoneImage, CornerstoneViewport } from './types'; | ||
export type { WadoImageLoaderOptions } from './setWadoImageLoader'; |
/// <reference types="react" /> | ||
import type { ViewerProp } from './types'; | ||
import type { WithChildren } from '../types'; | ||
export declare function InsightViewer({ image, Progress, viewport, interaction, onViewportChange, children, }: WithChildren<ViewerProp>): JSX.Element; | ||
export declare function InsightViewer({ image, Progress, viewport, interaction, onViewportChange, children, viewerRef, }: WithChildren<ViewerProp>): JSX.Element; |
@@ -6,2 +6,3 @@ import { DataSet } from 'dicom-parser'; | ||
import { Interaction } from '../hooks/useInteraction/types'; | ||
import type { MutableRefObject } from 'react'; | ||
export declare type Image = (CornerstoneImage & { | ||
@@ -22,2 +23,3 @@ _imageSeriesKey?: string; | ||
interaction?: Interaction; | ||
viewerRef?: MutableRefObject<HTMLDivElement | null>; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
731474
11
19314
156
7
6
- Removedpoint-in-polygon@^1.1.0
- Removedpoint-in-polygon@1.1.0(transitive)