@abasb75/dicom-parser 0.0.4-test → 0.0.6-test

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/Dataset.d.ts CHANGED
@@ -1,35 +1,52 @@
1
- import { Tags } from "./types";
1
+ import { DicomDate, DicomPatientModule, DicomPixelModule, DicomTime, DicomVOILutModule, Tags } from "./types";
2
2
  declare class Dataset {
3
3
  tags: Tags;
4
4
  transferSyntaxUID: string;
5
5
  dataView: DataView;
6
6
  studyInstanceUID: string;
7
7
  studyID: string;
8
- numberOfFrames: number | undefined;
9
- windowWidth: number | string | undefined;
10
- windowCenter: number | string | undefined;
11
8
  seriesInstanceUID: string;
12
9
  seriesNumber: number | string | undefined;
13
- studyDate: string;
14
- studyTime: number | string | undefined;
10
+ studyDate: string | DicomDate;
11
+ studyTime: number | DicomTime | string | undefined;
15
12
  pixelRepresentation: number | string | undefined;
16
13
  littleEndian: boolean;
17
14
  pixeSpacing: number | number[] | string | undefined;
18
15
  accessionNumber: string;
19
16
  bitsAllocated: number | string | undefined;
17
+ bitsStored: number | string | undefined;
18
+ highBit: number | string | undefined;
20
19
  imageType: number | string | number[] | string[] | undefined;
21
20
  modality: number | string | number[] | string[] | undefined;
22
21
  seriesDescription: string;
23
22
  rows: string | number | undefined;
24
23
  columns: string | number | undefined;
25
24
  patientSex: any;
26
- patientAge: string;
25
+ /** modules */
26
+ voiLUTModule: DicomVOILutModule;
27
+ patientModule: DicomPatientModule;
28
+ pixelModule: DicomPixelModule;
27
29
  constructor(tags: Tags, dataView: DataView, littleEndian: boolean);
30
+ getPixelData(): import("./types").PixelArray[];
31
+ getVOILutModule(): DicomVOILutModule;
32
+ getPatientModule(): DicomPatientModule;
33
+ getPixelModule(): DicomPixelModule;
34
+ date(group: number, element: number): string | {
35
+ year: string;
36
+ month: string;
37
+ day: string;
38
+ };
39
+ time(group: number, element: number): string | {
40
+ hour: string;
41
+ minute: string;
42
+ second: string;
43
+ };
28
44
  int(group: number, element: number): number | undefined;
29
45
  get(group: number, element: number): string;
30
46
  string(group: number, element: number): string;
31
- getValue(element: number | string, elementId?: number | string, vr?: string): string | number | (string | number)[] | undefined;
47
+ getValue(element: number | string, elementId?: number | string, vr?: string): string | number | DataView | (string | number)[] | undefined;
32
48
  private _getValue;
33
49
  private _reformatToString;
50
+ draw(canvas: HTMLCanvasElement): void;
34
51
  }
35
52
  export default Dataset;
package/Dataset.js CHANGED
@@ -1,3 +1,5 @@
1
+ import Draw from "./Draw";
2
+ import PixelData from "./PixelData";
1
3
  import Tag from "./Tag";
2
4
  import Value from "./Value";
3
5
  class Dataset {
@@ -32,73 +34,67 @@ class Dataset {
32
34
  writable: true,
33
35
  value: ""
34
36
  });
35
- Object.defineProperty(this, "numberOfFrames", {
37
+ Object.defineProperty(this, "seriesInstanceUID", {
36
38
  enumerable: true,
37
39
  configurable: true,
38
40
  writable: true,
39
41
  value: void 0
40
42
  });
41
- Object.defineProperty(this, "windowWidth", {
43
+ Object.defineProperty(this, "seriesNumber", {
42
44
  enumerable: true,
43
45
  configurable: true,
44
46
  writable: true,
45
47
  value: void 0
46
48
  });
47
- Object.defineProperty(this, "windowCenter", {
49
+ Object.defineProperty(this, "studyDate", {
48
50
  enumerable: true,
49
51
  configurable: true,
50
52
  writable: true,
51
53
  value: void 0
52
54
  });
53
- Object.defineProperty(this, "seriesInstanceUID", {
55
+ Object.defineProperty(this, "studyTime", {
54
56
  enumerable: true,
55
57
  configurable: true,
56
58
  writable: true,
57
59
  value: void 0
58
60
  });
59
- Object.defineProperty(this, "seriesNumber", {
61
+ Object.defineProperty(this, "pixelRepresentation", {
60
62
  enumerable: true,
61
63
  configurable: true,
62
64
  writable: true,
63
65
  value: void 0
64
66
  });
65
- Object.defineProperty(this, "studyDate", {
67
+ Object.defineProperty(this, "littleEndian", {
66
68
  enumerable: true,
67
69
  configurable: true,
68
70
  writable: true,
69
71
  value: void 0
70
72
  });
71
- Object.defineProperty(this, "studyTime", {
73
+ Object.defineProperty(this, "pixeSpacing", {
72
74
  enumerable: true,
73
75
  configurable: true,
74
76
  writable: true,
75
77
  value: void 0
76
78
  });
77
- Object.defineProperty(this, "pixelRepresentation", {
79
+ Object.defineProperty(this, "accessionNumber", {
78
80
  enumerable: true,
79
81
  configurable: true,
80
82
  writable: true,
81
83
  value: void 0
82
84
  });
83
- Object.defineProperty(this, "littleEndian", {
85
+ Object.defineProperty(this, "bitsAllocated", {
84
86
  enumerable: true,
85
87
  configurable: true,
86
88
  writable: true,
87
89
  value: void 0
88
90
  });
89
- Object.defineProperty(this, "pixeSpacing", {
91
+ Object.defineProperty(this, "bitsStored", {
90
92
  enumerable: true,
91
93
  configurable: true,
92
94
  writable: true,
93
95
  value: void 0
94
96
  });
95
- Object.defineProperty(this, "accessionNumber", {
96
- enumerable: true,
97
- configurable: true,
98
- writable: true,
99
- value: void 0
100
- });
101
- Object.defineProperty(this, "bitsAllocated", {
97
+ Object.defineProperty(this, "highBit", {
102
98
  enumerable: true,
103
99
  configurable: true,
104
100
  writable: true,
@@ -140,7 +136,20 @@ class Dataset {
140
136
  writable: true,
141
137
  value: void 0
142
138
  });
143
- Object.defineProperty(this, "patientAge", {
139
+ /** modules */
140
+ Object.defineProperty(this, "voiLUTModule", {
141
+ enumerable: true,
142
+ configurable: true,
143
+ writable: true,
144
+ value: void 0
145
+ });
146
+ Object.defineProperty(this, "patientModule", {
147
+ enumerable: true,
148
+ configurable: true,
149
+ writable: true,
150
+ value: void 0
151
+ });
152
+ Object.defineProperty(this, "pixelModule", {
144
153
  enumerable: true,
145
154
  configurable: true,
146
155
  writable: true,
@@ -151,27 +160,92 @@ class Dataset {
151
160
  this.littleEndian = littleEndian;
152
161
  this.studyID = this.get(0x0020, 0x0010);
153
162
  this.studyInstanceUID = this.string(0x0020, 0x000D);
154
- this.numberOfFrames = this.int(0x0028, 0x0008);
155
- this.windowWidth = this.get(0x0028, 0x1050);
156
- this.windowCenter = this.get(0x0028, 0x1051);
157
163
  this.seriesInstanceUID = this.get(0x0020, 0x000E);
158
164
  this.seriesNumber = this.get(0x0020, 0x0011);
159
- this.studyDate = this.get(0x0008, 0x0020);
160
- this.studyTime = this.get(0x0008, 0x0030);
161
- this.pixelRepresentation = this.get(0x0028, 0x0103);
162
- this.pixeSpacing = this.get(0x0028, 0x0030);
165
+ this.studyDate = this.date(0x0008, 0x0020);
166
+ this.studyTime = this.time(0x0008, 0x0030);
163
167
  this.accessionNumber = this.string(0x0008, 0x0050);
164
- this.bitsAllocated = this.get(0x0028, 0x0100);
165
168
  this.imageType = this.get(0x0008, 0x0008);
166
169
  this.modality = this.get(0x0008, 0x0060);
167
170
  this.seriesDescription = this.string(0x0008, 0x103E);
168
171
  this.patientSex = this.get(0x0010, 0x0040);
169
- this.rows = this.get(0x0028, 0x0010);
170
- this.columns = this.get(0x0028, 0x0011);
171
- this.patientAge = this.get(0x0010, 0x1010);
172
+ this.voiLUTModule = this.getVOILutModule();
173
+ this.patientModule = this.getPatientModule();
174
+ this.pixelModule = this.getPixelModule();
175
+ }
176
+ getPixelData() {
177
+ return PixelData.get(this);
178
+ }
179
+ getVOILutModule() {
180
+ return {
181
+ voiLUTFunction: this.get(0x0028, 0x1056),
182
+ windowWidth: this.int(0x0028, 0x1050),
183
+ windowCenter: this.int(0x0028, 0x1051),
184
+ voiLUTSequence: this.get(0x0028, 0x3010),
185
+ lutDescriptor: this.get(0x0028, 0x3002),
186
+ lutExplanation: this.get(0x0028, 0x3003),
187
+ lutData: this.get(0x0028, 0x3006),
188
+ windowCenterAndWidthExplanation: this.get(0x0028, 0x1055),
189
+ };
190
+ }
191
+ getPatientModule() {
192
+ return {
193
+ patientName: this.get(0x0010, 0x0010),
194
+ patientID: this.get(0x0010, 0x0020),
195
+ typeofPatientID: this.get(0x0010, 0x0022),
196
+ patientSex: this.get(0x0010, 0x0040),
197
+ patientBirthDate: this.get(0x0010, 0x0030),
198
+ patientAge: this.get(0x0010, 0x1010),
199
+ patientSize: this.get(0x0010, 0x1020),
200
+ otherPatientIDs: this.get(0x0010, 0x1000),
201
+ otherPatientNames: this.get(0x0010, 0x1001),
202
+ patientWeight: this.get(0x0010, 0x1030),
203
+ };
204
+ }
205
+ getPixelModule() {
206
+ return {
207
+ photometricInterpretation: this.get(0x0028, 0x0004),
208
+ numberOfFrames: this.int(0x0028, 0x0008),
209
+ pixelRepresentation: this.int(0x0028, 0x0103),
210
+ pixeSpacing: this.get(0x0028, 0x0030),
211
+ rows: this.int(0x0028, 0x0010),
212
+ columns: this.int(0x0028, 0x0011),
213
+ bitsAllocated: this.int(0x0028, 0x0100),
214
+ highBit: this.int(0x0028, 0x0102),
215
+ bitsStored: this.int(0x0028, 0x0101),
216
+ samplesPerPixel: this.int(0x0028, 0x0002)
217
+ };
218
+ }
219
+ date(group, element) {
220
+ const dateValue = this.get(group, element);
221
+ if (/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/.exec(dateValue)) {
222
+ console.log('dateValue1', dateValue);
223
+ const dateVaues = dateValue.split('-');
224
+ return {
225
+ year: dateVaues[0],
226
+ month: dateVaues[1],
227
+ day: dateVaues[2],
228
+ };
229
+ }
230
+ console.log('dateValue', dateValue);
231
+ return dateValue;
232
+ }
233
+ time(group, element) {
234
+ const dateValue = this.get(group, element);
235
+ if (/^[0-9]{2}\:[0-9]{2}\:[0-9]{2}$/.exec(dateValue)) {
236
+ console.log('dateValue1', dateValue);
237
+ const dateVaues = dateValue.split(':');
238
+ return {
239
+ hour: dateVaues[0],
240
+ minute: dateVaues[1],
241
+ second: dateVaues[2],
242
+ };
243
+ }
244
+ console.log('dateValue', dateValue);
245
+ return dateValue;
172
246
  }
173
247
  int(group, element) {
174
- const is = this.getValue(group, element, "IS");
248
+ const is = this.get(group, element);
175
249
  if (typeof is === "number") {
176
250
  return is;
177
251
  }
@@ -235,5 +309,12 @@ class Dataset {
235
309
  }
236
310
  return Tag.intTo4digitString(input);
237
311
  }
312
+ draw(canvas) {
313
+ const pixelDatas = this.getPixelData();
314
+ if (pixelDatas) {
315
+ //@ts-ignore
316
+ Draw.draw(canvas, pixelDatas, this);
317
+ }
318
+ }
238
319
  }
239
320
  export default Dataset;
package/Draw.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import Dataset from "./Dataset";
2
+ import { PixelArray } from "./types";
3
+ declare class Draw {
4
+ static draw(canvas: HTMLCanvasElement, pixelDatas: PixelArray[], dataset: Dataset): void;
5
+ private static _getLUT;
6
+ private static _calcPixel;
7
+ }
8
+ export default Draw;
package/Draw.js ADDED
@@ -0,0 +1,54 @@
1
+ import Utilities from "./Utitlities";
2
+ class Draw {
3
+ static draw(canvas, pixelDatas, dataset) {
4
+ if (!pixelDatas.length)
5
+ return;
6
+ const pixelData = pixelDatas[0];
7
+ const { min, max, windowCenter, windowWidth } = Draw._getLUT(pixelData, dataset);
8
+ console.log('lut', min, max, windowCenter, windowWidth);
9
+ canvas.width = dataset.pixelModule.columns || 0;
10
+ canvas.height = dataset.pixelModule.rows || 0;
11
+ console.log(canvas.width * canvas.height, pixelData.length);
12
+ const context = canvas.getContext('2d');
13
+ const imageData = context === null || context === void 0 ? void 0 : context.createImageData(canvas.width, canvas.height);
14
+ if (imageData) {
15
+ for (var i = 0; i < pixelData.length; i++) {
16
+ imageData.data[4 * i] = Draw._calcPixel(pixelData[i], min, max, windowWidth, windowCenter);
17
+ imageData.data[4 * i + 1] = Draw._calcPixel(pixelData[i], min, max, windowWidth, windowCenter);
18
+ imageData.data[4 * i + 2] = Draw._calcPixel(pixelData[i], min, max, windowWidth, windowCenter);
19
+ imageData.data[4 * i + 3] = 255;
20
+ }
21
+ context === null || context === void 0 ? void 0 : context.putImageData(imageData, 0, 0);
22
+ }
23
+ }
24
+ static _getLUT(pixelData, dataset) {
25
+ if (dataset.voiLUTModule.windowCenter && dataset.voiLUTModule.windowWidth) {
26
+ const windowWidth = dataset.voiLUTModule.windowWidth;
27
+ const windowCenter = dataset.voiLUTModule.windowCenter;
28
+ return {
29
+ windowWidth,
30
+ windowCenter,
31
+ max: windowCenter - 0.5 + windowWidth / 2,
32
+ min: windowCenter - 0.5 - windowWidth / 2,
33
+ };
34
+ }
35
+ const { min, max } = Utilities.getMinMax(pixelData);
36
+ const windowWidth = max - min;
37
+ const windowCenter = min + windowWidth / 2 - 0.5;
38
+ return {
39
+ min,
40
+ max,
41
+ windowWidth,
42
+ windowCenter,
43
+ };
44
+ }
45
+ static _calcPixel(pixel, min, max, windowWidth, windowCenter) {
46
+ if (max <= pixel)
47
+ return 255;
48
+ else if (min >= pixel)
49
+ return 0;
50
+ else
51
+ return (Math.round(pixel - windowCenter - 0.5) / (windowWidth - 1) + 0.5) * 255;
52
+ }
53
+ }
54
+ export default Draw;
package/Parser.d.ts CHANGED
@@ -17,7 +17,7 @@ declare class Parser {
17
17
  constructor(arrayBuffer: ArrayBuffer);
18
18
  parse(): Dataset;
19
19
  getDataset(): Dataset | undefined;
20
- getNextTag(): void;
20
+ getNextElement(): void;
21
21
  getValue(len: number): ArrayBuffer;
22
22
  getNextGroupAndElement(): {
23
23
  group: number;
package/Parser.js CHANGED
@@ -38,7 +38,7 @@ class Parser {
38
38
  enumerable: true,
39
39
  configurable: true,
40
40
  writable: true,
41
- value: ["OB", "OW", "SQ", "UN"]
41
+ value: ["OB", "OW", "SQ", "UN", "UT"]
42
42
  });
43
43
  Object.defineProperty(this, "VRS", {
44
44
  enumerable: true,
@@ -116,7 +116,7 @@ class Parser {
116
116
  this.parse();
117
117
  }
118
118
  parse() {
119
- this.getNextTag();
119
+ this.getNextElement();
120
120
  this.dataSet = new Dataset(this.tags, this.dataView, this.littleEndian);
121
121
  console.log(this.dataSet);
122
122
  this.dataSet.transferSyntaxUID = this.transferSyntaxUID;
@@ -125,7 +125,7 @@ class Parser {
125
125
  getDataset() {
126
126
  return this.dataSet;
127
127
  }
128
- getNextTag() {
128
+ getNextElement() {
129
129
  if (this.offset >= this.arrayBuffer.byteLength) {
130
130
  return;
131
131
  }
@@ -135,7 +135,7 @@ class Parser {
135
135
  }
136
136
  if (group === 0xFFFE && (element === 0xE0DD || element === 0xE00D || element === 0xE000)) {
137
137
  this.offset += 4;
138
- return this.getNextTag();
138
+ return this.getNextElement();
139
139
  }
140
140
  if (!this.implicit && group !== 0x0002 && this.IMPLICT_TRANSFER_SYNTAXES.includes(this.transferSyntaxUID)) {
141
141
  this.implicit = true;
@@ -151,7 +151,7 @@ class Parser {
151
151
  this.arrayBuffer = this.concatArrayBuffers(meta, infaltedBody);
152
152
  this.dataView = new DataView(this.arrayBuffer);
153
153
  this.inflated = true;
154
- return this.getNextTag();
154
+ return this.getNextElement();
155
155
  }
156
156
  const vr = this.getNextVR(group, element);
157
157
  let len = 0;
@@ -173,25 +173,40 @@ class Parser {
173
173
  this.offset = 132;
174
174
  this.tags = {};
175
175
  this.implicit = true;
176
- return this.getNextTag();
176
+ return this.getNextElement();
177
177
  }
178
178
  else {
179
- console.log("ended", vr);
180
179
  return;
181
180
  }
182
181
  if (group === 0x0002 && element === 0x0010) {
183
- console.log("transfer syntax uid", this.transferSyntaxUID);
184
182
  this.transferSyntaxUID = (Value.getString(new Uint8Array(this.arrayBuffer, this.offset, len))).replace('\0', '');
185
183
  }
186
184
  const tag = new Tag(group, element, vr, len, this.offset);
187
185
  const key = tag.generateKey();
188
186
  this.tags[key] = tag;
187
+ if (len === 0xFFFFFFFF && group === 0x7FE0 && element === 0x0010) {
188
+ let { group, element } = this.getNextGroupAndElement();
189
+ while (true) {
190
+ if (group === 0xFFFE && element === 0xE000) {
191
+ const len = this.dataView.getUint32(this.offset, this.littleEndian);
192
+ this.offset += 4;
193
+ const t = this.getNextGroupAndElement();
194
+ group = t.group;
195
+ element = t.element;
196
+ this.offset += len;
197
+ }
198
+ else {
199
+ break;
200
+ }
201
+ }
202
+ this.offset -= 4;
203
+ }
189
204
  if (vr === "SQ") {
190
- this.getNextTag();
205
+ this.getNextElement();
191
206
  }
192
207
  else {
193
208
  this.offset += len;
194
- this.getNextTag();
209
+ this.getNextElement();
195
210
  }
196
211
  }
197
212
  getValue(len) {
@@ -212,6 +227,9 @@ class Parser {
212
227
  }
213
228
  }
214
229
  getNextVR(groupInt, elementInt) {
230
+ if (this.offset >= this.dataView.byteLength) {
231
+ return "";
232
+ }
215
233
  if (this.implicit) {
216
234
  return Tag.getTagVRFromDictionary(groupInt, elementInt) || "AA";
217
235
  }
package/PixelData.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import Dataset from "./Dataset";
2
+ declare class PixelData {
3
+ static get(dataset: Dataset): import("./types").PixelArray[];
4
+ private static _getUncompressed;
5
+ private static _getJPEG2000ImageCompression_LosslessOnly;
6
+ private static _getixelDataViews;
7
+ }
8
+ export default PixelData;
package/PixelData.js ADDED
@@ -0,0 +1,79 @@
1
+ import JPEG2000 from "./decoder/JPEG2000";
2
+ import UncompressDecoderr from "./decoder/Uncompressed";
3
+ class PixelData {
4
+ static get(dataset) {
5
+ const transferSyntaxUID = dataset.transferSyntaxUID;
6
+ switch (transferSyntaxUID) {
7
+ case "1.2.840.10008.1.2.4.90":
8
+ return PixelData._getJPEG2000ImageCompression_LosslessOnly(dataset);
9
+ case "1.2.840.10008.1.2":
10
+ case "1.2.840.10008.1.2.1":
11
+ case "1.2.840.10008.1.2.2":
12
+ case "1.2.840.10008.1.2.1.99":
13
+ default:
14
+ return PixelData._getUncompressed(dataset);
15
+ }
16
+ }
17
+ static _getUncompressed(dataset) {
18
+ const bitsAllocated = dataset.pixelModule.bitsAllocated || 1;
19
+ const pixelRepresentation = dataset.pixelModule.pixelRepresentation || 0;
20
+ const pixelDataViews = PixelData._getixelDataViews(dataset);
21
+ return pixelDataViews.map((dataView) => {
22
+ return UncompressDecoderr.decode({
23
+ pixelData: dataView,
24
+ bitsAllocated,
25
+ pixelRepresentation,
26
+ littleEndian: dataset.littleEndian,
27
+ });
28
+ });
29
+ }
30
+ static _getJPEG2000ImageCompression_LosslessOnly(dataset) {
31
+ const pixelDataViews = PixelData._getixelDataViews(dataset);
32
+ return pixelDataViews.map((dataView) => {
33
+ return JPEG2000.decode({
34
+ pixelData: dataView,
35
+ bitsAllocated: dataset.pixelModule.bitsAllocated || 1,
36
+ pixelRepresentation: dataset.pixelModule.pixelRepresentation || 0,
37
+ littleEndian: dataset.littleEndian,
38
+ });
39
+ });
40
+ }
41
+ static _getixelDataViews(dataset) {
42
+ const pixelData = dataset.tags['0x7FE00010'] || dataset.tags['0x7FE00008'] || dataset.tags['0x7FE00009'];
43
+ const pixelDatas = [];
44
+ const numberOfFrames = dataset.pixelModule.numberOfFrames || 1;
45
+ if (pixelData.valueLength === 0xFFFFFFFF) {
46
+ let offset = pixelData.offset;
47
+ while (true) {
48
+ if (offset >= dataset.dataView.byteLength) {
49
+ break;
50
+ }
51
+ const group = dataset.dataView.getUint16(offset, dataset.littleEndian);
52
+ offset += 2;
53
+ const element = dataset.dataView.getUint16(offset, dataset.littleEndian);
54
+ offset += 2;
55
+ if (group !== 0xFFFE && element !== 0xE000) {
56
+ break;
57
+ ;
58
+ }
59
+ const len = dataset.dataView.getUint32(offset, dataset.littleEndian);
60
+ offset += 4;
61
+ if (len !== 0) {
62
+ const dataView = new DataView(dataset.dataView.buffer, offset, len);
63
+ pixelDatas.push(dataView);
64
+ offset += len;
65
+ }
66
+ }
67
+ }
68
+ else {
69
+ const frameLen = pixelData.valueLength / numberOfFrames;
70
+ for (let i = 0; i < numberOfFrames; i++) {
71
+ const offset = pixelData.offset + (frameLen * i);
72
+ const dataView = new DataView(dataset.dataView.buffer, offset, frameLen);
73
+ pixelDatas.push(dataView);
74
+ }
75
+ }
76
+ return pixelDatas;
77
+ }
78
+ }
79
+ export default PixelData;
package/README.md CHANGED
@@ -5,8 +5,11 @@ npm i @abasb75/dicom-parser pako --save
5
5
  npm i @types/pako --save-dev
6
6
  ```
7
7
 
8
+ # Demo
8
9
 
9
- #Usage
10
+ <a href="https://abasb75.github.io/dicom-parser/">demo link</a>
11
+
12
+ # Usage
10
13
 
11
14
  1. For Download dicom and parse from url:
12
15
 
@@ -0,0 +1,12 @@
1
+ import { PixelArray } from "./types";
2
+ declare class Utilities {
3
+ static getMinMax(pixelData: PixelArray): {
4
+ min: number;
5
+ max: number;
6
+ };
7
+ static getLUTwithMinMax(min: number, max: number): {
8
+ windowWidth: number;
9
+ windowCenter: number;
10
+ };
11
+ }
12
+ export default Utilities;
package/Utitlities.js ADDED
@@ -0,0 +1,19 @@
1
+ class Utilities {
2
+ static getMinMax(pixelData) {
3
+ let min = pixelData[0];
4
+ let max = pixelData[0];
5
+ for (let i = 0; i < pixelData.length; i++) {
6
+ if (pixelData[i] < min)
7
+ min = pixelData[i];
8
+ if (pixelData[i] > max)
9
+ max = pixelData[i];
10
+ }
11
+ return { min, max };
12
+ }
13
+ static getLUTwithMinMax(min, max) {
14
+ const windowWidth = max - min;
15
+ const windowCenter = min + windowWidth / 2;
16
+ return { windowWidth, windowCenter };
17
+ }
18
+ }
19
+ export default Utilities;
package/Value.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  declare class Value {
2
- static byVr(dataView: DataView, offset: number, len: number, vr: string, littleEndian: boolean): string | number | (string | number)[] | undefined;
2
+ static byVr(dataView: DataView, offset: number, len: number, vr: string, littleEndian: boolean): string | number | DataView | (string | number)[] | undefined;
3
3
  static CS(dataView: DataView, offset: number, len: number): string | string[];
4
4
  static IS(dataView: DataView, offset: number, len: number): string | number;
5
5
  static DA(dataView: DataView, offset: number, len: number): string;
6
6
  static DS(dataView: DataView, offset: number, len: number): string | number | (string | number)[];
7
7
  static TM(dataView: DataView, offset: number, len: number): string;
8
- static getString(bytes: Uint8Array | Int8Array | ArrayBuffer): string;
9
8
  static US(dataView: DataView, offset: number, len: number, littleEndian?: boolean): number | undefined;
9
+ static OW(dataView: DataView, offset: number, len: number): DataView;
10
+ static getString(bytes: Uint8Array | Int8Array | ArrayBuffer): string;
10
11
  }
11
12
  export default Value;
package/Value.js CHANGED
@@ -13,6 +13,11 @@ class Value {
13
13
  return Value.DA(dataView, offset, len);
14
14
  case "TM":
15
15
  return Value.TM(dataView, offset, len);
16
+ case "OW":
17
+ case "OB":
18
+ case "OD":
19
+ case "OF":
20
+ return Value.OW(dataView, offset, len);
16
21
  case "UI":
17
22
  case "SH":
18
23
  case "LO":
@@ -50,10 +55,10 @@ class Value {
50
55
  static DS(dataView, offset, len) {
51
56
  let value = Value.getString(new Uint8Array(dataView.buffer, offset, len));
52
57
  const values = value.split("\\").map(v => {
53
- if (/^[0-9]+$/.exec(v)) {
58
+ if (/^[0-9\-\+]+$/.exec(v)) {
54
59
  return parseInt(v);
55
60
  }
56
- else if (/^[0-9]+\.[0-9]+$/.exec(v)) {
61
+ else if (/^[0-9\-\+]+\.[0-9]+$/.exec(v)) {
57
62
  return parseFloat(v);
58
63
  }
59
64
  return v;
@@ -81,14 +86,18 @@ class Value {
81
86
  }
82
87
  return `${value.slice(0, 2)}:${value.slice(2, 4)}:${value.slice(4, 6)}`;
83
88
  }
84
- static getString(bytes) {
85
- const decoder = new TextDecoder();
86
- return decoder.decode(bytes).trim();
87
- }
88
89
  static US(dataView, offset, len, littleEndian = true) {
89
90
  if (len === 2) {
90
91
  return dataView.getUint16(offset, littleEndian);
91
92
  }
92
93
  }
94
+ static OW(dataView, offset, len) {
95
+ const buffer = dataView.buffer.slice(offset, len);
96
+ return new DataView(buffer);
97
+ }
98
+ static getString(bytes) {
99
+ const decoder = new TextDecoder();
100
+ return decoder.decode(bytes).trim();
101
+ }
93
102
  }
94
103
  export default Value;
@@ -0,0 +1,5 @@
1
+ import { PixelDataDecodeOptions } from "../types";
2
+ declare class JPEG2000 {
3
+ static decode(options: PixelDataDecodeOptions): Uint8Array;
4
+ }
5
+ export default JPEG2000;
@@ -0,0 +1,10 @@
1
+ class JPEG2000 {
2
+ static decode(options) {
3
+ console.log("ddss");
4
+ // let arrayBuffer = options.pixelData.buffer;
5
+ // let offset = options.pixelData.byteOffset;
6
+ // const length = options.pixelData.byteLength;
7
+ return new Uint8Array(options.pixelData.buffer);
8
+ }
9
+ }
10
+ export default JPEG2000;
@@ -0,0 +1,6 @@
1
+ import { PixelArray, PixelDataDecodeOptions } from "../types";
2
+ declare class UncompressDecoderr {
3
+ static decode(options: PixelDataDecodeOptions): PixelArray;
4
+ private static _endianFixer;
5
+ }
6
+ export default UncompressDecoderr;
@@ -0,0 +1,57 @@
1
+ class UncompressDecoderr {
2
+ static decode(options) {
3
+ let arrayBuffer = options.pixelData.buffer;
4
+ let offset = options.pixelData.byteOffset;
5
+ const length = options.pixelData.byteLength;
6
+ switch (options.bitsAllocated) {
7
+ case 8:
8
+ return UncompressDecoderr._endianFixer(new Uint8Array(arrayBuffer, offset, length), !options.littleEndian);
9
+ case 16:
10
+ if (options.pixelRepresentation === 0) {
11
+ return UncompressDecoderr._endianFixer(new Uint16Array(arrayBuffer, offset, length / 2), !options.littleEndian);
12
+ }
13
+ else {
14
+ return UncompressDecoderr._endianFixer(new Int16Array(arrayBuffer, offset, length / 2), !options.littleEndian);
15
+ }
16
+ case 32:
17
+ return UncompressDecoderr._endianFixer(new Float32Array(arrayBuffer, offset, length / 4), !options.littleEndian);
18
+ default:
19
+ return new Uint8Array(arrayBuffer);
20
+ }
21
+ }
22
+ static _endianFixer(data, bigEndian = false) {
23
+ if (!bigEndian) {
24
+ return data;
25
+ }
26
+ if (data instanceof Uint16Array) {
27
+ const _data = new Uint16Array(data.length);
28
+ for (let i = 0; i < _data.length; i++) {
29
+ _data[i] = ((data[i] & 0xFF) << 8) | ((data[i] >> 8) & 0xF);
30
+ }
31
+ return _data;
32
+ }
33
+ else if (data instanceof Int16Array) {
34
+ const _data = new Int16Array(data.length);
35
+ for (let i = 0; i < _data.length; i++) {
36
+ _data[i] = ((data[i] & 0xFF) << 8) | ((data[i] >> 8) & 0xF);
37
+ }
38
+ return _data;
39
+ }
40
+ else if (data instanceof Uint32Array) {
41
+ const _data = new Uint32Array(data.length);
42
+ for (let i = 0; i < _data.length; i++) {
43
+ _data[i] = ((data[i] & 0xFF) << 24) | ((data[i] & 0xFF00) << 8) | ((data[i] >> 8) & 0xFF00) | ((data[i] >> 24) & 0xFF);
44
+ }
45
+ return _data;
46
+ }
47
+ else if (data instanceof Float32Array) {
48
+ const _data = new Float32Array(data.length);
49
+ for (let i = 0; i < _data.length; i++) {
50
+ _data[i] = ((data[i] & 0xFF) << 24) | ((data[i] & 0xFF00) << 8) | ((data[i] >> 8) & 0xFF00) | ((data[i] >> 24) & 0xFF);
51
+ }
52
+ return _data;
53
+ }
54
+ return data;
55
+ }
56
+ }
57
+ export default UncompressDecoderr;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abasb75/dicom-parser",
3
- "version": "0.0.4-test",
3
+ "version": "0.0.6-test",
4
4
  "description": "a javascript powerfull dicom parser",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1 +1 @@
1
- {"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../lib/enums/TagsDictionary.ts","../lib/Tag.ts","../lib/Value.ts","../lib/types.ts","../lib/Dataset.ts","../lib/Loader.ts","../node_modules/@types/pako/index.d.ts","../lib/Parser.ts","../lib/index.ts","../lib/enums/TransferSyntax.ts","../lib/enums/ValueRepresentations.ts","../lib/enums/index.ts","../node_modules/@types/babel__generator/index.d.ts","../node_modules/@types/babel__template/index.d.ts","../node_modules/@types/babel__traverse/index.d.ts","../node_modules/@types/babel__core/index.d.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/react/global.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/react-dom/index.d.ts"],"fileIdsList":[[48,49,50],[48,49,50,51,53],[47],[47,56,57],[51,52,54],[48],[59,60,61],[67],[65,66]],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"9e8ca8ed051c2697578c023d9c29d6df689a083561feba5c14aedee895853999","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"45d8ccb3dfd57355eb29749919142d4321a0aa4df6acdfc54e30433d7176600a","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true,"impliedFormat":1},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1a94697425a99354df73d9c8291e2ecd4dddd370aed4023c2d6dee6cccb32666","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3f9fc0ec0b96a9e642f11eda09c0be83a61c7b336977f8b9fdb1e9788e925fe","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1a54cf04ef34193424ed4374da8b8300c3f05829fe02f21d00a8c9f2dda13965","signature":"b124ca3b0b6e48c7ae570631e8af5f9587cd0000865693dd1325cb3163d92e8f"},{"version":"7746e02e44db43052b746d21998931cfb9af842a9e54053f467cd48a041bb830","signature":"1509f37c18c1c390bc2f0a08511625572c613ad7e53bcca00e02016ecfea1ff3"},{"version":"1d1895d49be4ada1a967f2f2f99d9ceb73b9fd3f283114bf1b39edf5c08524e8","signature":"29da1fa0bfca74d228fb5e95b5d4a824d6f489fb24262cd4e8539591ced9967c"},{"version":"f8f659c3b0f336fc360a8604c7c64328ec58c6df95024766d65a6febf142a02d","signature":"735d34369ba5d1295c1dde93ef8878318db5e9e2be2d783a711ae61d1a8887f8"},{"version":"130d9a8b709cb2dd6b6fd5d15a8dc9919041e4afa06c455b9b461e09350b4af3","signature":"66effe24e406929759b5deb592cd1e878590718a2869fd62957e4592127c347d"},{"version":"32f9f84ef917e854b4b034645f85a7e03a69548b0846a7dbb00a6b4801c8046f","signature":"7083058286797f935bc66ce1274db6767cfe3bdd675fdb199b695d01c36b8857"},{"version":"c634df3e1b52761b2a219edcc61d0a7f748cdc54b93d73bcb817619452a6388a","impliedFormat":1},{"version":"d0df8bed22bd18d627936dbc1540241869a24e7df8aa94e06285efdd5a2df4a5","signature":"8d568074d2bdf70de874a842f07ad08c3e4af007902a9f05a646183b1895d796"},{"version":"3aa25c0ae1cb6e6084a349e0a005dac5c575152aa0796dfa393bd445deef1887","signature":"44d6d909bc8629077cb14adc03ea3224c33cd013a841b04b88d2e0f485cae669"},{"version":"c68e5454d34ab562a6c66c01c4cc0ff39fe0723eae7fa8c95ae971bcf210660a","signature":"0792e447fd7b9f38b2e024f0eff028360b349808f095ce1447e12630b7c51ba5"},{"version":"dd0a75aaecb752ffbcbdb9f3ba2f4e902c02116424eec0d7eff0f0f18da0ed51","signature":"20efc731db8ebf52d9aca41a6ba5b043f2892d1609a1a6d1dddfb3bc9d793195"},{"version":"d9165616db0fddaae02047917430126ea9ef81695f9b20ed301e6f0f9484a3f8","signature":"316a713040ee41af01a42db63819f6f529877e99471de6759d64ca9c8e64ea5f"},{"version":"2c8e55457aaf4902941dfdba4061935922e8ee6e120539c9801cd7b400fae050","impliedFormat":1},{"version":"670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","impliedFormat":1},{"version":"9e0cf651e8e2c5b9bebbabdff2f7c6f8cedd91b1d9afcc0a854cdff053a88f1b","impliedFormat":1},{"version":"069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","impliedFormat":1},{"version":"785b9d575b49124ce01b46f5b9402157c7611e6532effa562ac6aebec0074dfc","impliedFormat":1},{"version":"f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","impliedFormat":1},{"version":"ed6b820c54de95b2510bb673490d61c7f2187f532a339d8d04981645a918961f","impliedFormat":1},{"version":"36a2e4c9a67439aca5f91bb304611d5ae6e20d420503e96c230cf8fcdc948d94","affectsGlobalScope":true,"impliedFormat":1},{"version":"aa17748c522bd586f8712b1a308ea23af59c309b2fd278f6d4f406647c72e659","affectsGlobalScope":true,"impliedFormat":1},{"version":"17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","impliedFormat":1}],"root":[[47,52],[54,58]],"options":{"allowImportingTsExtensions":false,"composite":true,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":2,"useDefineForClassFields":true},"referencedMap":[[51,1],[54,2],[48,3],[58,4],[55,5],[50,6],[62,7],[68,8],[67,9]],"latestChangedDtsFile":"./enums/index.d.ts","version":"5.6.3"}
1
+ {"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../lib/enums/TagsDictionary.ts","../lib/Tag.ts","../lib/types.ts","../lib/Utitlities.ts","../lib/Draw.ts","../lib/decoder/JPEG2000.ts","../lib/decoder/Uncompressed.ts","../lib/PixelData.ts","../lib/Value.ts","../lib/Dataset.ts","../lib/Loader.ts","../node_modules/@types/pako/index.d.ts","../lib/Parser.ts","../lib/index.ts","../lib/decoder/decodes/jpx.ts","../lib/enums/TransferSyntax.ts","../lib/enums/ValueRepresentations.ts","../lib/enums/index.ts","../node_modules/@types/babel__generator/index.d.ts","../node_modules/@types/babel__template/index.d.ts","../node_modules/@types/babel__traverse/index.d.ts","../node_modules/@types/babel__core/index.d.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/react/global.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/react-dom/index.d.ts"],"fileIdsList":[[48,49,51,54,55],[49,50,56],[48,49,55,56,58],[52,53,56],[47],[49],[47,62,63],[56,57,59],[48,56],[65,66,67],[73],[71,72]],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"9e8ca8ed051c2697578c023d9c29d6df689a083561feba5c14aedee895853999","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"45d8ccb3dfd57355eb29749919142d4321a0aa4df6acdfc54e30433d7176600a","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true,"impliedFormat":1},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1a94697425a99354df73d9c8291e2ecd4dddd370aed4023c2d6dee6cccb32666","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3f9fc0ec0b96a9e642f11eda09c0be83a61c7b336977f8b9fdb1e9788e925fe","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1a54cf04ef34193424ed4374da8b8300c3f05829fe02f21d00a8c9f2dda13965","signature":"b124ca3b0b6e48c7ae570631e8af5f9587cd0000865693dd1325cb3163d92e8f"},{"version":"7746e02e44db43052b746d21998931cfb9af842a9e54053f467cd48a041bb830","signature":"1509f37c18c1c390bc2f0a08511625572c613ad7e53bcca00e02016ecfea1ff3"},{"version":"687a3297f1acfffc06d75d0827c7998c6c3303a681eb8ff30323c89fdc35812b","signature":"f8ef27ef14f001fe01f7e6010dabd4920a83706a9758254e4d5735b814cb4043"},{"version":"11d43eca18ed5b9f9c95a1b8cb12ae743a067c64fc84c945427d5112d8320df8","signature":"32ffa9cb15a3f8e5f6e8e676f5b7ff8b91a516a68ff68ad0ea4a8373f0f165dd"},{"version":"025c0ed1b2e5384b6c6aa95db1200a7843a7b8147a0d4e9bb9bfc217e036ef07","signature":"337497e993d61a0e857d36e05960fa7ee760b99103dea76f9f44f7cd8b6848e8"},{"version":"1c94e9bb97121f53595f91bc25ca3554f978cc883201325f5e03e459d13c0443","signature":"d56f2e56e2b010984b5fdf9cc8d36165f2a8344f83a740ecb4064c5bff426909"},{"version":"9533e67ae7260a16cf3587714b973c512391d6901935b01f11cf922e69059334","signature":"31e48fa6d999f48c86bf6098b270d1f3e6103b873d90c003421e91909a9d78ed"},{"version":"9d9cbbcb26fe2aac0428a6678b6fa19c5318f11738037987360a93d74f84c9f3","signature":"ad9b6d143dbd163448180f69fcb013f031b8a458e574286acb936212f7112beb"},{"version":"d73868e3b2525fd8e9d060ad7fb2e9a48769e392e8a1a0ddaa343fa2114547e5","signature":"fb73d8bf11deadc8420b5263b761cd72a2c479c1a5348e66ff0368fa7d046bf8"},{"version":"4aa184d1ff02d47f484139461fe242bc6e80b44c554c519cc559bef3f1d56aaf","signature":"d1bdde42c3c4aced65d1732f13880aec4958271c6f33f5c8abc14f5e512d2795"},{"version":"32f9f84ef917e854b4b034645f85a7e03a69548b0846a7dbb00a6b4801c8046f","signature":"7083058286797f935bc66ce1274db6767cfe3bdd675fdb199b695d01c36b8857"},{"version":"c634df3e1b52761b2a219edcc61d0a7f748cdc54b93d73bcb817619452a6388a","impliedFormat":1},{"version":"3b80de10a2a1b0707b4703db4f7b6076ee348782131d81e8fc36adbbcd7d4ed4","signature":"041705ec5f7b5f8a7ca8d2e81a466dff4a00a7898db988fbd9b481375d64d8c4"},{"version":"3aa25c0ae1cb6e6084a349e0a005dac5c575152aa0796dfa393bd445deef1887","signature":"44d6d909bc8629077cb14adc03ea3224c33cd013a841b04b88d2e0f485cae669"},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"c68e5454d34ab562a6c66c01c4cc0ff39fe0723eae7fa8c95ae971bcf210660a","signature":"0792e447fd7b9f38b2e024f0eff028360b349808f095ce1447e12630b7c51ba5"},{"version":"dd0a75aaecb752ffbcbdb9f3ba2f4e902c02116424eec0d7eff0f0f18da0ed51","signature":"20efc731db8ebf52d9aca41a6ba5b043f2892d1609a1a6d1dddfb3bc9d793195"},{"version":"d9165616db0fddaae02047917430126ea9ef81695f9b20ed301e6f0f9484a3f8","signature":"316a713040ee41af01a42db63819f6f529877e99471de6759d64ca9c8e64ea5f"},{"version":"2c8e55457aaf4902941dfdba4061935922e8ee6e120539c9801cd7b400fae050","impliedFormat":1},{"version":"670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","impliedFormat":1},{"version":"9e0cf651e8e2c5b9bebbabdff2f7c6f8cedd91b1d9afcc0a854cdff053a88f1b","impliedFormat":1},{"version":"069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","impliedFormat":1},{"version":"785b9d575b49124ce01b46f5b9402157c7611e6532effa562ac6aebec0074dfc","impliedFormat":1},{"version":"f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","impliedFormat":1},{"version":"ed6b820c54de95b2510bb673490d61c7f2187f532a339d8d04981645a918961f","impliedFormat":1},{"version":"36a2e4c9a67439aca5f91bb304611d5ae6e20d420503e96c230cf8fcdc948d94","affectsGlobalScope":true,"impliedFormat":1},{"version":"aa17748c522bd586f8712b1a308ea23af59c309b2fd278f6d4f406647c72e659","affectsGlobalScope":true,"impliedFormat":1},{"version":"17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","impliedFormat":1}],"root":[[47,57],[59,64]],"options":{"allowImportingTsExtensions":false,"composite":true,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":2,"useDefineForClassFields":true},"referencedMap":[[56,1],[51,2],[59,3],[54,4],[48,5],[50,6],[52,6],[53,6],[64,7],[60,8],[49,9],[68,10],[74,11],[73,12]],"latestChangedDtsFile":"./enums/index.d.ts","version":"5.6.3"}
package/types.d.ts CHANGED
@@ -1,5 +1,60 @@
1
+ import Dataset from "./Dataset";
1
2
  import Tag from "./Tag";
2
3
  interface Tags {
3
4
  [key: string]: Tag;
4
5
  }
5
- export type { Tags, };
6
+ interface DicomDate {
7
+ year: string | number;
8
+ month: string | number;
9
+ day: string | number;
10
+ }
11
+ interface DicomTime {
12
+ hour: string | number;
13
+ minute: string | number;
14
+ second: string | number;
15
+ }
16
+ interface DicomDateTime extends DicomDate, DicomTime {
17
+ }
18
+ type DicomDataset = Dataset;
19
+ type PixelArray = Int16Array | Uint16Array | Int32Array | Uint32Array | Int8Array | Uint8Array | Float32Array;
20
+ interface DicomVOILutModule {
21
+ voiLUTFunction: string;
22
+ windowWidth: number | undefined;
23
+ windowCenter: number | undefined;
24
+ voiLUTSequence: unknown;
25
+ lutDescriptor: any;
26
+ lutExplanation: any;
27
+ lutData: any;
28
+ windowCenterAndWidthExplanation: string;
29
+ }
30
+ interface DicomPatientModule {
31
+ patientName: string;
32
+ patientID: string;
33
+ typeofPatientID: string;
34
+ patientSex: string;
35
+ patientBirthDate: string;
36
+ patientAge: string;
37
+ patientSize: string;
38
+ otherPatientIDs: string;
39
+ otherPatientNames: string;
40
+ patientWeight: string;
41
+ }
42
+ interface DicomPixelModule {
43
+ photometricInterpretation: string;
44
+ numberOfFrames: number | undefined;
45
+ pixelRepresentation: number | undefined;
46
+ pixeSpacing: any | undefined;
47
+ rows: number | number | undefined;
48
+ columns: number | number | undefined;
49
+ bitsAllocated: number | undefined;
50
+ highBit: number | undefined;
51
+ bitsStored: number | undefined;
52
+ samplesPerPixel: number | undefined;
53
+ }
54
+ interface PixelDataDecodeOptions {
55
+ pixelData: DataView;
56
+ bitsAllocated: number;
57
+ pixelRepresentation: number;
58
+ littleEndian: boolean;
59
+ }
60
+ export type { Tags, DicomTime, DicomDate, DicomDateTime, DicomDataset, DicomVOILutModule, DicomPatientModule, DicomPixelModule, PixelArray, PixelDataDecodeOptions, };