larvitar 1.5.14 → 2.0.2
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/.vscode/settings.json +4 -0
- package/README.md +78 -48
- package/bundler/webpack.common.js +27 -0
- package/bundler/webpack.dev.js +23 -0
- package/bundler/webpack.prod.js +19 -0
- package/decs.d.ts +12 -0
- package/dist/imaging/MetaDataReadable.d.ts +40 -0
- package/dist/imaging/MetaDataTypes.d.ts +3489 -0
- package/dist/imaging/imageAnonymization.d.ts +12 -0
- package/dist/imaging/imageColormaps.d.ts +47 -0
- package/dist/imaging/imageContours.d.ts +18 -0
- package/dist/imaging/imageIo.d.ts +42 -0
- package/dist/imaging/imageLayers.d.ts +56 -0
- package/dist/imaging/imageLoading.d.ts +65 -0
- package/dist/imaging/imageParsing.d.ts +46 -0
- package/dist/imaging/imagePresets.d.ts +43 -0
- package/dist/imaging/imageRendering.d.ts +238 -0
- package/dist/imaging/imageReslice.d.ts +14 -0
- package/dist/imaging/imageStore.d.ts +121 -0
- package/dist/imaging/imageTags.d.ts +22 -0
- package/dist/imaging/imageTools.d.ts +20 -0
- package/dist/imaging/imageUtils.d.ts +165 -0
- package/dist/imaging/loaders/commonLoader.d.ts +103 -0
- package/dist/imaging/loaders/dicomLoader.d.ts +29 -0
- package/dist/imaging/loaders/fileLoader.d.ts +33 -0
- package/dist/imaging/loaders/multiframeLoader.d.ts +37 -0
- package/dist/imaging/loaders/nrrdLoader.d.ts +113 -0
- package/dist/imaging/loaders/resliceLoader.d.ts +15 -0
- package/dist/imaging/monitors/memory.d.ts +41 -0
- package/dist/imaging/monitors/performance.d.ts +23 -0
- package/dist/imaging/parsers/ecg.d.ts +15 -0
- package/dist/imaging/parsers/nrrd.d.ts +3 -0
- package/dist/imaging/tools/custom/4dSliceScrollTool.d.ts +12 -0
- package/dist/imaging/tools/custom/BorderMagnifyTool.d.ts +18 -0
- package/dist/imaging/tools/custom/contourTool.d.ts +409 -0
- package/dist/imaging/tools/custom/diameterTool.d.ts +18 -0
- package/dist/imaging/tools/custom/editMaskTool.d.ts +22 -0
- package/dist/imaging/tools/custom/ellipticalRoiOverlayTool.d.ts +45 -0
- package/dist/imaging/tools/custom/polygonSegmentationMixin.d.ts +54 -0
- package/dist/imaging/tools/custom/polylineScissorsTool.d.ts +11 -0
- package/dist/imaging/tools/custom/rectangleRoiOverlayTool.d.ts +45 -0
- package/dist/imaging/tools/custom/seedTool.d.ts +0 -0
- package/dist/imaging/tools/custom/setLabelMap3D.d.ts +39 -0
- package/dist/imaging/tools/custom/thresholdsBrushTool.d.ts +19 -0
- package/dist/imaging/tools/default.d.ts +53 -0
- package/dist/imaging/tools/interaction.d.ts +30 -0
- package/dist/imaging/tools/io.d.ts +38 -0
- package/dist/imaging/tools/main.d.ts +81 -0
- package/dist/imaging/tools/segmentation.d.ts +125 -0
- package/dist/imaging/tools/state.d.ts +17 -0
- package/dist/imaging/tools/strategies/eraseFreehand.d.ts +16 -0
- package/dist/imaging/tools/strategies/fillFreehand.d.ts +16 -0
- package/dist/imaging/tools/strategies/index.d.ts +2 -0
- package/dist/imaging/waveforms/ecg.d.ts +39 -0
- package/dist/index.d.ts +35 -0
- package/dist/larvitar.js +90104 -0
- package/dist/larvitar.js.map +1 -0
- package/imaging/MetaDataReadable.ts +41 -0
- package/imaging/MetaDataTypes.ts +3491 -0
- package/imaging/dataDictionary.json +5328 -5328
- package/imaging/{imageAnonymization.js → imageAnonymization.ts} +41 -13
- package/imaging/{imageColormaps.js → imageColormaps.ts} +48 -30
- package/imaging/{imageContours.js → imageContours.ts} +24 -22
- package/imaging/{imageIo.js → imageIo.ts} +89 -52
- package/imaging/{imageLayers.js → imageLayers.ts} +31 -14
- package/imaging/{imageLoading.js → imageLoading.ts} +107 -43
- package/imaging/{imageParsing.js → imageParsing.ts} +160 -80
- package/imaging/{imagePresets.js → imagePresets.ts} +44 -11
- package/imaging/imageRendering.ts +1091 -0
- package/imaging/{imageReslice.js → imageReslice.ts} +18 -9
- package/imaging/imageStore.ts +487 -0
- package/imaging/imageTags.ts +609 -0
- package/imaging/imageTools.js +2 -1
- package/imaging/{imageUtils.js → imageUtils.ts} +211 -701
- package/imaging/loaders/{commonLoader.js → commonLoader.ts} +73 -24
- package/imaging/loaders/{dicomLoader.js → dicomLoader.ts} +25 -5
- package/imaging/loaders/{fileLoader.js → fileLoader.ts} +5 -5
- package/imaging/loaders/{multiframeLoader.js → multiframeLoader.ts} +145 -90
- package/imaging/loaders/{nrrdLoader.js → nrrdLoader.ts} +231 -64
- package/imaging/loaders/{resliceLoader.js → resliceLoader.ts} +51 -20
- package/imaging/monitors/{memory.js → memory.ts} +54 -8
- package/imaging/monitors/performance.ts +34 -0
- package/imaging/parsers/ecg.ts +54 -0
- package/imaging/tools/README.md +27 -0
- package/imaging/tools/custom/4dSliceScrollTool.js +47 -46
- package/imaging/tools/custom/BorderMagnifyTool.js +99 -0
- package/imaging/tools/custom/ellipticalRoiOverlayTool.js +534 -0
- package/imaging/tools/custom/polylineScissorsTool.js +1 -1
- package/imaging/tools/custom/rectangleRoiOverlayTool.js +564 -0
- package/imaging/tools/{setLabelMap3D.js → custom/setLabelMap3D.ts} +19 -25
- package/imaging/tools/{default.js → default.ts} +119 -33
- package/imaging/tools/{interaction.js → interaction.ts} +42 -23
- package/imaging/tools/{io.js → io.ts} +47 -31
- package/imaging/tools/{main.js → main.ts} +105 -40
- package/imaging/tools/{segmentation.js → segmentation.ts} +95 -68
- package/imaging/tools/{state.js → state.ts} +7 -12
- package/imaging/tools/types.d.ts +243 -0
- package/imaging/types.d.ts +200 -0
- package/imaging/waveforms/ecg.ts +191 -0
- package/{index.js → index.ts} +53 -14
- package/jsdoc.json +1 -1
- package/package.json +35 -14
- package/tsconfig.json +102 -0
- package/imaging/imageRendering.js +0 -860
- package/imaging/imageStore.js +0 -322
- package/modules/vuex/larvitar.js +0 -187
- /package/imaging/tools/{polygonSegmentationMixin.js → custom/polygonSegmentationMixin.js} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/** @module imaging/imageStore
|
|
2
|
+
* @desc This file provides functionalities
|
|
3
|
+
* for data config store.
|
|
4
|
+
*/
|
|
5
|
+
type StoreSeries = {
|
|
6
|
+
imageIds: string[];
|
|
7
|
+
progress: number;
|
|
8
|
+
};
|
|
9
|
+
type Store = {
|
|
10
|
+
colormapId: string;
|
|
11
|
+
errorLog: string;
|
|
12
|
+
leftActiveTool?: string;
|
|
13
|
+
rightActiveTool?: string;
|
|
14
|
+
series: {
|
|
15
|
+
[seriesUID: string]: StoreSeries;
|
|
16
|
+
};
|
|
17
|
+
viewports: {
|
|
18
|
+
[key: string]: typeof DEFAULT_VIEWPORT;
|
|
19
|
+
};
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
type SetPayload = ["errorLog" | "leftActiveTool" | "rightActiveTool", string] | [
|
|
23
|
+
"isColor" | "isMultiframe" | "isPDF" | "isTimeserie" | "ready",
|
|
24
|
+
string,
|
|
25
|
+
boolean
|
|
26
|
+
] | [
|
|
27
|
+
("progress" | "loading" | "minPixelValue" | "maxPixelValue" | "minSliceId" | "maxSliceId" | "minTimeId" | "maxTimeId" | "rotation" | "scale" | "sliceId" | "timeId" | "thickness"),
|
|
28
|
+
string,
|
|
29
|
+
number
|
|
30
|
+
] | ["timestamp", string, number | undefined] | ["pendingSliceId", string, number | undefined] | ["timestamps" | "timeIds", string, number[]] | [
|
|
31
|
+
"contrast" | "dimensions" | "spacing" | "translation",
|
|
32
|
+
string,
|
|
33
|
+
number,
|
|
34
|
+
number
|
|
35
|
+
] | [
|
|
36
|
+
"defaultViewport",
|
|
37
|
+
string,
|
|
38
|
+
number,
|
|
39
|
+
number,
|
|
40
|
+
number,
|
|
41
|
+
number,
|
|
42
|
+
number,
|
|
43
|
+
number,
|
|
44
|
+
boolean
|
|
45
|
+
];
|
|
46
|
+
export declare const DEFAULT_VIEWPORT: {
|
|
47
|
+
loading: number;
|
|
48
|
+
ready: boolean;
|
|
49
|
+
minSliceId: number;
|
|
50
|
+
maxSliceId: number;
|
|
51
|
+
sliceId: number;
|
|
52
|
+
pendingSliceId?: number;
|
|
53
|
+
minTimeId: number;
|
|
54
|
+
maxTimeId: number;
|
|
55
|
+
timeId: number;
|
|
56
|
+
timestamp: number;
|
|
57
|
+
timestamps: number[];
|
|
58
|
+
timeIds: number[];
|
|
59
|
+
rows: number;
|
|
60
|
+
cols: number;
|
|
61
|
+
spacing_x: number;
|
|
62
|
+
spacing_y: number;
|
|
63
|
+
thickness: number;
|
|
64
|
+
minPixelValue: number;
|
|
65
|
+
maxPixelValue: number;
|
|
66
|
+
isColor: boolean;
|
|
67
|
+
isMultiframe: boolean;
|
|
68
|
+
isTimeserie: boolean;
|
|
69
|
+
isPDF: boolean;
|
|
70
|
+
viewport: {
|
|
71
|
+
scale: number;
|
|
72
|
+
rotation: number;
|
|
73
|
+
translation: {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
};
|
|
77
|
+
voi: {
|
|
78
|
+
windowCenter: number;
|
|
79
|
+
windowWidth: number;
|
|
80
|
+
};
|
|
81
|
+
rows: number;
|
|
82
|
+
cols: number;
|
|
83
|
+
spacing_x: number;
|
|
84
|
+
spacing_y: number;
|
|
85
|
+
thickness: number;
|
|
86
|
+
};
|
|
87
|
+
default: {
|
|
88
|
+
scale: number;
|
|
89
|
+
rotation: number;
|
|
90
|
+
translation: {
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
};
|
|
94
|
+
voi: {
|
|
95
|
+
windowCenter: number;
|
|
96
|
+
windowWidth: number;
|
|
97
|
+
invert: boolean;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export type Viewport = typeof DEFAULT_VIEWPORT;
|
|
102
|
+
export declare const set: (payload: SetPayload) => void;
|
|
103
|
+
declare const _default: {
|
|
104
|
+
initialize: () => void;
|
|
105
|
+
addViewport: (name: string) => void;
|
|
106
|
+
deleteViewport: (name: string) => void;
|
|
107
|
+
addSeriesId: (seriesId: string, imageIds: string[]) => void;
|
|
108
|
+
removeSeriesId: (seriesId: string) => void;
|
|
109
|
+
resetSeriesIds: () => void;
|
|
110
|
+
setSliceId: (elementId: string, imageIndex: number) => void;
|
|
111
|
+
setPendingSliceId: (elementId: string, imageIndex: number) => void;
|
|
112
|
+
setMaxSliceId: (elementId: string, imageIndex: number) => void;
|
|
113
|
+
get: (props: string | string[]) => any;
|
|
114
|
+
addStoreListener: (listener: (data: Store) => {}) => (data: Store) => {};
|
|
115
|
+
removeStoreListener: () => undefined;
|
|
116
|
+
addViewportListener: (elementId: string, listener: (data: typeof DEFAULT_VIEWPORT) => {}) => void;
|
|
117
|
+
removeViewportListener: (elementId: string) => void;
|
|
118
|
+
addSeriesListener: (seriesId: string, listener: (data: StoreSeries) => {}) => void;
|
|
119
|
+
removeSeriesListener: (seriesId: string) => void;
|
|
120
|
+
};
|
|
121
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DataSet, Element } from "dicom-parser";
|
|
2
|
+
/**
|
|
3
|
+
* Parse a DICOM Tag according to its type
|
|
4
|
+
* @instance
|
|
5
|
+
* @function parseTag
|
|
6
|
+
* @param {Object} dataSet - The parsed dataset object from dicom parser
|
|
7
|
+
* @param {String} propertyName - The tag name
|
|
8
|
+
* @param {Object} element - The parsed dataset element
|
|
9
|
+
* @return {String} - The DICOM Tag value
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseTag<T>(dataSet: DataSet, propertyName: string, //x0000000 string
|
|
12
|
+
element: Element): Element | T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Extract tag value according to its value rapresentation, see
|
|
15
|
+
* {@link http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html}
|
|
16
|
+
* @instance
|
|
17
|
+
* @function getTagValue
|
|
18
|
+
* @param {Object} dataSet - the dataset
|
|
19
|
+
* @param {String} tag - the desired tag key
|
|
20
|
+
* @return {Number | Array | String} - the desired tag value
|
|
21
|
+
*/
|
|
22
|
+
export declare const getTagValue: (dataSet: DataSet, tag: string) => any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function addDefaultTools(toolToActivate: any): void;
|
|
2
|
+
export function addDiameterTool(elementId: string, diameters: any[], seriesId: string): void;
|
|
3
|
+
export function addContoursTool(rawContours: Object, maskName: string): void;
|
|
4
|
+
export function addMaskEditingTool(mask: any[], callback: Function, targetViewport: string): void;
|
|
5
|
+
export function setSegmentationConfig(config: Object): void;
|
|
6
|
+
export function getCurrentMaskData(viewportId: string): any[];
|
|
7
|
+
export function addStackStateToElement(seriesId: string, element: HTMLElement): void;
|
|
8
|
+
export function addSeedsTool(preLoadSeeds: any[], initViewport: string): void;
|
|
9
|
+
export function clearMeasurements(): void;
|
|
10
|
+
export function setToolActive(toolName: string, options: Object, activeViewport: string, viewports: any[]): void;
|
|
11
|
+
export function setToolDisabled(toolName: string, activeViewport: string, viewports: any[]): void;
|
|
12
|
+
export function setToolEnabled(toolName: string, activeViewport: string, viewports: any[]): void;
|
|
13
|
+
export function setToolPassive(toolName: string, activeViewport: string, viewports: any[]): void;
|
|
14
|
+
export function getToolState(toolName: string): Object;
|
|
15
|
+
export function clearToolStateByName(toolName: string, options: Object): void;
|
|
16
|
+
export function updateDiameterTool(diameterId: string | number, value: Object, seriesId: string, viewportId: string): void;
|
|
17
|
+
export function addToolStateSingleSlice(element: HTMLElement, toolName: string, data: Object | any[], slice: number, seriesId: string): void;
|
|
18
|
+
export function clearCornerstoneElements(): void;
|
|
19
|
+
export function syncToolStack(srcSliceNumber: number, toolName: string, viewport: string, seriesId: string): void;
|
|
20
|
+
export function updateStackToolState(elementId: string, imageIndex: number): void;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/** @module imaging/imageUtils
|
|
2
|
+
* @desc This file provides utility functions for
|
|
3
|
+
* manipulating image pixels and image metadata
|
|
4
|
+
*/
|
|
5
|
+
import type { CustomDataSet, MetaData, ReslicedInstance, Series } from "./types";
|
|
6
|
+
import { MetaDataTypes } from "./MetaDataTypes";
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} CornerstoneSeries
|
|
9
|
+
* @property {Array} imageIds Array of the instances imageIds
|
|
10
|
+
* @property {Array} instances Array of instances
|
|
11
|
+
* @property {Number} currentImageIndex Currently loaded image id index in the imageIds array
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Return computed 3D normal from two 3D vectors
|
|
15
|
+
* @instance
|
|
16
|
+
* @function getNormalOrientation
|
|
17
|
+
* @param {Array} el - The image_orientation dicom tag
|
|
18
|
+
*/
|
|
19
|
+
export declare const getNormalOrientation: (el: [number, number, number, number, number, number]) => number[];
|
|
20
|
+
/**
|
|
21
|
+
* If a value is provided, returns it, otherwise get the min pixel value from pixelData
|
|
22
|
+
* @instance
|
|
23
|
+
* @function getMinPixelValue
|
|
24
|
+
* @param {Number} value - The min value
|
|
25
|
+
* @param {Array} pixelData - Pixel data array
|
|
26
|
+
*/
|
|
27
|
+
export declare const getMinPixelValue: (value: number, pixelData: Uint16Array) => number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* If a value is provided, returns it, otherwise get the max pixel value from pixelData
|
|
30
|
+
* @instance
|
|
31
|
+
* @function getMaxPixelValue
|
|
32
|
+
* @param {Number} value - The max value
|
|
33
|
+
* @param {Array} pixelData - Pixel data array
|
|
34
|
+
*/
|
|
35
|
+
export declare const getMaxPixelValue: (value: string, pixelData: Uint16Array) => string | number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Create the pixel representation string (type and length) from dicom tags
|
|
38
|
+
* @instance
|
|
39
|
+
* @function getPixelRepresentation
|
|
40
|
+
* @param {Object} dataSet - The dataset
|
|
41
|
+
* @returns {String} The pixel representation in the form Sint / Uint + bytelength
|
|
42
|
+
*/
|
|
43
|
+
export declare const getPixelRepresentation: (dataSet: CustomDataSet) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Get a typed array from a representation type
|
|
46
|
+
* @instance
|
|
47
|
+
* @function getTypedArrayFromDataType
|
|
48
|
+
* @param {Object} dataType - The data type
|
|
49
|
+
* @returns {TypedArray} The typed array
|
|
50
|
+
*/
|
|
51
|
+
export declare const getTypedArrayFromDataType: (dataType: string) => Uint8ArrayConstructor | Int8ArrayConstructor | Uint16ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | null;
|
|
52
|
+
/**
|
|
53
|
+
* Sort the array of images ids of a series trying with:
|
|
54
|
+
* - content time order, if the series has cardiacNumberOfImages tag > 1
|
|
55
|
+
* - position order, if series has needed patient position tags
|
|
56
|
+
* - instance order, if series has instance numbers tags
|
|
57
|
+
* The priority of the method depends on the instanceSortPriority value
|
|
58
|
+
* @instance
|
|
59
|
+
* @function getSortedStack
|
|
60
|
+
* @param {Object} seriesData - The dataset
|
|
61
|
+
* @param {Array} sortPriorities - An array which represents the priority tasks
|
|
62
|
+
* @param {Bool} returnSuccessMethod - Boolean for returning the success method
|
|
63
|
+
* @return {Object} The sorted stack
|
|
64
|
+
*/
|
|
65
|
+
export declare const getSortedStack: (seriesData: Series, sortPriorities: Array<"imagePosition" | "contentTime" | "instanceNumber">, returnSuccessMethod: boolean) => string[];
|
|
66
|
+
/**
|
|
67
|
+
* Sort the array of instanceUIDs according to imageIds sorted using sortSeriesStack
|
|
68
|
+
* @instance
|
|
69
|
+
* @function getSortedUIDs
|
|
70
|
+
* @param {Object} seriesData - The dataset
|
|
71
|
+
* @return {Object} The sorted instanceUIDs
|
|
72
|
+
*/
|
|
73
|
+
export declare const getSortedUIDs: (seriesData: Series) => {
|
|
74
|
+
[key: string]: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Generate a randomUUID in the form 'uy0x2qz9jk9co642cjfus'
|
|
78
|
+
* @instance
|
|
79
|
+
* @function randomId
|
|
80
|
+
* @return {String} - Random uid
|
|
81
|
+
*/
|
|
82
|
+
export declare const randomId: () => string;
|
|
83
|
+
/**
|
|
84
|
+
* Get the mean value of a specified dicom tag in a serie
|
|
85
|
+
* @instance
|
|
86
|
+
* @function getMeanValue
|
|
87
|
+
* @param {Object} series - The cornerstone series object
|
|
88
|
+
* @param {Object} tag - The target tag key
|
|
89
|
+
* @param {Bool} isArray - True if tag value is an array
|
|
90
|
+
* @return {Number} - Tag mean value
|
|
91
|
+
*/
|
|
92
|
+
export declare const getMeanValue: (series: Series, tag: keyof MetaData, isArray: boolean) => number | number[];
|
|
93
|
+
/**
|
|
94
|
+
* Compute resliced metadata from a cornerstone data structure
|
|
95
|
+
* @instance
|
|
96
|
+
* @function getReslicedMetadata
|
|
97
|
+
* @param {String} reslicedSeriesId - The id of the resliced serie
|
|
98
|
+
* @param {String} fromOrientation - Source orientation (eg axial, coronal or sagittal)
|
|
99
|
+
* @param {String} toOrientation - Target orientation (eg axial, coronal or sagittal)
|
|
100
|
+
* @param {Object} seriesData - The original series data
|
|
101
|
+
* @param {String} imageLoaderName - The registered loader name
|
|
102
|
+
* @return {Object} - Cornerstone series object, filled only with metadata
|
|
103
|
+
*/
|
|
104
|
+
export declare const getReslicedMetadata: (reslicedSeriesId: string, fromOrientation: "axial" | "coronal" | "sagittal", toOrientation: "axial" | "coronal" | "sagittal", seriesData: Series, imageLoaderName: string) => {
|
|
105
|
+
imageIds: string[];
|
|
106
|
+
instances: {
|
|
107
|
+
[key: string]: ReslicedInstance;
|
|
108
|
+
};
|
|
109
|
+
currentImageIdIndex: number;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Compute cmpr metadata from pyCmpr data (generated using Scyther {@link https://github.com/dvisionlab/Scyther})
|
|
113
|
+
* @instance
|
|
114
|
+
* @function getCmprMetadata
|
|
115
|
+
* @param {String} reslicedSeriesId - The id of the resliced serie
|
|
116
|
+
* @param {String} imageLoaderName - The registered loader name
|
|
117
|
+
* @param {Object} header - The header of the resliced serie from Scyther
|
|
118
|
+
* @return {Object} - Cornerstone series object, filled only with metadata
|
|
119
|
+
*/
|
|
120
|
+
export declare const getCmprMetadata: (reslicedSeriesId: string, imageLoaderName: string, header: any) => {
|
|
121
|
+
imageIds: string[];
|
|
122
|
+
instances: {
|
|
123
|
+
[key: string]: ReslicedInstance;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Get pixel data for a single resliced slice, from cornerstone data structure
|
|
128
|
+
* @instance
|
|
129
|
+
* @function getReslicedPixeldata
|
|
130
|
+
* @param {String} imageId - The id of the resulting image
|
|
131
|
+
* @param {Object} originalData - The original series data (source)
|
|
132
|
+
* @param {Object} reslicedData - The resliced series data (target)
|
|
133
|
+
* @return {Object} - A single resliced slice pixel array
|
|
134
|
+
*/
|
|
135
|
+
export declare const getReslicedPixeldata: (imageId: string, originalData: Series, reslicedData: Series) => Uint16Array | Float64Array | Uint8Array | Int8Array | Int16Array | Int32Array | Uint32Array | Float32Array;
|
|
136
|
+
/**
|
|
137
|
+
* Get distance between two slices
|
|
138
|
+
* @instance
|
|
139
|
+
* @function getDistanceBetweenSlices
|
|
140
|
+
* @param {Object} seriesData - The series data
|
|
141
|
+
* @param {Number} sliceIndex1 - The first slice index
|
|
142
|
+
* @param {Number} sliceIndex2 - The second slice index
|
|
143
|
+
* @return {Number} - The distance value
|
|
144
|
+
*/
|
|
145
|
+
export declare const getDistanceBetweenSlices: (seriesData: Series, sliceIndex1: number, sliceIndex2: number) => number | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* @instance
|
|
148
|
+
* @function getImageMetadata
|
|
149
|
+
* @param {String} seriesId - The seriesUID
|
|
150
|
+
* @param {String} instanceUID - The SOPInstanceUID
|
|
151
|
+
* @return {Array} - List of metadata objects: tag, name and value
|
|
152
|
+
*/
|
|
153
|
+
export declare const getImageMetadata: (seriesId: string, instanceUID: string) => {
|
|
154
|
+
tag: string;
|
|
155
|
+
name: string;
|
|
156
|
+
value: string | number | number[] | MetaDataTypes[] | null | undefined;
|
|
157
|
+
}[];
|
|
158
|
+
/**
|
|
159
|
+
* Check if a div tag is a valid DOM HTMLElement
|
|
160
|
+
* @instance
|
|
161
|
+
* @function isElement
|
|
162
|
+
* @param {Object} o - The div tag
|
|
163
|
+
* @return {Boolean} - True if is an element otherwise returns False
|
|
164
|
+
*/
|
|
165
|
+
export declare const isElement: (o: any) => any;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** @module loaders/commonLoader
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* custom DICOMImageLoaders
|
|
4
|
+
*/
|
|
5
|
+
import { DataSet } from "dicom-parser";
|
|
6
|
+
import type { ImageObject, MetaData, Series } from "../types";
|
|
7
|
+
/**
|
|
8
|
+
* Update and initialize larvitar manager in order to parse and load a single dicom object
|
|
9
|
+
* @instance
|
|
10
|
+
* @function updateLarvitarManager
|
|
11
|
+
* @param {Object} imageObject The single dicom object
|
|
12
|
+
* @param {String} customId - Optional custom id to overwrite seriesUID as default one
|
|
13
|
+
* @param {number} sliceIndex - Optional custom index to overwrite slice index as default one
|
|
14
|
+
*/
|
|
15
|
+
export declare const updateLarvitarManager: (imageObject: ImageObject, customId?: string, sliceIndex?: number) => {
|
|
16
|
+
[key: string]: Series | import("./nrrdLoader").NrrdSeries;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* This function can be called in order to populate the Larvitar manager
|
|
20
|
+
* @instance
|
|
21
|
+
* @function populateLarvitarManager
|
|
22
|
+
* @param {String} seriesId The Id of the series
|
|
23
|
+
* @param {Object} seriesData The series data
|
|
24
|
+
* @returns {manager} the Larvitar manager
|
|
25
|
+
*/
|
|
26
|
+
export declare const populateLarvitarManager: (seriesId: string, seriesData: Series) => {
|
|
27
|
+
[key: string]: Series | import("./nrrdLoader").NrrdSeries;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Return the common data loader manager
|
|
31
|
+
* @instance
|
|
32
|
+
* @function getLarvitarManager
|
|
33
|
+
* @returns {Object} the loader manager
|
|
34
|
+
*/
|
|
35
|
+
export declare const getLarvitarManager: () => {
|
|
36
|
+
[key: string]: Series | import("./nrrdLoader").NrrdSeries;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Return the common image tracker
|
|
40
|
+
* @instance
|
|
41
|
+
* @function getLarvitarImageTracker
|
|
42
|
+
* @returns {Object} the image tracker
|
|
43
|
+
*/
|
|
44
|
+
export declare const getLarvitarImageTracker: () => {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Reset the Larvitar Manager store
|
|
49
|
+
* @instance
|
|
50
|
+
* @function resetLarvitarManager
|
|
51
|
+
*/
|
|
52
|
+
export declare const resetLarvitarManager: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Remove a stored seriesId from the larvitar Manager
|
|
55
|
+
* @instance
|
|
56
|
+
* @function removeSeriesFromLarvitarManager
|
|
57
|
+
* @param {String} seriesId The Id of the series
|
|
58
|
+
*/
|
|
59
|
+
export declare const removeSeriesFromLarvitarManager: (seriesId: string) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Return the data of a specific seriesId stored in the DICOM Manager
|
|
62
|
+
* @instance
|
|
63
|
+
* @function getSeriesDataFromLarvitarManager
|
|
64
|
+
* @param {String} seriesId The Id of the series
|
|
65
|
+
* @return {Object} larvitar manager data
|
|
66
|
+
*/
|
|
67
|
+
export declare const getSeriesDataFromLarvitarManager: (seriesId: string) => Series | import("./nrrdLoader").NrrdSeries | null;
|
|
68
|
+
/**
|
|
69
|
+
* Compute and return image frame
|
|
70
|
+
* @instance
|
|
71
|
+
* @function getImageFrame
|
|
72
|
+
* @param {Object} metadata metadata object
|
|
73
|
+
* @param {Object} dataSet dicom dataset
|
|
74
|
+
* @returns {Object} specific image frame
|
|
75
|
+
*/
|
|
76
|
+
export declare const getImageFrame: (metadata: MetaData, dataSet: DataSet) => {
|
|
77
|
+
samplesPerPixel: any;
|
|
78
|
+
photometricInterpretation: any;
|
|
79
|
+
planarConfiguration: any;
|
|
80
|
+
rows: any;
|
|
81
|
+
columns: any;
|
|
82
|
+
bitsAllocated: any;
|
|
83
|
+
pixelRepresentation: any;
|
|
84
|
+
smallestPixelValue: any;
|
|
85
|
+
largestPixelValue: any;
|
|
86
|
+
redPaletteColorLookupTableDescriptor: any;
|
|
87
|
+
greenPaletteColorLookupTableDescriptor: any;
|
|
88
|
+
bluePaletteColorLookupTableDescriptor: any;
|
|
89
|
+
redPaletteColorLookupTableData: any;
|
|
90
|
+
greenPaletteColorLookupTableData: any;
|
|
91
|
+
bluePaletteColorLookupTableData: any;
|
|
92
|
+
pixelData: undefined;
|
|
93
|
+
ImageData: undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Return the SOP Instance UID of a specific imageId stored in the Larvitar Manager
|
|
97
|
+
* @instance
|
|
98
|
+
* @function getSopInstanceUIDFromLarvitarManager
|
|
99
|
+
* @param {String} larvitarSeriesInstanceUID The Id of the series
|
|
100
|
+
* @param {String} imageId The Id of the image
|
|
101
|
+
* @returns {String} sopInstanceUID
|
|
102
|
+
*/
|
|
103
|
+
export declare const getSopInstanceUIDFromLarvitarManager: (larvitarSeriesInstanceUID: string, imageId: string) => string | null | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @module loaders/dicomLoader
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* custom DICOM Loader
|
|
4
|
+
*/
|
|
5
|
+
import type { Series } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* Load and cache a single image
|
|
8
|
+
* @instance
|
|
9
|
+
* @function cacheImage
|
|
10
|
+
* @param {Object} seriesData The series data
|
|
11
|
+
* @param {number} imageIndex The image index in the imageIds array
|
|
12
|
+
*/
|
|
13
|
+
export declare const cacheImage: (seriesData: Series, imageIndex: number) => Promise<true>;
|
|
14
|
+
/**
|
|
15
|
+
* Load and cache images
|
|
16
|
+
* @instance
|
|
17
|
+
* @function cacheImages
|
|
18
|
+
* @param {Object} seriesData The series data
|
|
19
|
+
* @param {Function} callback Optional callback function
|
|
20
|
+
*/
|
|
21
|
+
export declare const cacheImages: (seriesData: Series, callback?: Function) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the dicom imageId from dicom loader
|
|
24
|
+
* @instance
|
|
25
|
+
* @function getDicomImageId
|
|
26
|
+
* @param {String} dicomLoaderName dicom loader name
|
|
27
|
+
* @return {String} current dicom image id
|
|
28
|
+
*/
|
|
29
|
+
export declare const getDicomImageId: (dicomLoaderName: string) => string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @module loaders/fileLoader
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* custom File Loader
|
|
4
|
+
*/
|
|
5
|
+
export declare var fileManager: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Reset the Custom File Loader
|
|
10
|
+
* @instance
|
|
11
|
+
* @function resetFileLoader
|
|
12
|
+
*/
|
|
13
|
+
export declare const resetFileLoader: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Reset the File Manager store
|
|
16
|
+
* @instance
|
|
17
|
+
* @function resetFileManager
|
|
18
|
+
*/
|
|
19
|
+
export declare const resetFileManager: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Populate File Manager
|
|
22
|
+
* @instance
|
|
23
|
+
* @function populateFileManager
|
|
24
|
+
* @return {String} current file image id
|
|
25
|
+
*/
|
|
26
|
+
export declare const populateFileManager: (file: File) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the file imageId from file loader
|
|
29
|
+
* @instance
|
|
30
|
+
* @function getFileImageId
|
|
31
|
+
* @return {String} current file image id
|
|
32
|
+
*/
|
|
33
|
+
export declare const getFileImageId: (file: File) => string | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @module loaders/multiframeLoader
|
|
2
|
+
* @desc This file is a custom DICOM loader for multiframe images
|
|
3
|
+
*/
|
|
4
|
+
import type { Image, Series } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* Custom MultiFrame Loader Function
|
|
7
|
+
* @export
|
|
8
|
+
* @function loadMultiFrameImage
|
|
9
|
+
* @param {String} imageId - ImageId tag
|
|
10
|
+
* @returns {Function} Custom Image Creation Function
|
|
11
|
+
*/
|
|
12
|
+
export declare const loadMultiFrameImage: (imageId: string) => {
|
|
13
|
+
promise: Promise<Image>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Build the multiframe layout in the larvitar Manager
|
|
17
|
+
* @export
|
|
18
|
+
* @function buildMultiFrameImage
|
|
19
|
+
* @param {String} seriesId - SeriesId tag
|
|
20
|
+
* @param {Object} serie - parsed serie object
|
|
21
|
+
*/
|
|
22
|
+
export declare const buildMultiFrameImage: (seriesId: string, serie: Series) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Get the custom imageId from custom loader
|
|
25
|
+
* @instance
|
|
26
|
+
* @function getMultiFrameImageId
|
|
27
|
+
* @param {String} customLoaderName The custom loader name
|
|
28
|
+
* @return {String} the custom image id
|
|
29
|
+
*/
|
|
30
|
+
export declare const getMultiFrameImageId: (customLoaderName: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Clear the multiframe cache
|
|
33
|
+
* @instance
|
|
34
|
+
* @function clearMultiFrameCache
|
|
35
|
+
* @param {String} seriesId - SeriesId tag
|
|
36
|
+
*/
|
|
37
|
+
export declare const clearMultiFrameCache: (seriesId: string) => void;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/** @module loaders/nrrdLoader
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* custom NRRD Loader
|
|
4
|
+
*/
|
|
5
|
+
import { ImageLoader } from "cornerstone-core";
|
|
6
|
+
import type { Instance, Volume, MetaData } from "../types";
|
|
7
|
+
import { DataSet } from "dicom-parser";
|
|
8
|
+
type NrrdInputVolume = {
|
|
9
|
+
header: {
|
|
10
|
+
sizes: number[];
|
|
11
|
+
"space directions": number[][];
|
|
12
|
+
"space origin": [number, number];
|
|
13
|
+
kinds: string[];
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
data: Uint16Array;
|
|
17
|
+
};
|
|
18
|
+
export type NrrdSeries = {
|
|
19
|
+
currentImageIdIndex: number;
|
|
20
|
+
imageIds: string[];
|
|
21
|
+
instances: {
|
|
22
|
+
[key: string]: Instance;
|
|
23
|
+
};
|
|
24
|
+
instanceUIDs: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
numberOfImages: number;
|
|
28
|
+
seriesDescription: string;
|
|
29
|
+
seriesUID: string;
|
|
30
|
+
customLoader: string;
|
|
31
|
+
nrrdHeader: NrrdHeader;
|
|
32
|
+
bytes: number;
|
|
33
|
+
dataSet?: DataSet;
|
|
34
|
+
metadata?: MetaData;
|
|
35
|
+
ecgData?: number[];
|
|
36
|
+
};
|
|
37
|
+
type NrrdHeader = {
|
|
38
|
+
volume: Volume;
|
|
39
|
+
intercept: number;
|
|
40
|
+
slope: number;
|
|
41
|
+
repr: string;
|
|
42
|
+
phase: string;
|
|
43
|
+
study_description: string;
|
|
44
|
+
series_description: string;
|
|
45
|
+
acquisition_date: string;
|
|
46
|
+
[imageId: string]: string | number | Volume | NrrdInstance;
|
|
47
|
+
};
|
|
48
|
+
type NrrdInstance = {
|
|
49
|
+
instanceUID: string;
|
|
50
|
+
seriesDescription: string;
|
|
51
|
+
seriesModality: string;
|
|
52
|
+
patientName: string;
|
|
53
|
+
bitsAllocated: number;
|
|
54
|
+
pixelRepresentation: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Build the data structure for the provided image orientation
|
|
58
|
+
* @instance
|
|
59
|
+
* @function buildNrrdImage
|
|
60
|
+
* @param {Object} volume The volume object
|
|
61
|
+
* @param {String} seriesId The Id of the series
|
|
62
|
+
* @param {Object} custom_header A custom header object
|
|
63
|
+
* @return {Object} volume data
|
|
64
|
+
*/
|
|
65
|
+
export declare const buildNrrdImage: (volume: NrrdInputVolume, seriesId: string, custom_header: NrrdHeader) => Partial<NrrdSeries>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the custom imageId from custom loader
|
|
68
|
+
* @instance
|
|
69
|
+
* @function getNrrdImageId
|
|
70
|
+
* @param {String} customLoaderName The custom loader name
|
|
71
|
+
* @return {String} the custom image id
|
|
72
|
+
*/
|
|
73
|
+
export declare const getNrrdImageId: (customLoaderName: string) => string;
|
|
74
|
+
/**
|
|
75
|
+
* Custom cornerstone image loader for nrrd files
|
|
76
|
+
* @instance
|
|
77
|
+
* @function loadNrrdImage
|
|
78
|
+
* @param {String} imageId The image id
|
|
79
|
+
* @return {Object} custom image object
|
|
80
|
+
*/
|
|
81
|
+
export declare const loadNrrdImage: ImageLoader;
|
|
82
|
+
/**
|
|
83
|
+
* Retrieve imageId for a slice in the given orientation
|
|
84
|
+
* @instance
|
|
85
|
+
* @function getImageIdFromSlice
|
|
86
|
+
* @param {Integer} sliceNumber The image slice number
|
|
87
|
+
* @param {String} orientation The orientation tag
|
|
88
|
+
* @param {String} seriesId The series id
|
|
89
|
+
* @return {String} image id
|
|
90
|
+
*/
|
|
91
|
+
export declare const getImageIdFromSlice: (sliceNumber: number, orientation: string, seriesId: string) => string;
|
|
92
|
+
/**
|
|
93
|
+
* Retrieve slice number for a the given orientation
|
|
94
|
+
* @instance
|
|
95
|
+
* @function getSliceNumberFromImageId
|
|
96
|
+
* @param {String} imageId The image slice id
|
|
97
|
+
* @param {String} orientation The orientation tag
|
|
98
|
+
* @param {String} seriesId The series id
|
|
99
|
+
* @return {Integer} The image slice number
|
|
100
|
+
*/
|
|
101
|
+
export declare const getSliceNumberFromImageId: (imageId: string, orientation: string) => number;
|
|
102
|
+
/**
|
|
103
|
+
* Get series dimension for each view
|
|
104
|
+
* @instance
|
|
105
|
+
* @function getNrrdSerieDimensions
|
|
106
|
+
* @return {Object} Series dimension for each view
|
|
107
|
+
*/
|
|
108
|
+
export declare const getNrrdSerieDimensions: () => {
|
|
109
|
+
axial: number[];
|
|
110
|
+
coronal: number[];
|
|
111
|
+
sagittal: number[];
|
|
112
|
+
};
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @module loaders/resliceLoader
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* custom Reslice Loader
|
|
4
|
+
*/
|
|
5
|
+
import type { Image } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* Custom Loader for DICOMImageLoader
|
|
8
|
+
* @instance
|
|
9
|
+
* @function loadReslicedImage
|
|
10
|
+
* @param {String} imageId The Id of the image
|
|
11
|
+
* @returns {Object} custom image object
|
|
12
|
+
*/
|
|
13
|
+
export declare const loadReslicedImage: (imageId: string) => {
|
|
14
|
+
promise: Promise<Image>;
|
|
15
|
+
};
|