larvitar 4.0.0-alpha.49 → 4.0.0-alpha.50

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.
@@ -3,6 +3,7 @@ export type ExtendedMetaDataTypes = MetaDataTypes & {
3
3
  };
4
4
  export declare const arrayTags: string[];
5
5
  export type MetaDataTypes = {
6
+ x52009230?: MetaDataTypes[];
6
7
  x50000020?: string;
7
8
  x20000010?: number;
8
9
  x2000001e?: MetaDataTypes[];
@@ -126,9 +126,13 @@ export declare const getReslicedMetadata: (reslicedSeriesId: string, fromOrienta
126
126
  };
127
127
  currentImageIdIndex: number;
128
128
  };
129
- export declare const getFrameSequenceMammoVOI: (instance: any) => {
129
+ export declare const getVOIFromMetadata: (metadata: MetaData, renderOptionsVoi?: any) => {
130
130
  windowCenter: any;
131
131
  windowWidth: any;
132
+ };
133
+ export declare const getFrameSequenceMammoVOI: (metadata: MetaData) => {
134
+ windowCenter: number | number[] | undefined;
135
+ windowWidth: number | number[] | undefined;
132
136
  } | null;
133
137
  /**
134
138
  * Compute cmpr metadata from pyCmpr data (generated using Scyther {@link https://github.com/dvisionlab/Scyther})
package/dist/larvitar.js CHANGED
@@ -85695,7 +85695,7 @@ __webpack_require__.d(index_core_dist_esm_namespaceObject, {
85695
85695
  });
85696
85696
 
85697
85697
  ;// ./package.json
85698
- const index_package_namespaceObject = /*#__PURE__*/JSON.parse('{"name":"larvitar","keywords":["DICOM","imaging","medical","cornerstone"],"version":"4.0.0-alpha.49","description":"typescript library for parsing, loading, rendering and interacting with DICOM images","repository":{"url":"https://github.com/dvisionlab/Larvitar.git","type":"git"},"main":"dist/larvitar.js","types":"dist/index.d.ts","files":["dist","imaging/**/*.d.ts","imaging3d/**/*.d.ts"],"scripts":{"coverage":"typescript-coverage-report","format":"prettier --write \\"imaging/**/*.{js,ts,json,css,md}\\" \\"imaging3d/**/*.{js,ts,json,css,md}\\" \\"docs/examples/**/*.html\\"","format:check":"prettier --check \\"imaging/**/*.{js,ts,json,css,md}\\" \\"imaging3d/**/*.{js,ts,json,css,md}\\" \\"docs/examples/**/*.html\\"","postinstall":"patch-package","build":"webpack --config ./bundler/webpack.prod.debug.js","dev":"webpack --progress --config ./bundler/webpack.dev.js","docs:dev":"vuepress dev docs","docs:build":"vuepress build docs","cypress":"cypress open","cypress:run":"cypress run","cypress:run:headless":"cypress run --headless"},"author":"Simone Manini <simone.manini@dvisionlab.com> (https://www.dvisionlab.com)","contributors":["Mattia Ronzoni <mattia.ronzoni@dvisionlab.com> (https://www.dvisionlab.com)","Laura Borghesi <laura.borghesi@dvisionlab.com> (https://www.dvisionlab.com)","Sara Zanchi <sara.zanchi@dvisionlab.com> (https://www.dvisionlab.com)"],"license":"MIT","dependencies":{"@cornerstonejs/core":"^4.5.19","@cornerstonejs/dicom-image-loader":"^4.5.19","@cornerstonejs/nifti-volume-loader":"^4.5.19","@cornerstonejs/tools":"^4.7.0","@hyzyla/pdfium":"^2.1.2","@icr/polyseg-wasm":"^0.4.0","consola":"^3.4.0","cornerstone-core":"^2.6.1","cornerstone-file-image-loader":"^0.3.0","cornerstone-tools":"^6.0.7","cornerstone-wado-image-loader":"^4.13.2","cornerstone-web-image-loader":"^2.1.1","crypto-js":"^4.1.1","dcmjs":"^0.34.0","dicom-character-set":"^1.0.3","dicom-parser":"^1.8.13","hammerjs":"^2.0.8","jpeg-lossless-decoder-js":"^2.0.7","keycode-js":"^3.1.0","lodash":"^4.17.15","pako":"^1.0.10","plotly.js-dist-min":"^2.27.1","uuid":"^8.3.2"},"devDependencies":{"@babel/core":"^7.21.8","@rollup/plugin-commonjs":"^28.0.3","@types/cornerstone-core":"^2.3.0","@types/crypto-js":"^4.1.1","@types/hammerjs":"^2.0.41","@types/lodash":"^4.14.192","@types/papaparse":"^5.3.7","@types/plotly.js":"^2.12.30","@types/plotly.js-dist-min":"^2.3.4","@types/uuid":"^9.0.1","@vuepress/bundler-vite":"^2.0.0-rc.18","@vuepress/plugin-slimsearch":"^2.0.0-rc.68","@vuepress/theme-default":"^2.0.0-rc.60","babel-loader":"^9.1.2","clean-webpack-plugin":"^4.0.0","cypress":"^14.2.0","cypress-image-snapshot":"^4.0.1","cypress-mochawesome-reporter":"^3.8.2","cypress-multi-reporters":"^2.0.5","eslint":"^9.17.0","html-loader":"^4.2.0","html-webpack-plugin":"^5.6.0","jsdom":"^26.0.0","lodash-webpack-plugin":"^0.11.6","mocha-json-reporter":"^1.0.0-1","patch-package":"^8.0.0","prettier":"^3.5.3","sass-embedded":"^1.80.7","ts-loader":"^9.4.2","typescript":"^5.0.2","typescript-coverage-report":"^0.7.0","vuepress":"^2.0.0-rc.18","webpack":"^5.76.3","webpack-cli":"^5.0.1","webpack-dev-server":"^4.13.1"}}');
85698
+ const index_package_namespaceObject = /*#__PURE__*/JSON.parse('{"name":"larvitar","keywords":["DICOM","imaging","medical","cornerstone"],"version":"4.0.0-alpha.50","description":"typescript library for parsing, loading, rendering and interacting with DICOM images","repository":{"url":"https://github.com/dvisionlab/Larvitar.git","type":"git"},"main":"dist/larvitar.js","types":"dist/index.d.ts","files":["dist","imaging/**/*.d.ts","imaging3d/**/*.d.ts"],"scripts":{"coverage":"typescript-coverage-report","format":"prettier --write \\"imaging/**/*.{js,ts,json,css,md}\\" \\"imaging3d/**/*.{js,ts,json,css,md}\\" \\"docs/examples/**/*.html\\"","format:check":"prettier --check \\"imaging/**/*.{js,ts,json,css,md}\\" \\"imaging3d/**/*.{js,ts,json,css,md}\\" \\"docs/examples/**/*.html\\"","postinstall":"patch-package","build":"webpack --config ./bundler/webpack.prod.debug.js","dev":"webpack --progress --config ./bundler/webpack.dev.js","docs:dev":"vuepress dev docs","docs:build":"vuepress build docs","cypress":"cypress open","cypress:run":"cypress run","cypress:run:headless":"cypress run --headless"},"author":"Simone Manini <simone.manini@dvisionlab.com> (https://www.dvisionlab.com)","contributors":["Mattia Ronzoni <mattia.ronzoni@dvisionlab.com> (https://www.dvisionlab.com)","Laura Borghesi <laura.borghesi@dvisionlab.com> (https://www.dvisionlab.com)","Sara Zanchi <sara.zanchi@dvisionlab.com> (https://www.dvisionlab.com)"],"license":"MIT","dependencies":{"@cornerstonejs/core":"^4.5.19","@cornerstonejs/dicom-image-loader":"^4.5.19","@cornerstonejs/nifti-volume-loader":"^4.5.19","@cornerstonejs/tools":"^4.7.0","@hyzyla/pdfium":"^2.1.2","@icr/polyseg-wasm":"^0.4.0","consola":"^3.4.0","cornerstone-core":"^2.6.1","cornerstone-file-image-loader":"^0.3.0","cornerstone-tools":"^6.0.7","cornerstone-wado-image-loader":"^4.13.2","cornerstone-web-image-loader":"^2.1.1","crypto-js":"^4.1.1","dcmjs":"^0.34.0","dicom-character-set":"^1.0.3","dicom-parser":"^1.8.13","hammerjs":"^2.0.8","jpeg-lossless-decoder-js":"^2.0.7","keycode-js":"^3.1.0","lodash":"^4.17.15","pako":"^1.0.10","plotly.js-dist-min":"^2.27.1","uuid":"^8.3.2"},"devDependencies":{"@babel/core":"^7.21.8","@rollup/plugin-commonjs":"^28.0.3","@types/cornerstone-core":"^2.3.0","@types/crypto-js":"^4.1.1","@types/hammerjs":"^2.0.41","@types/lodash":"^4.14.192","@types/papaparse":"^5.3.7","@types/plotly.js":"^2.12.30","@types/plotly.js-dist-min":"^2.3.4","@types/uuid":"^9.0.1","@vuepress/bundler-vite":"^2.0.0-rc.18","@vuepress/plugin-slimsearch":"^2.0.0-rc.68","@vuepress/theme-default":"^2.0.0-rc.60","babel-loader":"^9.1.2","clean-webpack-plugin":"^4.0.0","cypress":"^14.2.0","cypress-image-snapshot":"^4.0.1","cypress-mochawesome-reporter":"^3.8.2","cypress-multi-reporters":"^2.0.5","eslint":"^9.17.0","html-loader":"^4.2.0","html-webpack-plugin":"^5.6.0","jsdom":"^26.0.0","lodash-webpack-plugin":"^0.11.6","mocha-json-reporter":"^1.0.0-1","patch-package":"^8.0.0","prettier":"^3.5.3","sass-embedded":"^1.80.7","ts-loader":"^9.4.2","typescript":"^5.0.2","typescript-coverage-report":"^0.7.0","vuepress":"^2.0.0-rc.18","webpack":"^5.76.3","webpack-cli":"^5.0.1","webpack-dev-server":"^4.13.1"}}');
85699
85699
  // EXTERNAL MODULE: ./node_modules/cornerstone-core/dist/cornerstone.js
85700
85700
  var index_dist_cornerstone = __webpack_require__(1198);
85701
85701
  var index_cornerstone_default = /*#__PURE__*/__webpack_require__.n(index_dist_cornerstone);
@@ -171423,8 +171423,7 @@ let index_createCustomImage = function (imageId, metadata, pixelData, dataSet) {
171423
171423
  : [1, 1];
171424
171424
  let rescaleIntercept = metadata.x00281052;
171425
171425
  let rescaleSlope = metadata.x00281053;
171426
- let windowCenter = metadata.x00281050;
171427
- let windowWidth = metadata.x00281051;
171426
+ const { windowWidth, windowCenter } = index_imageUtils_getVOIFromMetadata(metadata);
171428
171427
  function getSizeInBytes() {
171429
171428
  let bytesPerPixel = Math.round(imageFrame.bitsAllocated / 8);
171430
171429
  return (imageFrame.rows *
@@ -171548,6 +171547,7 @@ let index_createCustomImage = function (imageId, metadata, pixelData, dataSet) {
171548
171547
 
171549
171548
 
171550
171549
 
171550
+
171551
171551
  /*
171552
171552
  * This module provides the following functions to be exported:
171553
171553
  * loadReslicedImage(imageId)
@@ -171602,8 +171602,7 @@ let index_resliceLoader_createCustomImage = function (imageId, metadata, pixelDa
171602
171602
  : [1, 1];
171603
171603
  let rescaleIntercept = metadata.x00281052;
171604
171604
  let rescaleSlope = metadata.x00281053;
171605
- let windowCenter = metadata.x00281050;
171606
- let windowWidth = metadata.x00281051;
171605
+ const { windowWidth, windowCenter } = index_imageUtils_getVOIFromMetadata(metadata);
171607
171606
  function getSizeInBytes() {
171608
171607
  let bytesPerPixel = Math.round(imageFrame.bitsAllocated / 8);
171609
171608
  return (imageFrame.rows *
@@ -173755,8 +173754,9 @@ const index_fillMetadataReadable = function (metadata) {
173755
173754
  metadataReadable.numberOfSlices = metadata["x00540081"]
173756
173755
  ? metadata["x00540081"] // number of slices
173757
173756
  : metadata["x00201002"]; // number of instances
173758
- metadataReadable.windowCenter = metadata["x00281050"];
173759
- metadataReadable.windowWidth = metadata["x00281051"];
173757
+ const { windowWidth, windowCenter } = index_imageUtils_getVOIFromMetadata(metadata);
173758
+ metadataReadable.windowCenter = windowCenter;
173759
+ metadataReadable.windowWidth = windowWidth;
173760
173760
  metadataReadable.minPixelValue = metadata["x00280106"];
173761
173761
  metadataReadable.maxPixelValue = metadata["x00280107"];
173762
173762
  metadataReadable.numberOfFrames = numberOfFrames;
@@ -174416,6 +174416,7 @@ let index_dsaImageLoader_createCustomImage = function (imageId, srcImage, pixelD
174416
174416
 
174417
174417
 
174418
174418
 
174419
+
174419
174420
  // global module variables
174420
174421
  let index_multiframeLoader_customImageLoaderCounter = 0;
174421
174422
  // Local cache used to store multiframe datasets to avoid reading and parsing
@@ -174646,8 +174647,7 @@ let index_multiframeLoader_createCustomImage = function (id, imageId, frameIndex
174646
174647
  : [1, 1];
174647
174648
  let rescaleIntercept = metadata.x00281052;
174648
174649
  let rescaleSlope = metadata.x00281053;
174649
- let windowCenter = metadata.x00281050;
174650
- let windowWidth = metadata.x00281051;
174650
+ const { windowWidth, windowCenter } = index_imageUtils_getVOIFromMetadata(metadata);
174651
174651
  function getSizeInBytes() {
174652
174652
  let bytesPerPixel = Math.round(imageFrame.bitsAllocated / 8);
174653
174653
  return (imageFrame.rows *
@@ -174796,6 +174796,7 @@ var index_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
174796
174796
  // internal libraries
174797
174797
 
174798
174798
 
174799
+
174799
174800
  // global module variables
174800
174801
  let index_singleFrameLoader_customImageLoaderCounter = 0;
174801
174802
  let index_singleFrameCache = {};
@@ -174946,8 +174947,7 @@ const index_singleFrameLoader_createCustomImage = function (imageId) {
174946
174947
  : [1, 1];
174947
174948
  let rescaleIntercept = metadata.x00281052;
174948
174949
  let rescaleSlope = metadata.x00281053;
174949
- let windowCenter = metadata.x00281050;
174950
- let windowWidth = metadata.x00281051;
174950
+ const { windowWidth, windowCenter } = index_imageUtils_getVOIFromMetadata(metadata);
174951
174951
  function getSizeInBytes() {
174952
174952
  let bytesPerPixel = Math.round(imageFrame.bitsAllocated / 8);
174953
174953
  return (imageFrame.rows *
@@ -223646,8 +223646,8 @@ const index_resetViewports = function (elementIds, keys) {
223646
223646
  ]);
223647
223647
  }
223648
223648
  if (!keys || keys.find(v => v === "scaleAndTranslationOriginalSize")) {
223649
- viewport.scale = 1.00;
223650
- index_imageStore_set(["scale", elementId, 1.00]);
223649
+ viewport.scale = 1.0;
223650
+ index_imageStore_set(["scale", elementId, 1.0]);
223651
223651
  viewport.translation.x = defaultViewport.translation.x;
223652
223652
  viewport.translation.y = defaultViewport.translation.y;
223653
223653
  index_imageStore_set([
@@ -224036,7 +224036,6 @@ const index_getTemporalSeriesData = function (series) {
224036
224036
  * @return {StoreViewport} data - A data dictionary with parsed tags' values
224037
224037
  */
224038
224038
  const index_getSeriesData = function (series, renderOptions) {
224039
- var _a, _b, _c, _d, _e, _f;
224040
224039
  const data = {};
224041
224040
  data.uniqueUID = series.uniqueUID || series.seriesUID; //case of resliced series
224042
224041
  data.modality = series.modality;
@@ -224095,23 +224094,7 @@ const index_getSeriesData = function (series, renderOptions) {
224095
224094
  let spacing = instance.metadata.x00280030;
224096
224095
  data.spacing_x = spacing ? spacing[0] : 1;
224097
224096
  data.spacing_y = spacing ? spacing[1] : 1;
224098
- let windowCenter;
224099
- let windowWidth;
224100
- if (renderOptions.voi !== undefined) {
224101
- windowCenter = renderOptions.voi.windowCenter;
224102
- windowWidth = renderOptions.voi.windowWidth;
224103
- }
224104
- else if (((_a = instance.metadata.x00080060) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === "MG") {
224105
- const frameSequenceMammoVOI = index_getFrameSequenceMammoVOI(instance);
224106
- windowCenter =
224107
- (_b = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowCenter) !== null && _b !== void 0 ? _b : instance.metadata.x00281050;
224108
- windowWidth =
224109
- (_c = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowWidth) !== null && _c !== void 0 ? _c : instance.metadata.x00281051;
224110
- }
224111
- else {
224112
- windowCenter = instance.metadata.x00281050;
224113
- windowWidth = instance.metadata.x00281051;
224114
- }
224097
+ const { windowWidth, windowCenter } = index_imageUtils_getVOIFromMetadata(instance.metadata, renderOptions.voi);
224115
224098
  // window center and window width
224116
224099
  data.viewport = {
224117
224100
  voi: {
@@ -224121,19 +224104,7 @@ const index_getSeriesData = function (series, renderOptions) {
224121
224104
  };
224122
224105
  // store default values for the viewport voi from the series metadata
224123
224106
  data.default = {};
224124
- if (((_d = instance.metadata.x00080060) === null || _d === void 0 ? void 0 : _d.toUpperCase()) === "MG") {
224125
- const frameSequenceMammoVOI = index_getFrameSequenceMammoVOI(instance);
224126
- data.default.voi = {
224127
- windowCenter: ((_e = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowCenter) !== null && _e !== void 0 ? _e : instance.metadata.x00281050),
224128
- windowWidth: ((_f = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowWidth) !== null && _f !== void 0 ? _f : instance.metadata.x00281051)
224129
- };
224130
- }
224131
- else {
224132
- data.default.voi = {
224133
- windowCenter: instance.metadata.x00281050,
224134
- windowWidth: instance.metadata.x00281051
224135
- };
224136
- }
224107
+ data.default.voi = index_imageUtils_getVOIFromMetadata(instance.metadata);
224137
224108
  data.default.rotation = 0;
224138
224109
  data.default.translation = { x: 0, y: 0 };
224139
224110
  if (renderOptions.default !== undefined) {
@@ -224178,7 +224149,6 @@ const index_getSeriesData = function (series, renderOptions) {
224178
224149
  * @return {StoreViewport} data - A data dictionary with parsed tags' values
224179
224150
  */
224180
224151
  const index_getSeriesDataFromStore = function (elementId, series, renderOptions = {}) {
224181
- var _a, _b, _c;
224182
224152
  const data = index_imageStore.get([
224183
224153
  "viewports",
224184
224154
  elementId
@@ -224213,19 +224183,7 @@ const index_getSeriesDataFromStore = function (elementId, series, renderOptions
224213
224183
  if (!data.default.voi) {
224214
224184
  data.default.voi = { windowCenter: 0, windowWidth: 0 };
224215
224185
  }
224216
- if (((_a = instance.metadata.x00080060) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === "MG") {
224217
- const frameSequenceMammoVOI = index_getFrameSequenceMammoVOI(instance);
224218
- data.default.voi = {
224219
- windowCenter: ((_b = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowCenter) !== null && _b !== void 0 ? _b : instance.metadata.x00281050),
224220
- windowWidth: ((_c = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowWidth) !== null && _c !== void 0 ? _c : instance.metadata.x00281051)
224221
- };
224222
- }
224223
- else {
224224
- data.default.voi = {
224225
- windowCenter: instance.metadata.x00281050,
224226
- windowWidth: instance.metadata.x00281051
224227
- };
224228
- }
224186
+ data.default.voi = index_imageUtils_getVOIFromMetadata(instance.metadata);
224229
224187
  }
224230
224188
  if (renderOptions.voi !== undefined) {
224231
224189
  if (!data.viewport) {
@@ -224831,10 +224789,32 @@ const index_getReslicedMetadata = function (reslicedSeriesId, fromOrientation, t
224831
224789
  currentImageIdIndex: 0
224832
224790
  };
224833
224791
  };
224834
- const index_getFrameSequenceMammoVOI = function (instance) {
224792
+ const index_imageUtils_getVOIFromMetadata = function (metadata, renderOptionsVoi) {
224793
+ var _a, _b, _c;
224794
+ if (renderOptionsVoi !== undefined) {
224795
+ return {
224796
+ windowCenter: renderOptionsVoi.windowCenter,
224797
+ windowWidth: renderOptionsVoi.windowWidth
224798
+ };
224799
+ }
224800
+ else if (((_a = metadata.x00080060) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === "MG") {
224801
+ const frameSequenceMammoVOI = index_getFrameSequenceMammoVOI(metadata);
224802
+ return {
224803
+ windowCenter: (_b = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowCenter) !== null && _b !== void 0 ? _b : metadata.x00281050,
224804
+ windowWidth: (_c = frameSequenceMammoVOI === null || frameSequenceMammoVOI === void 0 ? void 0 : frameSequenceMammoVOI.windowWidth) !== null && _c !== void 0 ? _c : metadata.x00281051
224805
+ };
224806
+ }
224807
+ else {
224808
+ return {
224809
+ windowCenter: metadata.x00281050,
224810
+ windowWidth: metadata.x00281051
224811
+ };
224812
+ }
224813
+ };
224814
+ const index_getFrameSequenceMammoVOI = function (metadata) {
224835
224815
  var _a, _b;
224836
224816
  try {
224837
- const perFrameGroups = (_a = instance.metadata.x52009230) === null || _a === void 0 ? void 0 : _a[0];
224817
+ const perFrameGroups = (_a = metadata.x52009230) === null || _a === void 0 ? void 0 : _a[0];
224838
224818
  const frameVOI = (_b = perFrameGroups === null || perFrameGroups === void 0 ? void 0 : perFrameGroups.x00289132) === null || _b === void 0 ? void 0 : _b[0];
224839
224819
  return {
224840
224820
  windowCenter: frameVOI === null || frameVOI === void 0 ? void 0 : frameVOI.x00281050,
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "medical",
7
7
  "cornerstone"
8
8
  ],
9
- "version": "4.0.0-alpha.49",
9
+ "version": "4.0.0-alpha.50",
10
10
  "description": "typescript library for parsing, loading, rendering and interacting with DICOM images",
11
11
  "repository": {
12
12
  "url": "https://github.com/dvisionlab/Larvitar.git",