larvitar 1.5.13 → 2.0.0

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.
Files changed (103) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/README.md +78 -48
  3. package/bundler/webpack.common.js +27 -0
  4. package/bundler/webpack.dev.js +23 -0
  5. package/bundler/webpack.prod.js +19 -0
  6. package/decs.d.ts +12 -0
  7. package/dist/imaging/MetaDataReadable.d.ts +39 -0
  8. package/dist/imaging/MetaDataTypes.d.ts +3488 -0
  9. package/dist/imaging/imageAnonymization.d.ts +12 -0
  10. package/dist/imaging/imageColormaps.d.ts +47 -0
  11. package/dist/imaging/imageContours.d.ts +18 -0
  12. package/dist/imaging/imageIo.d.ts +42 -0
  13. package/dist/imaging/imageLayers.d.ts +56 -0
  14. package/dist/imaging/imageLoading.d.ts +65 -0
  15. package/dist/imaging/imageParsing.d.ts +46 -0
  16. package/dist/imaging/imagePresets.d.ts +43 -0
  17. package/dist/imaging/imageRendering.d.ts +238 -0
  18. package/dist/imaging/imageReslice.d.ts +14 -0
  19. package/dist/imaging/imageStore.d.ts +121 -0
  20. package/dist/imaging/imageTags.d.ts +22 -0
  21. package/dist/imaging/imageTools.d.ts +20 -0
  22. package/dist/imaging/imageUtils.d.ts +165 -0
  23. package/dist/imaging/loaders/commonLoader.d.ts +103 -0
  24. package/dist/imaging/loaders/dicomLoader.d.ts +29 -0
  25. package/dist/imaging/loaders/fileLoader.d.ts +33 -0
  26. package/dist/imaging/loaders/multiframeLoader.d.ts +37 -0
  27. package/dist/imaging/loaders/nrrdLoader.d.ts +112 -0
  28. package/dist/imaging/loaders/resliceLoader.d.ts +15 -0
  29. package/dist/imaging/monitors/memory.d.ts +41 -0
  30. package/dist/imaging/monitors/performance.d.ts +23 -0
  31. package/dist/imaging/parsers/ecg.d.ts +15 -0
  32. package/dist/imaging/parsers/nrrd.d.ts +3 -0
  33. package/dist/imaging/tools/custom/4dSliceScrollTool.d.ts +12 -0
  34. package/dist/imaging/tools/custom/contourTool.d.ts +409 -0
  35. package/dist/imaging/tools/custom/diameterTool.d.ts +18 -0
  36. package/dist/imaging/tools/custom/editMaskTool.d.ts +22 -0
  37. package/dist/imaging/tools/custom/ellipticalRoiOverlayTool.d.ts +45 -0
  38. package/dist/imaging/tools/custom/polygonSegmentationMixin.d.ts +54 -0
  39. package/dist/imaging/tools/custom/polylineScissorsTool.d.ts +11 -0
  40. package/dist/imaging/tools/custom/rectangleRoiOverlayTool.d.ts +45 -0
  41. package/dist/imaging/tools/custom/seedTool.d.ts +0 -0
  42. package/dist/imaging/tools/custom/setLabelMap3D.d.ts +39 -0
  43. package/dist/imaging/tools/custom/thresholdsBrushTool.d.ts +19 -0
  44. package/dist/imaging/tools/default.d.ts +53 -0
  45. package/dist/imaging/tools/interaction.d.ts +30 -0
  46. package/dist/imaging/tools/io.d.ts +38 -0
  47. package/dist/imaging/tools/main.d.ts +81 -0
  48. package/dist/imaging/tools/segmentation.d.ts +125 -0
  49. package/dist/imaging/tools/state.d.ts +17 -0
  50. package/dist/imaging/tools/strategies/eraseFreehand.d.ts +16 -0
  51. package/dist/imaging/tools/strategies/fillFreehand.d.ts +16 -0
  52. package/dist/imaging/tools/strategies/index.d.ts +2 -0
  53. package/dist/index.d.ts +34 -0
  54. package/dist/larvitar.js +89801 -0
  55. package/dist/larvitar.js.map +1 -0
  56. package/imaging/MetaDataReadable.ts +40 -0
  57. package/imaging/MetaDataTypes.ts +3490 -0
  58. package/imaging/dataDictionary.json +5328 -5328
  59. package/imaging/{imageAnonymization.js → imageAnonymization.ts} +41 -13
  60. package/imaging/{imageColormaps.js → imageColormaps.ts} +48 -30
  61. package/imaging/{imageContours.js → imageContours.ts} +24 -22
  62. package/imaging/{imageIo.js → imageIo.ts} +89 -52
  63. package/imaging/{imageLayers.js → imageLayers.ts} +31 -14
  64. package/imaging/{imageLoading.js → imageLoading.ts} +108 -45
  65. package/imaging/{imageParsing.js → imageParsing.ts} +158 -80
  66. package/imaging/{imagePresets.js → imagePresets.ts} +44 -11
  67. package/imaging/imageRendering.ts +1091 -0
  68. package/imaging/{imageReslice.js → imageReslice.ts} +18 -9
  69. package/imaging/imageStore.ts +487 -0
  70. package/imaging/imageTags.ts +609 -0
  71. package/imaging/imageTools.js +2 -1
  72. package/imaging/{imageUtils.js → imageUtils.ts} +211 -701
  73. package/imaging/loaders/{commonLoader.js → commonLoader.ts} +73 -24
  74. package/imaging/loaders/{dicomLoader.js → dicomLoader.ts} +25 -5
  75. package/imaging/loaders/{fileLoader.js → fileLoader.ts} +5 -5
  76. package/imaging/loaders/{multiframeLoader.js → multiframeLoader.ts} +145 -90
  77. package/imaging/loaders/{nrrdLoader.js → nrrdLoader.ts} +230 -64
  78. package/imaging/loaders/{resliceLoader.js → resliceLoader.ts} +51 -20
  79. package/imaging/monitors/{memory.js → memory.ts} +54 -8
  80. package/imaging/monitors/performance.ts +34 -0
  81. package/imaging/parsers/ecg.ts +51 -0
  82. package/imaging/tools/README.md +27 -0
  83. package/imaging/tools/custom/4dSliceScrollTool.js +47 -46
  84. package/imaging/tools/custom/ellipticalRoiOverlayTool.js +534 -0
  85. package/imaging/tools/custom/polylineScissorsTool.js +1 -1
  86. package/imaging/tools/custom/rectangleRoiOverlayTool.js +564 -0
  87. package/imaging/tools/{setLabelMap3D.js → custom/setLabelMap3D.ts} +19 -25
  88. package/imaging/tools/{default.js → default.ts} +114 -30
  89. package/imaging/tools/{interaction.js → interaction.ts} +42 -23
  90. package/imaging/tools/{io.js → io.ts} +47 -31
  91. package/imaging/tools/{main.js → main.ts} +105 -40
  92. package/imaging/tools/{segmentation.js → segmentation.ts} +95 -68
  93. package/imaging/tools/{state.js → state.ts} +7 -12
  94. package/imaging/tools/types.d.ts +243 -0
  95. package/imaging/types.d.ts +197 -0
  96. package/{index.js → index.ts} +43 -14
  97. package/jsdoc.json +1 -1
  98. package/package.json +32 -14
  99. package/tsconfig.json +102 -0
  100. package/imaging/imageRendering.js +0 -860
  101. package/imaging/imageStore.js +0 -322
  102. package/modules/vuex/larvitar.js +0 -187
  103. /package/imaging/tools/{polygonSegmentationMixin.js → custom/polygonSegmentationMixin.js} +0 -0
@@ -0,0 +1,12 @@
1
+ /** @module imaging/imageAnonymization
2
+ * @desc This file provides anonymization functionalities on DICOM images
3
+ * following http://dicom.nema.org/medical/dicom/current/output/html/part15.html#chapter_E
4
+ */
5
+ import { Series } from "./types";
6
+ /**
7
+ * Anonymize DICOM series' metadata using sha256
8
+ * @function anonymize
9
+ * @param {Object} series - Cornerstone series object
10
+ * @returns {Object} anonymized_series: Cornerstone anonymized series object
11
+ */
12
+ export declare const anonymize: (series: Series) => Series;
@@ -0,0 +1,47 @@
1
+ /** @module imaging/imageColormaps
2
+ * @desc This file provides functionalities for
3
+ * handling colormaps
4
+ */
5
+ /**
6
+ * Fill a canvas with pixelData representing the colormap
7
+ * @instance
8
+ * @function getColormapsList
9
+ * @returns {Array} A list of cornerstone colormaps
10
+ */
11
+ export declare function getColormapsList(): {
12
+ id: any;
13
+ key: any;
14
+ }[];
15
+ /**
16
+ * Add a custom color map to cornerstone list
17
+ * @instance
18
+ * @function addColorMap
19
+ * @param {String} colormapId - the new colormap id
20
+ * @param {String} colormapName - the new colormap name
21
+ * @param {Array} colors - array containing 255 rgb colors (ie [[r,g,b], [r,g,b], ...])
22
+ */
23
+ export declare function addColorMap(colormapId: string, colormapName: string, colors: Array<Array<number>>): any;
24
+ /**
25
+ * Fill a canvas with pixelData representing the colormap
26
+ * @instance
27
+ * @function fillPixelData
28
+ * @param {HTMLCanvasElement} canvas - target canvas
29
+ * @param {String} colormapId - the colormap name
30
+ */
31
+ export declare function fillPixelData(canvas: HTMLCanvasElement, colormapId: string): void;
32
+ /**
33
+ * Apply a color map on a viewport
34
+ * @instance
35
+ * @function applyColorMap
36
+ * @param {String} colormapId - the colormap name
37
+ * @param {Array} viewportNames - List of viewports where to apply preset
38
+ */
39
+ export declare function applyColorMap(colormapId: string, viewportNames?: Array<string>): any;
40
+ /**
41
+ * Converts an HSV (Hue, Saturation, Value) color to RGB (Red, Green, Blue) color value
42
+ * @param {Number} hue A number representing the hue color value
43
+ * @param {Number} sat A number representing the saturation color value
44
+ * @param {Number} val A number representing the value color value
45
+ * @returns {Number[]} An RGB color array
46
+ */
47
+ export declare function HSVToRGB(hue: number, sat: number, val: number): number[];
@@ -0,0 +1,18 @@
1
+ /** @module imaging/imageContours
2
+ * @desc This file provides functionalities to render a set of points on a canvas.
3
+ * Use this in order to render image contours (e.g. from binary masks).
4
+ */
5
+ import { Contours } from "./types";
6
+ /**
7
+ * Parse raw data to contours object for each viewport
8
+ * @export
9
+ * @function parseContours
10
+ * @param {Array} contoursData - Raw data
11
+ * @param {Number} pointBatchSize - Number of points that defines a contour segment (default to 2)
12
+ * @param {String} segmentationName - Mask object name
13
+ * @param {Array} viewports - Viewport array ids
14
+ * @returns {Number} Number of array elements consumed
15
+ */
16
+ export declare const parseContours: (contoursData: {
17
+ [key: string]: Uint8Array;
18
+ }, pointBatchSize: number, segmentationName: string, viewports: Array<string>) => Contours;
@@ -0,0 +1,42 @@
1
+ /** @module imaging/imageIo
2
+ * @desc This file provides I/O functionalities on NRRD files and DICOM images
3
+ */
4
+ import { Series, Header, TypedArray } from "./types";
5
+ /**
6
+ * Build the image header from slices' metadata
7
+ * @function buildHeader
8
+ * @param {Object} series - Cornerstone series object
9
+ * @returns {Object} header: image metadata
10
+ */
11
+ export declare const buildHeader: (series: Series) => Header;
12
+ /**
13
+ * Get cached pixel data
14
+ * @function getCachedPixelData
15
+ * @param {String} imageId - ImageId of the cached image
16
+ * @returns {Promise} A promise which will resolve to a pixel data array or fail if an error occurs
17
+ */
18
+ export declare const getCachedPixelData: (imageId: string) => Promise<number[]>;
19
+ /**
20
+ * Build the contiguous typed array from slices
21
+ * @function buildData
22
+ * @param {Object} series - Cornerstone series object
23
+ * @param {Bool} useSeriesData - Flag to force using "series" data instead of cached ones
24
+ * @returns {Array} Contiguous pixel array
25
+ */
26
+ export declare const buildData: (series: Series, useSeriesData: boolean) => Uint16Array | Float64Array | Uint8Array | Int8Array | Int16Array | Int32Array | Uint32Array | Float32Array | undefined;
27
+ /**
28
+ * Build the contiguous typed array from slices (async version)
29
+ * @function buildDataAsync
30
+ * @param {Object} series - Cornerstone series object
31
+ * @param {Number} time - Time(s) to wait for garbage collector
32
+ * @param {Function} resolve - Promise resolve function
33
+ * @param {Function} reject - Promise reject function
34
+ */
35
+ export declare const buildDataAsync: (series: Series, time: number, resolve: (response: TypedArray) => void, reject: (response: string) => void) => void;
36
+ /**
37
+ * Import NRRD image from bufferArray
38
+ * @function importNRRDImage
39
+ * @param {ArrayBuffer} bufferArray - buffer array from nrrd file
40
+ * @returns {Array} Parsed pixel data array
41
+ */
42
+ export declare const importNRRDImage: (bufferArray: ArrayBuffer) => Object;
@@ -0,0 +1,56 @@
1
+ /** @module imaging/imageLayers
2
+ * @desc This file provides functionalities for
3
+ * rendering image layers using cornerstone stack
4
+ */
5
+ import { Series } from "./types";
6
+ /**
7
+ * Build the image layers object
8
+ * @function buildLayers
9
+ * @param {Object} series - Cornerstone series object
10
+ * @param {String} tag - Tag for the layer
11
+ * @param {Object} options - layer options {opacity:float, colormap: str}
12
+ * @returns {Object} Cornerstone layer object
13
+ */
14
+ export declare const buildLayer: (series: Series, tag: string, options: {
15
+ opacity: number;
16
+ colormap: string;
17
+ }) => {
18
+ imageIds: string[];
19
+ currentImageIdIndex: number;
20
+ options: {
21
+ name: string;
22
+ opacity: number;
23
+ visible: boolean;
24
+ viewport: {
25
+ colormap: string;
26
+ };
27
+ };
28
+ };
29
+ /**
30
+ * Change the options of a layer
31
+ * @instance
32
+ * @function updateLayer
33
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
34
+ * @param {string} layer - The layer id
35
+ * @param {Object} options - The new layer's options
36
+ */
37
+ export declare const updateLayer: (elementId: string | HTMLElement, layerId: string, options: {
38
+ opacity: number;
39
+ colormap: string;
40
+ }) => void;
41
+ /**
42
+ * Get the active layer
43
+ * @instance
44
+ * @function getActiveLayer
45
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
46
+ * @returns {Object} layer - The active layer object
47
+ */
48
+ export declare const getActiveLayer: (elementId: string | HTMLElement) => import("cornerstone-core").EnabledElementLayer | undefined;
49
+ /**
50
+ * Set the active layer
51
+ * @instance
52
+ * @function setActiveLayer
53
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
54
+ * @param {String} layerId - The id of the layer
55
+ */
56
+ export declare const setActiveLayer: (elementId: string | HTMLElement, layerId: string) => void;
@@ -0,0 +1,65 @@
1
+ /** @module imaging/imageLoading
2
+ * @desc This file provides functionalities for
3
+ * initialize, configure and update DICOMImageLoader
4
+ */
5
+ import { ImageObject } from "./types";
6
+ import { getLarvitarManager } from "./loaders/commonLoader";
7
+ declare const globalConfig: {
8
+ maxWebWorkers: number;
9
+ startWebWorkersOnDemand: boolean;
10
+ taskConfiguration: {
11
+ decodeTask: {
12
+ loadCodecsOnStartup: boolean;
13
+ initializeCodecsOnStartup: boolean;
14
+ strict: boolean;
15
+ };
16
+ };
17
+ };
18
+ /**
19
+ * Configure DICOMImageLoader
20
+ * @instance
21
+ * @function initializeImageLoader
22
+ * @param {Object} config - Custom config @default globalConfig
23
+ */
24
+ export declare const initializeImageLoader: (config?: typeof globalConfig) => void;
25
+ /**
26
+ * Configure cornerstoneWebImageLoader
27
+ * @instance
28
+ * @function initializeWebImageLoader
29
+ */
30
+ export declare const initializeWebImageLoader: () => void;
31
+ /**
32
+ * Configure cornerstoneFileImageLoader
33
+ * @instance
34
+ * @function initializeFileImageLoader
35
+ */
36
+ export declare const initializeFileImageLoader: () => void;
37
+ /**
38
+ * Register custom NRRD ImageLoader
39
+ * @instance
40
+ * @function registerNRRDImageLoader
41
+ */
42
+ export declare const registerNRRDImageLoader: () => void;
43
+ /**
44
+ * Register custom Reslice ImageLoader
45
+ * @instance
46
+ * @function registerResliceLoader
47
+ */
48
+ export declare const registerResliceLoader: () => void;
49
+ /**
50
+ * Register custom MultiFrame ImageLoader
51
+ * @instance
52
+ * @function registerMultiFrameImageLoader
53
+ */
54
+ export declare const registerMultiFrameImageLoader: () => void;
55
+ /**
56
+ * Update the allSeriesStack object using DICOMImageLoader fileManager
57
+ * @instance
58
+ * @function updateLoadedStack
59
+ * @param {Object} seriesData - Cornerstone series object
60
+ * @param {Object} allSeriesStack - Dict containing all series objects
61
+ * @param {String} customId - Optional custom id to overwrite seriesUID as default one
62
+ * @param {number} sliceIndex - Optional custom index to overwrite slice index as default one
63
+ */
64
+ export declare const updateLoadedStack: (seriesData: ImageObject, allSeriesStack: ReturnType<typeof getLarvitarManager>, customId?: string, sliceIndex?: number) => void;
65
+ export {};
@@ -0,0 +1,46 @@
1
+ /** @module imaging/imageParsing
2
+ * @desc This file provides functionalities for parsing DICOM image files
3
+ */
4
+ import { DataSet } from "dicom-parser";
5
+ import { ImageObject } from "./types";
6
+ import { getLarvitarManager } from "./loaders/commonLoader";
7
+ import type { MetaDataTypes } from "./MetaDataTypes";
8
+ /**
9
+ * Reset series stack object and its internal data
10
+ * @instance
11
+ * @function clearImageParsing
12
+ * @param {Object} seriesStack - Parsed series stack object
13
+ */
14
+ export declare const clearImageParsing: (seriesStack: ReturnType<typeof getLarvitarManager> | null) => void;
15
+ /**
16
+ * Read dicom files and return allSeriesStack object
17
+ * @instance
18
+ * @function readFiles
19
+ * @param {Array} entries - List of file objects
20
+ * @returns {Promise} - Return a promise which will resolve to a image object list or fail if an error occurs
21
+ */
22
+ export declare const readFiles: (entries: File[]) => Promise<unknown>;
23
+ /**
24
+ * Read a single dicom file and return parsed object
25
+ * @instance
26
+ * @function readFile
27
+ * @param {File} entry - File object
28
+ * @returns {Promise} - Return a promise which will resolve to a image object or fail if an error occurs
29
+ */
30
+ export declare const readFile: (entry: File) => Promise<ImageObject>;
31
+ type ExtendedMetaDataTypes = MetaDataTypes & {
32
+ [key: string]: unknown;
33
+ };
34
+ /**
35
+ * Parse metadata from dicom parser dataSet object
36
+ * @instance
37
+ * @function parseDataSet
38
+ * @param {Object} dataSet - dicom parser dataSet object
39
+ * @param {Object} metadata - Initialized metadata object
40
+ * @param {Array} customFilter - Optional filter: {tags:[], frameId: 0}
41
+ */
42
+ export declare const parseDataSet: (dataSet: DataSet, metadata: ExtendedMetaDataTypes, customFilter?: {
43
+ tags: string[];
44
+ frameId: number;
45
+ }) => void;
46
+ export {};
@@ -0,0 +1,43 @@
1
+ /** @module imaging/imagePresets
2
+ * @desc This file provides functionalities for
3
+ * image presets for ww and wc
4
+ */
5
+ /**
6
+ * Object used to list image presets
7
+ * @object
8
+ */
9
+ declare const IMAGE_PRESETS: {
10
+ name: string;
11
+ ww: number;
12
+ wl: number;
13
+ }[];
14
+ /**
15
+ * Get Image presets object
16
+ * @instance
17
+ * @function getImagePresets
18
+ */
19
+ export declare const getImagePresets: () => {
20
+ name: string;
21
+ ww: number;
22
+ wl: number;
23
+ }[];
24
+ /**
25
+ * Set Image presets
26
+ * @instance
27
+ * @function setImagePreset
28
+ * @param {Array} viewportNames - List of viewports where to apply preset
29
+ * @param {String} preset - The image preset name or the preset object
30
+ */
31
+ export declare const setImagePreset: (viewportNames: string[], preset: string | (typeof IMAGE_PRESETS)[0]) => void;
32
+ /**
33
+ * Set Image presets
34
+ * @instance
35
+ * @function setImageCustomPreset
36
+ * @param {Array} viewportNames - List of viewports where to apply preset
37
+ * @param {Object} customValues - {wl: value, ww: value}
38
+ */
39
+ export declare const setImageCustomPreset: (viewportNames: string[], customValues: {
40
+ wl: number;
41
+ ww: number;
42
+ }) => void;
43
+ export {};
@@ -0,0 +1,238 @@
1
+ /** @module imaging/imageRendering
2
+ * @desc This file provides functionalities for
3
+ * rendering images in html canvas using cornerstone
4
+ */
5
+ import cornerstone from "cornerstone-core";
6
+ import { Image, Series, StoreViewportOptions, Viewport } from "./types";
7
+ /**
8
+ * Purge the cornestone internal cache
9
+ * If seriesId is passed as argument only imageIds of the series are purged from internal cache
10
+ * @instance
11
+ * @function clearImageCache
12
+ * @param {String} seriesId - The id of the serie
13
+ */
14
+ export declare const clearImageCache: (seriesId?: string) => void;
15
+ /**
16
+ * Load and cache a single image
17
+ * Add series's imageIds into store
18
+ * @instance
19
+ * @function loadAndCacheImage
20
+ * @param {Object} series the parsed series data
21
+ * @param {number} imageIndex the image index in the imageIds array
22
+ */
23
+ export declare function loadAndCacheImage(series: Series, imageIndex: number): Promise<true>;
24
+ /**
25
+ * Load and cache all serie's images
26
+ * Add series's imageIds into store
27
+ * @instance
28
+ * @function loadAndCacheImages
29
+ * @param {Object} series the parsed series data
30
+ * @param {Function} callback a callback function
31
+ */
32
+ export declare function loadAndCacheImages(series: Series, callback: (payload: {
33
+ seriesId: string;
34
+ loading: number;
35
+ series: Series;
36
+ }) => any): void;
37
+ /**
38
+ * Render a PDF from a DICOM Encapsulated PDF
39
+ * @instance
40
+ * @function renderDICOMPDF
41
+ * @param {Object} seriesStack - The original series data object
42
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
43
+ * @returns {Promise} - Return a promise which will resolve when pdf is displayed
44
+ */
45
+ export declare const renderDICOMPDF: (seriesStack: Series, elementId: string | HTMLElement) => Promise<true>;
46
+ /**
47
+ * Render an image (png or jpg) from File on a html div using cornerstone
48
+ * @instance
49
+ * @function renderFileImage
50
+ * @param {Object} file - The image File object
51
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
52
+ * @returns {Promise} - Return a promise which will resolve when image is displayed
53
+ */
54
+ export declare const renderFileImage: (file: File, elementId: string | HTMLElement) => Promise<unknown> | undefined;
55
+ /**
56
+ * Render an image (png or jpg) from web url on a html div using cornerstone
57
+ * @instance
58
+ * @function renderWebImage
59
+ * @param {String} url - The image data url
60
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
61
+ * @returns {Promise} - Return a promise which will resolve when image is displayed
62
+ */
63
+ export declare const renderWebImage: (url: string, elementId: string | HTMLElement) => Promise<cornerstone.Image>;
64
+ /**
65
+ * Unrender an image on a html div using cornerstone
66
+ * @instance
67
+ * @function disableViewport
68
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
69
+ */
70
+ export declare const disableViewport: (elementId: string | HTMLElement) => void;
71
+ /**
72
+ * Unrender an image on a html div using cornerstone
73
+ * Remove image from cornerstone cache and remove from store
74
+ * @instance
75
+ * @function unloadViewport
76
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
77
+ * @param {String} seriesId - The id of the serie
78
+ */
79
+ export declare const unloadViewport: (elementId: string, seriesId: string) => void;
80
+ /**
81
+ * Resize a viewport using cornerstone resize
82
+ * And forcing fit to window
83
+ * @instance
84
+ * @function resizeViewport
85
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
86
+ */
87
+ export declare const resizeViewport: (elementId: string | HTMLElement) => void;
88
+ /**
89
+ * Cache image and render it in a html div using cornerstone
90
+ * @instance
91
+ * @function renderImage
92
+ * @param {Object} seriesStack - The original series data object
93
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
94
+ * @param {Object} defaultProps - Optional default props
95
+ * @return {Promise} Return a promise which will resolve when image is displayed
96
+ */
97
+ export declare const renderImage: (seriesStack: Series, elementId: string | HTMLElement, defaultProps: StoreViewportOptions) => Promise<true>;
98
+ /**
99
+ * Update the cornerstone image with new imageIndex
100
+ * @instance
101
+ * @function updateImage
102
+ * @param {Object} series - The original series data object
103
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
104
+ * @param {Number} imageIndex - The index of the image to be rendered
105
+ * @param {Boolean} cacheImage - A flag to handle image cache
106
+ */
107
+ export declare const updateImage: (series: Series, elementId: string | HTMLElement, imageIndex: number, cacheImage: boolean) => Promise<void>;
108
+ /**
109
+ * Reset viewport values (scale, translation and wwwc)
110
+ * @instance
111
+ * @function resetViewports
112
+ * @param {Array} elementIds - The array of hmtl div ids
113
+ * @param {Array} keys - The array of viewport sections to resets (default is all)
114
+ */
115
+ export declare const resetViewports: (elementIds: string[], keys?: Array<"contrast" | "scaleAndTranslation" | "rotation" | "flip" | "zoom">) => void;
116
+ /**
117
+ * Update viewport data in store
118
+ * @instance
119
+ * @function updateViewportData
120
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
121
+ * @param {Object} viewportData - The new viewport data
122
+ */
123
+ export declare const updateViewportData: (elementId: string, viewportData: Viewport, activeTool: string) => void;
124
+ /**
125
+ * Store the viewport data into internal storage
126
+ * @instance
127
+ * @function storeViewportData
128
+ * @param {Object} image - The cornerstone image frame
129
+ * @param {String} elementId - The html div id used for rendering
130
+ * @param {String} viewport - The viewport tag name
131
+ * @param {Object} data - The viewport data object
132
+ */
133
+ export declare const storeViewportData: (image: cornerstone.Image, elementId: string, viewport: Viewport, data: ReturnType<typeof getSeriesData>) => void;
134
+ /**
135
+ * Invert pixels of an image
136
+ * @instance
137
+ * @function invertImage
138
+ * @param {Object} elementId - The html div id used for rendering or its DOM HTMLElement
139
+ */
140
+ export declare const invertImage: (elementId: string | HTMLElement) => void;
141
+ /**
142
+ * Flip image around horizontal axis
143
+ * @instance
144
+ * @function flipImageHorizontal
145
+ * @param {Object} elementId - The html div id used for rendering or its DOM HTMLElement
146
+ */
147
+ export declare const flipImageHorizontal: (elementId: string | HTMLElement) => void;
148
+ /**
149
+ * Flip image around vertical axis
150
+ * @instance
151
+ * @function flipImageVertical
152
+ * @param {Object} elementId - The html div id used for rendering or its DOM HTMLElement
153
+ */
154
+ export declare const flipImageVertical: (elementId: string | HTMLElement) => void;
155
+ /**
156
+ * Rotate image by 90° in left direction
157
+ * @instance
158
+ * @function rotateImageLeft
159
+ * @param {Object} elementId - The html div id used for rendering or its DOM HTMLElement
160
+ */
161
+ export declare const rotateImageLeft: (elementId: string | HTMLElement) => void;
162
+ /**
163
+ * Rotate image by 90° in right direction
164
+ * @instance
165
+ * @function rotateImageRight
166
+ * @param {Object} elementId - The html div id used for rendering or its DOM HTMLElement
167
+ */
168
+ export declare const rotateImageRight: (elementId: string | HTMLElement) => void;
169
+ /**
170
+ * Get series metadata from default props and series' metadata
171
+ * @instance
172
+ * @function getSeriesData
173
+ * @param {Object} series - The parsed data series
174
+ * @param {Object} defaultProps - Optional default properties
175
+ * @return {Object} data - A data dictionary with parsed tags' values
176
+ */
177
+ declare const getSeriesData: (series: Series, defaultProps: StoreViewportOptions) => {
178
+ loading: number;
179
+ ready: boolean;
180
+ minSliceId: number;
181
+ maxSliceId: number;
182
+ sliceId: number;
183
+ pendingSliceId?: number | undefined;
184
+ minTimeId: number;
185
+ maxTimeId: number;
186
+ timeId: number;
187
+ timestamp: number;
188
+ timestamps: number[];
189
+ timeIds: number[];
190
+ rows: number;
191
+ cols: number;
192
+ spacing_x: number;
193
+ spacing_y: number;
194
+ thickness: number;
195
+ minPixelValue: number;
196
+ maxPixelValue: number;
197
+ isColor: boolean;
198
+ isMultiframe: boolean;
199
+ isTimeserie: boolean;
200
+ isPDF: boolean;
201
+ viewport: {
202
+ scale: number;
203
+ rotation: number;
204
+ translation: {
205
+ x: number;
206
+ y: number;
207
+ };
208
+ voi: {
209
+ windowCenter: number;
210
+ windowWidth: number;
211
+ };
212
+ rows: number;
213
+ cols: number;
214
+ spacing_x: number;
215
+ spacing_y: number;
216
+ thickness: number;
217
+ };
218
+ default: {
219
+ scale: number;
220
+ rotation: number;
221
+ translation: {
222
+ x: number;
223
+ y: number;
224
+ };
225
+ voi: {
226
+ windowCenter: number;
227
+ windowWidth: number;
228
+ invert: boolean;
229
+ };
230
+ };
231
+ } & {
232
+ imageIndex: number;
233
+ imageId: string;
234
+ numberOfSlices: number;
235
+ numberOfTemporalPositions: number;
236
+ timeIndex?: number | undefined;
237
+ };
238
+ export {};
@@ -0,0 +1,14 @@
1
+ /** @module imaging/imageReslice
2
+ * @desc This file provides functionalities for
3
+ * image reslice in orthogonal directions
4
+ */
5
+ import { Series } from "./types";
6
+ /**
7
+ * Reslice a serie from native orientation to coronal or sagittal orientation
8
+ * @instance
9
+ * @function resliceSeries
10
+ * @param {Object} seriesData the original series data
11
+ * @param {String} orientation the reslice orientation [coronal or sagittal]
12
+ * @returns {Promise} - Return a promise which will resolve when data is available
13
+ */
14
+ export declare function resliceSeries(seriesData: Series, orientation: "axial" | "coronal" | "sagittal"): Promise<unknown>;