@radicalimaging/static-wado-creator 1.6.12 → 1.7.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/lib/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import mkdicomwebConfig from './mkdicomwebConfig.js';
2
+ import StaticWado from './StaticWado.js';
3
+ import programIndex from './program/index.js';
4
+ import createMain from './createMain.js';
5
+ import deleteMain from './deleteMain.js';
6
+ import adaptProgramOpts from './util/adaptProgramOpts.js';
7
+ import { uids } from '@radicalimaging/static-wado-util';
8
+
9
+ const { configureProgram } = programIndex;
10
+
11
+ StaticWado.mkdicomwebConfig = mkdicomwebConfig;
12
+ StaticWado.createMain = createMain;
13
+ StaticWado.deleteMain = deleteMain;
14
+ StaticWado.adaptProgramOpts = adaptProgramOpts;
15
+ StaticWado.configureProgram = configureProgram;
16
+
17
+ export default StaticWado;
18
+ export { uids, StaticWado };
@@ -1,7 +1,5 @@
1
1
  // TODO review returning type of some methods
2
- const { JSONWriter } = require('@radicalimaging/static-wado-util');
3
- const { Tags } = require('@radicalimaging/static-wado-util');
4
- const TagLists = require('../model/TagLists');
2
+ const { JSONWriter, Tags, TagLists } = require('@radicalimaging/static-wado-util');
5
3
 
6
4
  const { getValue, setValue } = Tags;
7
5
 
@@ -1,9 +1,7 @@
1
1
  const path = require('path');
2
2
  const fs = require('fs');
3
3
  const hashFactory = require('node-object-hash');
4
- const { JSONReader, JSONWriter } = require('@radicalimaging/static-wado-util');
5
- const { Tags } = require('@radicalimaging/static-wado-util');
6
- const TagLists = require('../model/TagLists');
4
+ const { JSONReader, JSONWriter, Tags, TagLists } = require('@radicalimaging/static-wado-util');
7
5
 
8
6
  const { getValue, setValue, getList, setList } = Tags;
9
7
  const hasher = hashFactory.hasher();
@@ -1,9 +1,7 @@
1
1
  const hashFactory = require('node-object-hash');
2
2
 
3
3
  const hasher = hashFactory.hasher();
4
- const { JSONWriter } = require('@radicalimaging/static-wado-util');
5
- const { Tags } = require('@radicalimaging/static-wado-util');
6
- const TagLists = require('../model/TagLists');
4
+ const { JSONWriter, Tags, TagLists } = require('@radicalimaging/static-wado-util');
7
5
 
8
6
  async function writeDeduplicatedFile(dir, data, hashValueSrc) {
9
7
  const hashValue = hashValueSrc || hasher.hash(data);
@@ -1,4 +1,4 @@
1
- const uids = require('../model/uids');
1
+ const { uids } = require('@radicalimaging/static-wado-util');
2
2
  const WriteStream = require('./WriteStream');
3
3
  const WriteMultipart = require('./WriteMultipart');
4
4
  const ExpandUriPath = require('./ExpandUriPath');
@@ -0,0 +1,8 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "../../../.."
5
+ }
6
+ ],
7
+ "settings": {}
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radicalimaging/static-wado-creator",
3
- "version": "1.6.12",
3
+ "version": "1.7.0",
4
4
  "description": "Library to convert DICOMP10 to DICOMweb format. Original upstream: https://github.com/chafey/dicomp10-to-dicomweb-js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "homepage": "https://github.com/radicalimaging/static-dicomweb#readme",
32
32
  "license": "ISC",
33
- "main": "lib/index.js",
33
+ "main": "lib/index.mjs",
34
34
  "module": "dist/index.js",
35
35
  "directories": {
36
36
  "lib": "lib",
@@ -48,9 +48,9 @@
48
48
  "scripts": {
49
49
  "test": "jest --config ./jest.config.js",
50
50
  "build": "bun run build:esm",
51
- "build:esm": "bun build lib/index.js --target node --outdir dist --",
51
+ "build:esm": "bun build lib/index.mjs --target node --outdir dist --",
52
52
  "clean": "rimraf dist",
53
- "link:exec": "npm install -g && npm link",
53
+ "link:exec": "bun link",
54
54
  "lint": "npx eslint --color \"**/*.{js,mjs,cjs}\"",
55
55
  "mkdicomweb": "bun bin/mkdicomwebDev.mjs --",
56
56
  "pack:js": "npm pack --",
@@ -65,7 +65,7 @@
65
65
  "@radicalimaging/static-wado-util": ">=1.6.1",
66
66
  "canvas": ">=3.1.0",
67
67
  "config-point": ">=0.5.1",
68
- "dcmjs": "0.35.0",
68
+ "dcmjs": "0.49.0",
69
69
  "dicom-parser": "^1.8.13",
70
70
  "glob": "^11.0.0",
71
71
  "node-object-hash": "^3.0.0",
package/lib/index.js DELETED
@@ -1,11 +0,0 @@
1
- const mkdicomwebConfig = require('./mkdicomwebConfig');
2
- const StaticWado = require('./StaticWado');
3
- const { configureProgram } = require('./program/index.js');
4
-
5
- StaticWado.mkdicomwebConfig = mkdicomwebConfig;
6
- StaticWado.createMain = require('./createMain');
7
- StaticWado.deleteMain = require('./deleteMain');
8
- StaticWado.adaptProgramOpts = require('./util/adaptProgramOpts');
9
- StaticWado.configureProgram = configureProgram;
10
-
11
- module.exports = StaticWado;
@@ -1,160 +0,0 @@
1
- const hashFactory = require('node-object-hash');
2
- const { Tags } = require('@radicalimaging/static-wado-util');
3
-
4
- /* eslint "no-param-reassign": "off" */
5
-
6
- const hasher = hashFactory.hasher();
7
-
8
- const { PatientID, PatientName, IssuerOfPatientID } = Tags;
9
- const { StudyDescription, AccessionNumber, StudyInstanceUID, StudyDate, StudyTime } = Tags;
10
- const { SeriesDescription, SeriesNumber, SeriesInstanceUID, SeriesDate, SeriesTime } = Tags;
11
-
12
- const { DeduppedHash, DeduppedRef, DeduppedType } = Tags;
13
-
14
- const { pushList, setValue, getValue } = Tags;
15
-
16
- const PatientQuery = [
17
- PatientID,
18
- Tags.OtherPatientIDsSequence,
19
- PatientName,
20
- IssuerOfPatientID,
21
- Tags.PatientBirthDate,
22
- Tags.PatientBirthTime,
23
- Tags.PatientSex,
24
- Tags.PatientIdentityRemoved,
25
- Tags.DeidentificationMethodCodeSequence,
26
- ];
27
- const StudyQuery = [
28
- StudyDescription,
29
- AccessionNumber,
30
- StudyInstanceUID,
31
- StudyDate,
32
- StudyTime,
33
- Tags.StudyStatusID,
34
- Tags.StudyPriorityID,
35
- Tags.StudyID,
36
- ];
37
-
38
- const PatientStudyQuery = [...PatientQuery, ...StudyQuery];
39
-
40
- // The difference between the extracts and the query is that the query contains the parent query values
41
- // TODO - make it into a self-cpontained object that can generate either
42
- const SeriesExtract = [
43
- SeriesDescription,
44
- SeriesNumber,
45
- SeriesInstanceUID,
46
- Tags.Modality,
47
- SeriesDate,
48
- SeriesTime,
49
- Tags.SpecificCharacterSet,
50
- Tags.Manufacturer,
51
- Tags.InstitutionName,
52
- Tags.ReferringPhysicianName,
53
- Tags.StationName,
54
- Tags.OperatorsName,
55
- Tags.ManufacturerModelName,
56
- Tags.BodyPartExamined,
57
- Tags.ProtocolName,
58
- Tags.RequestedProcedureDescription,
59
- ];
60
- const SeriesQuery = [StudyInstanceUID, ...SeriesExtract];
61
-
62
- const InstanceQuery = [
63
- Tags.SOPInstanceUID,
64
- Tags.InstanceNumber,
65
- Tags.SeriesInstanceUID,
66
- Tags.StudyInstanceUID,
67
- Tags.ContentDate,
68
- Tags.ContentTime,
69
- Tags.AcquisitionDate,
70
- Tags.AcquisitionTime,
71
- Tags.AcquisitionNumber,
72
- Tags.SamplesPerPixel,
73
- Tags.PhotometricInterpretation,
74
- Tags.PlanarConfiguration,
75
- Tags.Rows,
76
- Tags.Columns,
77
- Tags.BitsAllocated,
78
- Tags.BitsStored,
79
- Tags.HighBit,
80
- Tags.PixelRepresentation,
81
- Tags.WindowCenter,
82
- Tags.WindowWidth,
83
- Tags.WindowCenterWidthExplanation,
84
- Tags.InstanceCreationTime,
85
- ];
86
-
87
- const ImageExtract = [
88
- Tags.ImageType,
89
- Tags.InstanceCreationDate,
90
- Tags.SOPClassUID,
91
- Tags.ConversionType,
92
- Tags.ManufacturerModelName,
93
- Tags.ContentDate,
94
- Tags.AcquisitionDate,
95
- Tags.SecondaryCaptureDeviceID,
96
- Tags.DateOfSecondaryCapture,
97
- Tags.SecondaryCaptureDeviceManufacturer,
98
- Tags.SecondaryCaptureDeviceManufacturerModelName,
99
- Tags.SecondaryCaptureDeviceSoftwareVersions,
100
- Tags.SoftwareVersions,
101
- Tags.SamplesPerPixel,
102
- Tags.PhotometricInterpretation,
103
- Tags.PlanarConfiguration,
104
- Tags.Rows,
105
- Tags.Columns,
106
- Tags.BitsAllocated,
107
- Tags.BitsStored,
108
- Tags.HighBit,
109
- Tags.PixelRepresentation,
110
- Tags.WindowCenter,
111
- Tags.WindowWidth,
112
- Tags.WindowCenterWidthExplanation,
113
- Tags.PatientPosition,
114
- Tags.PatientOrientation,
115
- ];
116
-
117
- const addHash = (data, type) => {
118
- const existing = getValue(data, DeduppedHash);
119
- if (existing) {
120
- return existing;
121
- }
122
-
123
- const hashValue = hasher.hash(data);
124
- setValue(data, DeduppedHash, hashValue);
125
- setValue(data, DeduppedType, type);
126
- return hashValue;
127
- };
128
-
129
- const TagSets = {
130
- PatientQuery,
131
- StudyQuery,
132
- PatientStudyQuery,
133
- SeriesQuery,
134
- SeriesExtract,
135
- InstanceQuery,
136
- ImageExtract,
137
-
138
- QueryExtract: { remove: false, hashRef: false },
139
- RemoveExtract: { remove: true, hashRef: true },
140
-
141
- extract: (data, type, tagSet, options) => {
142
- const ret = {};
143
- const { remove, hashRef } = options || {};
144
- tagSet.forEach(tag => {
145
- const value = data[tag];
146
- if (value) {
147
- ret[tag] = value;
148
- if (remove) delete data[tag];
149
- }
150
- });
151
- const hashValue = addHash(ret, type);
152
- if (hashRef) {
153
- pushList(data, DeduppedRef, hashValue);
154
- }
155
- return ret;
156
- },
157
- addHash,
158
- };
159
-
160
- module.exports = TagSets;
package/lib/model/uids.js DELETED
@@ -1,49 +0,0 @@
1
- const octetStream = 'application/octet-stream';
2
- const uncompressed = {
3
- uncompressed: true,
4
- gzip: true,
5
- contentType: octetStream,
6
- };
7
-
8
- /**
9
- * @see {@link https://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_8.7.3.3.2.html}
10
- */
11
- const jpeg = 'image/jpeg';
12
- const jls = 'image/jls';
13
- const jll = 'image/jll';
14
- const jxl = 'image/x-jxl';
15
- const htj2k = 'image/jphc';
16
- const jp2 = 'image/jp2';
17
- const rle = 'image/dicom-rle';
18
-
19
- const uids = {
20
- '1.2.840.10008.1.2': uncompressed,
21
- '1.2.840.10008.1.2.1': uncompressed,
22
- '1.2.840.10008.1.2.1.99': uncompressed,
23
- '1.2.840.10008.1.2.2': uncompressed,
24
- '1.2.840.10008.1.2.4.50': {
25
- contentType: jpeg,
26
- lossy: true,
27
- extension: '.jpeg',
28
- },
29
- '1.2.840.10008.1.2.4.51': { contentType: jpeg, lossy: true },
30
- '1.2.840.10008.1.2.4.57': { contentType: jpeg },
31
- '1.2.840.10008.1.2.4.70': { contentType: jll, extension: '.jll' },
32
- '1.2.840.10008.1.2.4.140': { contentType: jxl, extension: '.jxl' },
33
- // Lossy, original JPEG reconstruction mode
34
- '1.2.840.10008.1.2.4.141': { contentType: jxl, lossy: true },
35
- '1.2.840.10008.1.2.4.142': { contentType: jxl, lossy: true },
36
- '1.2.840.10008.1.2.4.80': { contentType: jls, extension: '.jls' },
37
- '1.2.840.10008.1.2.4.81': { contentType: jls, lossy: true },
38
- '1.2.840.10008.1.2.4.90': { contentType: jp2, extension: '.jp2' },
39
- '1.2.840.10008.1.2.4.91': { contentType: jp2 },
40
- // Private/test transfer syntax for HTJ2K
41
- '3.2.840.10008.1.2.4.96': { contentType: htj2k },
42
- '1.2.840.10008.1.2.4.201': { contentType: htj2k },
43
- '1.2.840.10008.1.2.4.202': { contentType: htj2k, extension: '.jhc' },
44
- '1.2.840.10008.1.2.4.203': { contentType: htj2k, lossy: true },
45
- '1.2.840.10008.1.2.5': { contentType: rle },
46
- default: {},
47
- };
48
-
49
- module.exports = uids;