dcmjs 0.29.13 → 0.30.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcmjs",
3
- "version": "0.29.13",
3
+ "version": "0.30.1",
4
4
  "description": "Javascript implementation of DICOM manipulation",
5
5
  "main": "build/dcmjs.js",
6
6
  "module": "build/dcmjs.es.js",
@@ -1 +1,45 @@
1
- it("No tests yet", () => {});
1
+ import "regenerator-runtime/runtime.js";
2
+ import fs from "fs";
3
+ import Segmentation_4X from "../src/adapters/Cornerstone/Segmentation_4X"
4
+ import { getTestDataset } from "./testUtils.js";
5
+
6
+ const mockMetadataProvider = {
7
+ get: (type, imageId) => {
8
+ // Unlike CT, is missing coordinate system such as frameOfReferenceUID or rowCosines attributes
9
+ if (imageId === "mg://1") {
10
+ return {
11
+ seriesInstanceUID: "1.2.840.113681.167838594.1562401072.4432.2070.71100000",
12
+ rows: 3328,
13
+ columns: 2560,
14
+ pixelSpacing: [0.065238, 0.065238],
15
+ rowPixelSpacing: 0.065238,
16
+ columnPixelSpacing: 0.065238,
17
+ columnCosines: null,
18
+ frameOfReferenceUID: undefined,
19
+ imageOrientationPatient: undefined,
20
+ imagePositionPatient: undefined,
21
+ rowCosines: null,
22
+ sliceLocation: undefined,
23
+ sliceThickness: undefined
24
+ };
25
+ }
26
+ }
27
+ }
28
+
29
+ it("Can generate tool state (4X) with SEG sourcing MG images without throwing any errors", async () => {
30
+ const url =
31
+ "https://github.com/dcmjs-org/data/releases/download/mg-seg/seg-test-SEG.dcm";
32
+ const dcmPath = await getTestDataset(url, "seg-test-SEG.dcm")
33
+ const arrayBuffer = fs.readFileSync(dcmPath).buffer
34
+
35
+ expect(
36
+ () => {
37
+ Segmentation_4X.generateToolState(
38
+ ["mg://1"],
39
+ arrayBuffer,
40
+ mockMetadataProvider
41
+ )
42
+ },
43
+ ).not.toThrowError();
44
+
45
+ });