larvitar 1.5.0 → 1.5.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/README.md +2 -2
- package/imaging/imageLoading.js +3 -0
- package/imaging/imageRendering.js +35 -23
- package/imaging/imageStore.js +3 -0
- package/modules/vuex/larvitar.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
## Dicom Image Toolkit for CornerstoneJS
|
|
8
8
|
|
|
9
|
-
### Current version: 1.5.
|
|
9
|
+
### Current version: 1.5.2
|
|
10
10
|
|
|
11
|
-
### Latest Published Release: 1.5.
|
|
11
|
+
### Latest Published Release: 1.5.2
|
|
12
12
|
|
|
13
13
|
This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.
|
|
14
14
|
Orthogonal multiplanar reformat is included as well as custom loader/exporter for nrrd files and [Vuex](https://vuex.vuejs.org/) custom integration.
|
package/imaging/imageLoading.js
CHANGED
|
@@ -148,6 +148,8 @@ export const updateLoadedStack = function (
|
|
|
148
148
|
let numberOfTemporalPositions = seriesData.metadata["x00200105"];
|
|
149
149
|
let acquisitionNumberAttribute = seriesData.metadata["x00200012"];
|
|
150
150
|
let is4D = seriesData.metadata.is4D;
|
|
151
|
+
let SOPUID = seriesData.metadata["x00080016"];
|
|
152
|
+
let isPDF = SOPUID == "1.2.840.10008.5.1.4.1.1.104.1" ? true : false;
|
|
151
153
|
|
|
152
154
|
let color = cornerstoneWADOImageLoader.isColorImage(
|
|
153
155
|
seriesData.metadata["x00280004"]
|
|
@@ -170,6 +172,7 @@ export const updateLoadedStack = function (
|
|
|
170
172
|
numberOfTemporalPositions: numberOfTemporalPositions,
|
|
171
173
|
isMultiframe: isMultiframe,
|
|
172
174
|
is4D: is4D,
|
|
175
|
+
isPDF: isPDF,
|
|
173
176
|
modality: modality,
|
|
174
177
|
color: color,
|
|
175
178
|
bytes: 0
|
|
@@ -119,11 +119,12 @@ export function loadAndCacheImages(series, callback) {
|
|
|
119
119
|
* Render a PDF from a DICOM Encapsulated PDF
|
|
120
120
|
* @instance
|
|
121
121
|
* @function renderDICOMPDF
|
|
122
|
-
* @param {Object}
|
|
122
|
+
* @param {Object} seriesStack - The original series data object
|
|
123
123
|
* @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
|
|
124
|
-
* @returns {Promise} - Return a promise which will resolve when
|
|
124
|
+
* @returns {Promise} - Return a promise which will resolve when pdf is displayed
|
|
125
125
|
*/
|
|
126
|
-
export const renderDICOMPDF = function (
|
|
126
|
+
export const renderDICOMPDF = function (seriesStack, elementId) {
|
|
127
|
+
let t0 = performance.now();
|
|
127
128
|
let element = isElement(elementId)
|
|
128
129
|
? elementId
|
|
129
130
|
: document.getElementById(elementId);
|
|
@@ -131,26 +132,35 @@ export const renderDICOMPDF = function (image, elementId) {
|
|
|
131
132
|
console.error("invalid html element: " + elementId);
|
|
132
133
|
return;
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
fileTag.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
135
|
+
let renderPromise = new Promise((resolve, reject) => {
|
|
136
|
+
let image = seriesStack.instances[seriesStack.imageIds[0]];
|
|
137
|
+
const SOPUID = image.dataSet.string("x00080016");
|
|
138
|
+
if (SOPUID === "1.2.840.10008.5.1.4.1.1.104.1") {
|
|
139
|
+
let fileTag = image.dataSet.elements.x00420011;
|
|
140
|
+
let pdfByteArray = image.dataSet.byteArray.slice(
|
|
141
|
+
fileTag.dataOffset,
|
|
142
|
+
fileTag.dataOffset + fileTag.length
|
|
143
|
+
);
|
|
144
|
+
let PDF = new Blob([pdfByteArray], { type: "application/pdf" });
|
|
145
|
+
let fileURL = URL.createObjectURL(PDF);
|
|
146
|
+
element.innerHTML =
|
|
147
|
+
'<object data="' +
|
|
148
|
+
fileURL +
|
|
149
|
+
'" type="application/pdf" width="100%" height="100%"></object>';
|
|
150
|
+
larvitar_store.set("isPDF", [elementId, true]);
|
|
151
|
+
let t1 = performance.now();
|
|
152
|
+
console.log(`Call to renderDICOMPDF took ${t1 - t0} milliseconds.`);
|
|
153
|
+
image = null;
|
|
154
|
+
fileTag = null;
|
|
155
|
+
pdfByteArray = null;
|
|
156
|
+
PDF = null;
|
|
157
|
+
fileURL = null;
|
|
158
|
+
resolve();
|
|
159
|
+
} else {
|
|
160
|
+
reject("This is not a DICOM with a PDF");
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return renderPromise;
|
|
154
164
|
};
|
|
155
165
|
|
|
156
166
|
/**
|
|
@@ -647,6 +657,7 @@ export const storeViewportData = function (image, elementId, viewport, data) {
|
|
|
647
657
|
larvitar_store.set("isColor", [elementId, data.isColor]);
|
|
648
658
|
larvitar_store.set("isMultiframe", [elementId, data.isMultiframe]);
|
|
649
659
|
larvitar_store.set("isTimeserie", [elementId, data.isTimeserie]);
|
|
660
|
+
larvitar_store.set("isPDF", [elementId, false]);
|
|
650
661
|
};
|
|
651
662
|
|
|
652
663
|
/**
|
|
@@ -797,6 +808,7 @@ let getSeriesData = function (series, defaultProps) {
|
|
|
797
808
|
data.imageId = series.imageIds[data.imageIndex];
|
|
798
809
|
}
|
|
799
810
|
data.isColor = series.color;
|
|
811
|
+
data.isPDF = series.isPDF;
|
|
800
812
|
|
|
801
813
|
// rows, cols and x y z spacing
|
|
802
814
|
data.rows = series.instances[series.imageIds[0]].metadata["x00280010"];
|
package/imaging/imageStore.js
CHANGED
|
@@ -31,6 +31,7 @@ const DEFAULT_VIEWPORT = {
|
|
|
31
31
|
isColor: false,
|
|
32
32
|
isMultiframe: false,
|
|
33
33
|
isTimeserie: false,
|
|
34
|
+
isPDF: false,
|
|
34
35
|
viewport: {
|
|
35
36
|
scale: 0.0,
|
|
36
37
|
rotation: 0.0,
|
|
@@ -254,6 +255,8 @@ class Larvitar_Store {
|
|
|
254
255
|
this.state["viewports"][data[0]]["isColor"] = data[1];
|
|
255
256
|
} else if (field == "isMultiframe") {
|
|
256
257
|
this.state["viewports"][data[0]]["isMultiframe"] = data[1];
|
|
258
|
+
} else if (field == "isPDF") {
|
|
259
|
+
this.state["viewports"][data[0]]["isPDF"] = data[1];
|
|
257
260
|
} else if (field == "isTimeserie") {
|
|
258
261
|
this.state["viewports"][data[0]]["isTimeserie"] = data[1];
|
|
259
262
|
} else if (field == "defaultViewport") {
|
package/modules/vuex/larvitar.js
CHANGED
|
@@ -23,6 +23,7 @@ const DEFAULT_VIEWPORT = {
|
|
|
23
23
|
maxPixelValue: 0,
|
|
24
24
|
isColor: false,
|
|
25
25
|
isMultiframe: false,
|
|
26
|
+
isPDF: false,
|
|
26
27
|
isTimeserie: false,
|
|
27
28
|
viewport: {
|
|
28
29
|
scale: 0.0,
|
|
@@ -150,6 +151,8 @@ export default {
|
|
|
150
151
|
commit("viewport", { id, d: { isColor } }),
|
|
151
152
|
setIsMultiframe: ({ commit }, [id, isMultiframe]) =>
|
|
152
153
|
commit("viewport", { id, d: { isMultiframe } }),
|
|
154
|
+
setIsPDF: ({ commit }, [id, isPDF]) =>
|
|
155
|
+
commit("viewport", { id, d: { isPDF } }),
|
|
153
156
|
setIsTimeserie: ({ commit }, [id, isTimeserie]) =>
|
|
154
157
|
commit("viewport", { id, d: { isTimeserie } }),
|
|
155
158
|
setDefaultViewport: (
|
package/package.json
CHANGED