dcmjs 0.34.4 → 0.35.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.
package/jest.setup.js CHANGED
@@ -9,7 +9,7 @@ const createMockLogger = () => ({
9
9
 
10
10
  const mockLog = createMockLogger();
11
11
 
12
- mockLog.create = jest.fn(name => {
12
+ mockLog.getLogger = jest.fn(name => {
13
13
  const namedLogger = createMockLogger();
14
14
  namedLogger.name = name;
15
15
  return namedLogger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcmjs",
3
- "version": "0.34.4",
3
+ "version": "0.35.0",
4
4
  "description": "Javascript implementation of DICOM manipulation",
5
5
  "main": "build/dcmjs.js",
6
6
  "module": "build/dcmjs.es.js",
@@ -35,6 +35,7 @@
35
35
  "@rollup/plugin-commonjs": "^25.0.7",
36
36
  "@rollup/plugin-json": "^6.1.0",
37
37
  "@rollup/plugin-node-resolve": "^15.2.3",
38
+ "@rollup/plugin-replace": "^6.0.1",
38
39
  "acorn": "^7.1.0",
39
40
  "acorn-jsx": "^5.2.0",
40
41
  "eslint": "^8.17.0",
package/rollup.config.mjs CHANGED
@@ -5,34 +5,41 @@ import resolve from "@rollup/plugin-node-resolve";
5
5
  import commonjs from "@rollup/plugin-commonjs";
6
6
  // import babelRuntime from "@rollup/plugin-transform-runtime"
7
7
  import json from "@rollup/plugin-json";
8
+ import replace from "@rollup/plugin-replace";
8
9
  import pkg from "./package.json" assert { type: "json" };
9
10
 
10
11
  export default {
11
- input: "src/index.js",
12
- output: [
13
- {
14
- file: pkg.main,
15
- format: "umd",
16
- name: "dcmjs",
17
- sourcemap: true
18
- },
19
- {
20
- file: pkg.module,
21
- format: "es",
22
- sourcemap: true
23
- }
24
- ],
25
- plugins: [
26
- resolve({
27
- browser: true
28
- }),
29
- commonjs(),
30
- // globals(),
31
- //builtins(),
32
- // babelRuntime(),
33
- babel({
34
- exclude: "node_modules/**"
35
- }),
36
- json()
37
- ]
12
+ input: "src/index.js",
13
+ output: [
14
+ {
15
+ file: pkg.main,
16
+ format: "umd",
17
+ name: "dcmjs",
18
+ sourcemap: true
19
+ },
20
+ {
21
+ file: pkg.module,
22
+ format: "es",
23
+ sourcemap: true
24
+ }
25
+ ],
26
+ plugins: [
27
+ replace({
28
+ "process.env.LOG_LEVEL": JSON.stringify(
29
+ process.env.LOG_LEVEL || "warn"
30
+ ),
31
+ preventAssignment: true
32
+ }),
33
+ resolve({
34
+ browser: true
35
+ }),
36
+ commonjs(),
37
+ // globals(),
38
+ //builtins(),
39
+ // babelRuntime(),
40
+ babel({
41
+ exclude: "node_modules/**"
42
+ }),
43
+ json()
44
+ ]
38
45
  };
@@ -3,7 +3,7 @@ import fs from "fs";
3
3
  import { validationLog } from "./../src/log.js";
4
4
 
5
5
  // Ignore validation errors
6
- validationLog.level = 5;
6
+ validationLog.setLevel(5);
7
7
 
8
8
  const { DicomMessage } = dcmjs.data;
9
9
  const { cleanTags, getTagsNameToEmpty } = dcmjs.anonymizer;
package/test/data.test.js CHANGED
@@ -723,14 +723,14 @@ describe("With a SpecificCharacterSet tag", () => {
723
723
  });
724
724
 
725
725
  it("Throws an exception on an unsupported character set", async () => {
726
- log.level = 5;
726
+ log.setLevel(5);
727
727
  expect(() => readEncodedLongString("nope", [])).toThrow(
728
728
  new Error("Unsupported character set: nope")
729
729
  );
730
730
  });
731
731
 
732
732
  it("Doesn't throw an exception on an unsupported character set when ignoring errors", async () => {
733
- log.level = 5;
733
+ log.setLevel(5);
734
734
  expect(
735
735
  readEncodedLongString("nope", [0x68, 0x69], { ignoreErrors: true })
736
736
  ).toEqual("hi");
@@ -4,7 +4,7 @@ import dcmjs from "../../src/index.js";
4
4
  import { validationLog } from "./../../src/log.js";
5
5
 
6
6
  // Ignore validation errors
7
- validationLog.level = 5;
7
+ validationLog.setLevel(5);
8
8
 
9
9
  const { DicomMessage } = dcmjs.data;
10
10
 
@@ -1 +1,21 @@
1
- it("No tests yet", () => {});
1
+ import "regenerator-runtime/runtime.js";
2
+
3
+ import fs from "fs";
4
+ import { jest } from "@jest/globals";
5
+ import { DicomMessage } from "../src/DicomMessage";
6
+ import { DicomMetaDictionary } from "../src/DicomMetaDictionary";
7
+ import dcmjs from "../src";
8
+
9
+ // The asset downloads in this file might take some time on a slower connection
10
+ jest.setTimeout(60000);
11
+
12
+ it("test_normalizer_op", async () => {
13
+ const file = fs.readFileSync('test/sample-op.dcm');
14
+ const dicomDict = DicomMessage.readFile(file.buffer);
15
+
16
+ const dataset = DicomMetaDictionary.naturalizeDataset(dicomDict.dict);
17
+ const multiframe = dcmjs.normalizers.Normalizer.normalizeToDataset([dataset]);
18
+
19
+ expect(dataset.NumberOfFrames).toEqual(1);
20
+ expect(multiframe.NumberOfFrames).toEqual(1);
21
+ });
package/test/testUtils.js CHANGED
@@ -8,7 +8,7 @@ import { validationLog } from "./../src/log.js";
8
8
  const { https } = followRedirects;
9
9
 
10
10
  // Don't show validation errors, as those are normally tested
11
- validationLog.level = 5;
11
+ validationLog.setLevel(5);
12
12
 
13
13
  function downloadToFile(url, filePath) {
14
14
  return new Promise((resolve, reject) => {