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,4 @@
1
+ {
2
+ "prettier.arrowParens": "avoid",
3
+ "prettier.trailingComma": "none"
4
+ }
package/README.md CHANGED
@@ -4,13 +4,72 @@
4
4
 
5
5
  # Larvitar
6
6
 
7
+ [![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fplantain-00%2Ftype-coverage%2Fmaster%2Fpackage.json)](https://github.com/dvisionlab/Larvitar)
8
+
7
9
  ## Dicom Image Toolkit for CornerstoneJS
8
10
 
9
- ### Current version: 1.5.13
10
- ### Latest Published Release: 1.5.13
11
+ ### Current version: 2.0.0
12
+ ### Latest Published Release: 2.0.0
11
13
 
12
14
  This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.
13
- Orthogonal multiplanar reformat is included as well as custom loader/exporter for nrrd files and [Vuex](https://vuex.vuejs.org/) custom integration.
15
+
16
+ ## Features:
17
+
18
+ - Orthogonal multiplanar reformat with contours generations
19
+ - Custom loader/exporter for nrrd files
20
+ - Segmentation masks support
21
+ - Memory management
22
+ - Support all dicom modalities
23
+ - 4D Cine support
24
+ - Anonymization functionalities
25
+ - Cine tools and ECG Parsing
26
+ - Masks management
27
+
28
+ Full documentation and examples are available at http://www.dvisionlab.com/Larvitar/.
29
+
30
+ # Typescript
31
+
32
+ _Types_ can be imported from `larvitar/imaging/types` or `larvitar/imaging/tools/types`.
33
+
34
+ ```javascript
35
+ import { Series } from "larvitar/imaging/types";
36
+
37
+ let newSerie: Series;
38
+ ```
39
+
40
+ <br>
41
+
42
+ # Dependencies
43
+
44
+ - `cornerstone`
45
+ - `cornerstone-tools`
46
+ - `dicomParser`
47
+ - `DICOMImageLoader`
48
+ - `webImageLoader`
49
+ - `fileImageLoader`
50
+ - `lodash`
51
+ - `pako`
52
+ - `papaparse`
53
+
54
+ # Installation
55
+
56
+ `yarn add larvitar`
57
+
58
+ # Build package
59
+
60
+ `yarn build`
61
+
62
+ # Coverage
63
+
64
+ Use `yarn coverage` to generate type coverage report.
65
+
66
+ # Development
67
+
68
+ Use `yarn dev` to have `webpack` hot-reload (live recompiling the library).
69
+ In order to test functionalities you can serve the .html file with VSCode extension [LiveServer](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) or other similar tools.
70
+ Once you are done, upgrade the version (README and package.json) and build the library. Docs will be compiled by the Github action.
71
+
72
+ ### Repository structure
14
73
 
15
74
  - `index` main file
16
75
  - `dataDictionary` json file for dicom tags
@@ -25,73 +84,44 @@ Orthogonal multiplanar reformat is included as well as custom loader/exporter fo
25
84
  - `imageRendering` provides rendering functionalities
26
85
  - `imageReslice` provides reslice functionalities
27
86
  - `imageStore` provides data storage functionalities, vuex support is integrated
87
+ - `imageTags` using to handle dicom tags and metadata
28
88
  - `imageTools` using to handle standard and custom cornerstone tools
29
89
  - `imageUtils` utility functions on pixels and metadata tags
30
90
  - `loaders/commonLoader` common functionalities for custom loaders
31
91
  - `loaders/dicomLoader` custom loader for DICOM files with support for multiplanar reformat (axial, sagittal and coronal planes)
32
92
  - `loaders/fileLoader` custom loader for png/jpg files
93
+ - `loaders/multiFrameLoader` custom loader for multiFrame data
33
94
  - `loaders/nrrdLoader`custom loader for nrrd files with support for multiplanar reformat (axial, sagittal and coronal planes)
34
95
  - `loaders/resliceLoader` custom loader for resliced data
35
- - `loaders/multiFrameLoader` custom loader for multiFrame data
96
+ - `parsers/ecg` custom parser for ecg data
36
97
  - `parsers/nrrd` custom parser for nrrd data
98
+ - `tools/custom/4DSliceScrollTool` is a custom cornerstone tool for handling navigation of slices in a 4D DICOM series
37
99
  - `tools/custom/contourTool` is a custom cornerstone tool for 2D visualization of segmented images
38
100
  - `tools/custom/diameterTool` is a custom cornerstone tool for 2D visualization of diameter widgets
39
101
  - `tools/custom/editMaskTool` is a custom cornerstone tool for 2D visualization of segmentation masks with brush functionalities
102
+ - `tools/custom/EllipticalRoiOverlayTool` is a custom cornerstone tool for 2D visualization of elliptical widgets
103
+ - `tools/custom/polygonSegmentationMixin` is a custom cornerstone tool for 2D visualization of polygonal widgets
104
+ - `tools/custom/polylineScissorTool` is a custom cornerstone tool for 2D visualization of polyline widgets
105
+ - `tools/custom/rectangleRoiOverlayTool` is a custom cornerstone tool for 2D visualization of rectangular widgets
40
106
  - `tools/custom/seedTool` is a custom cornerstone tool for 2D interactive seeding with custom colors and labels
107
+ - `tools/custom/setLabelMap3D`
41
108
  - `tools/custom/thresholdsBrushTool` is a custom cornerstone tool for handling thresholds in a brush tool
42
- - `tools/custom/Slice4DScrollMouseWheel` is a custom cornerstone tool for handling navigation of slices in a 4D DICOM series
43
109
  - `tools/default` default tools map and configuration
110
+ - `tools/interaction` cornerstone interaction tools
44
111
  - `tools/io` import and export functionalities for tools
45
112
  - `tools/main` tools main functionalities
46
113
  - `tools/state` tools state management
47
114
  - `tools/segmentation` segmentation masks management
48
- - `modules/vuex/larvitar.js` optional vuex state module
49
-
50
- <br>
51
-
52
- **Larvitar** can be used with or without `vuex` bindings:
53
-
54
- ```javascript
55
- import { initLarvitarStore } from "larvitar";
56
- import store from "@/store/index";
57
-
58
- initLarvitarStore(store); // Calling this without parameters makes Larvitar use its internal store.
59
- ```
60
-
61
- Full documentation and examples are available at http://www.dvisionlab.com/Larvitar/.
62
-
63
- <br>
115
+ - `tools/strategies/eraseFreeHand` strategy for erasing freehand masks
116
+ - `tools/strategies/fillFreeHand` strategy for filling freehand masks
117
+ - `tools/strategies/index` strategies index
64
118
 
65
119
  # Contributors
66
120
 
67
121
  - Simone Manini, D/Vision Lab
68
122
  - Mattia Ronzoni, D/Vision Lab
69
123
  - Sara Zanchi, D/Vision Lab
124
+ - Alessandro Re, D/Vision Lab
125
+ - Laura Borghesi, D/Vision Lab
70
126
 
71
- ![dvisionlab logo](https://www.dvisionlab.com/images/logo_dv.png)
72
-
73
- # Dependencies
74
-
75
- - `cornerstone`
76
- - `cornerstone-tools`
77
- - `dicomParser`
78
- - `wadoImageLoader`
79
- - `webImageLoader`
80
- - `fileImageLoader`
81
- - `lodash`
82
- - `pako`
83
- - `papaparse`
84
-
85
- # Installation
86
-
87
- `yarn add larvitar`
88
-
89
- # Build package
90
-
91
- `yarn build-lib`
92
-
93
- # Development
94
-
95
- Use `yarn dev-lib` to have `rollup` hot-reload (live recompiling the library).
96
- In order to test functionalities you can modify the library import path in an example (see the `docs/examples` folder) to use the recompiled bundle in `dist/`, then serve the .html file with VSCode extension [LiveServer](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) or other similar tools.
97
- Once you are done, upgrade the version, build the library and copy it to the `docs/examples` folder. This file must be included into the commit, while docs will be compiled by the Github action.
127
+ ![dvisionlab logo](https://www.dvisionlab.com/assets/images/logo-light.png)
@@ -0,0 +1,27 @@
1
+ module.exports = {
2
+ devtool: "source-map", // or inline-source-map ?
3
+ module: {
4
+ rules: [
5
+ // HTML
6
+ {
7
+ test: /\.(html)$/,
8
+ use: ["html-loader"]
9
+ },
10
+ // JS
11
+ {
12
+ test: /\.js$/,
13
+ exclude: /node_modules/,
14
+ use: ["babel-loader"]
15
+ },
16
+ // typescript support
17
+ {
18
+ test: /\.tsx?$/,
19
+ use: "ts-loader",
20
+ exclude: /node_modules/
21
+ }
22
+ ]
23
+ },
24
+ resolve: {
25
+ extensions: [".tsx", ".ts", ".js", ".d.ts"]
26
+ }
27
+ };
@@ -0,0 +1,23 @@
1
+ const path = require("path");
2
+ const { merge } = require("webpack-merge");
3
+ const commonConfiguration = require("./webpack.common.js");
4
+ const { CleanWebpackPlugin } = require("clean-webpack-plugin");
5
+
6
+ module.exports = merge(commonConfiguration, {
7
+ entry: path.resolve(__dirname, "../index.ts"),
8
+ output: {
9
+ path: path.resolve(__dirname, "../dist"),
10
+ filename: "larvitar.js",
11
+ library: "larvitar",
12
+ libraryTarget: "umd"
13
+ },
14
+ mode: "development",
15
+ plugins: [new CleanWebpackPlugin()],
16
+ watch: true,
17
+ watchOptions: {
18
+ ignored: /node_modules/
19
+ },
20
+ optimization: {
21
+ minimize: false
22
+ }
23
+ });
@@ -0,0 +1,19 @@
1
+ const path = require("path");
2
+ const { merge } = require("webpack-merge");
3
+ const commonConfiguration = require("./webpack.common.js");
4
+ const { CleanWebpackPlugin } = require("clean-webpack-plugin");
5
+
6
+ module.exports = merge(commonConfiguration, {
7
+ entry: path.resolve(__dirname, "../index.ts"),
8
+ output: {
9
+ path: path.resolve(__dirname, "../dist"),
10
+ filename: "larvitar.js",
11
+ library: "larvitar",
12
+ libraryTarget: "umd"
13
+ },
14
+ mode: "production",
15
+ plugins: [new CleanWebpackPlugin()],
16
+ optimization: {
17
+ minimize: false
18
+ }
19
+ });
package/decs.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ declare module "cornerstone-math";
2
+ declare module "cornerstone-tools";
3
+ declare module "cornerstone-wado-image-loader";
4
+ declare module "cornerstone-web-image-loader";
5
+ declare module "cornerstone-file-image-loader";
6
+ declare module "dicom-character-set";
7
+
8
+ declare global {
9
+ interface Document {
10
+ documentMode?: any;
11
+ }
12
+ }
@@ -0,0 +1,39 @@
1
+ export type MetaDataReadable = {
2
+ anonymized?: boolean;
3
+ larvitarSeriesInstanceUID?: string;
4
+ seriesUID?: string;
5
+ instanceUID?: string;
6
+ studyUID?: string;
7
+ accessionNumber?: string;
8
+ studyDescription?: string;
9
+ patientName?: string;
10
+ patientBirthdate?: string;
11
+ seriesDescription?: string;
12
+ seriesDate?: string;
13
+ seriesModality?: string;
14
+ intercept?: number | number[];
15
+ slope?: number | number[];
16
+ pixelSpacing?: [number, number];
17
+ sliceThickness?: number | number[];
18
+ imageOrientation?: [number, number, number, number, number, number];
19
+ imagePosition?: [number, number] | [number, number, number] | number[];
20
+ rows?: number;
21
+ cols?: number;
22
+ numberOfSlices?: number;
23
+ numberOfFrames?: number;
24
+ frameTime?: number;
25
+ frameDelay?: number;
26
+ rWaveTimeVector?: number[];
27
+ isMultiframe?: boolean;
28
+ temporalPositionIdentifier?: number;
29
+ numberOfTemporalPositions?: number;
30
+ contentTime?: number;
31
+ is4D?: boolean;
32
+ windowCenter?: number | number[];
33
+ windowWidth?: number | number[];
34
+ minPixelValue?: number;
35
+ maxPixelValue?: number;
36
+ length?: number;
37
+ repr?: string | null;
38
+ mimeType?: string;
39
+ };