@dcmjs-org/imaging 0.0.0-bootstrap.0 → 1.0.0-beta.3

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.
@@ -0,0 +1,550 @@
1
+ // test/buildImageDataset.test.js
2
+ //
3
+ // buildImageDataset: decoded pixels -> a conformant naturalized image
4
+ // dataset, with the options of encapsulate. The load-bearing rules: the
5
+ // geometry comes from the pixels, and derivedFrom yields a DERIVED\SECONDARY
6
+ // result with a new SOPInstanceUID.
7
+
8
+ import {
9
+ combineBases,
10
+ DATA_LEVELS,
11
+ extendDataLevels,
12
+ log,
13
+ predecessorBase,
14
+ validationLog
15
+ } from "@dcmjs-org/core";
16
+ import {
17
+ buildImageDataset,
18
+ derivedImageAttributes,
19
+ derivedImageBase,
20
+ imageBase,
21
+ SECONDARY_CAPTURE_SOP_CLASS_UID
22
+ } from "../src/index.js";
23
+
24
+ validationLog.setLevel(5);
25
+
26
+ const MR_SOP_CLASS_UID = "1.2.840.10008.5.1.4.1.1.4";
27
+ const SOURCE_SOP_INSTANCE_UID = "2.25.111222333444";
28
+
29
+ function grayPixels(rows = 4, columns = 4) {
30
+ return {
31
+ pixels: new Uint8Array(rows * columns).fill(128),
32
+ rows,
33
+ columns
34
+ };
35
+ }
36
+
37
+ describe("createInstance options", () => {
38
+ test("instance and dataLevel place the image in an existing series", () => {
39
+ const source = {
40
+ PatientID: "P1",
41
+ StudyInstanceUID: "2.25.1",
42
+ SeriesInstanceUID: "2.25.2",
43
+ SOPClassUID: SECONDARY_CAPTURE_SOP_CLASS_UID,
44
+ SOPInstanceUID: "2.25.3",
45
+ Modality: "OT"
46
+ };
47
+ const dataset = buildImageDataset(grayPixels(), {
48
+ instance: source,
49
+ dataLevel: "series",
50
+ predecessor: true
51
+ });
52
+ expect(dataset.PatientID).toBe("P1");
53
+ expect(dataset.StudyInstanceUID).toBe("2.25.1");
54
+ expect(dataset.SeriesInstanceUID).toBe("2.25.2");
55
+ expect(dataset.SOPInstanceUID).not.toBe("2.25.3");
56
+ // imageBase has no predecessorBase (IMG-USR-10).
57
+ expect(dataset).not.toHaveProperty("PredecessorDocumentsSequence");
58
+ expect(dataset.instance).toBeUndefined();
59
+ expect(dataset.dataLevel).toBeUndefined();
60
+
61
+ // A caller adds predecessorBase to the base (CORE-USR-9).
62
+ const replacement = buildImageDataset(grayPixels(), {
63
+ baseDicom: combineBases(imageBase, predecessorBase),
64
+ instance: source,
65
+ dataLevel: "series",
66
+ predecessor: true
67
+ });
68
+ expect(
69
+ replacement.PredecessorDocumentsSequence[0]
70
+ .ReferencedSeriesSequence[0].ReferencedSOPSequence[0]
71
+ .ReferencedSOPInstanceUID
72
+ ).toBe("2.25.3");
73
+ });
74
+ });
75
+
76
+ describe("defaults (no instance)", () => {
77
+ const dataset = buildImageDataset(grayPixels());
78
+
79
+ test("Secondary Capture scaffold with minted UIDs", () => {
80
+ expect(dataset.SOPClassUID).toBe(SECONDARY_CAPTURE_SOP_CLASS_UID);
81
+ expect(dataset.SOPInstanceUID).toMatch(/^2\.25\./);
82
+ expect(dataset.StudyInstanceUID).toMatch(/^2\.25\./);
83
+ expect(dataset.SeriesInstanceUID).toMatch(/^2\.25\./);
84
+ expect(dataset.Modality).toBe("OT");
85
+ expect(dataset.ConversionType).toBe("WSD");
86
+ expect(dataset.ImageType).toEqual(["ORIGINAL", "PRIMARY"]);
87
+ });
88
+
89
+ test("Type-2 patient/study attributes are present and empty", () => {
90
+ for (const keyword of [
91
+ "PatientName",
92
+ "PatientID",
93
+ "PatientBirthDate",
94
+ "PatientSex",
95
+ "AccessionNumber",
96
+ "StudyID"
97
+ ]) {
98
+ expect(dataset[keyword]).toBe("");
99
+ }
100
+ });
101
+
102
+ // API: the builder writes only the geometry that the decoded input
103
+ // gives, and invents no default (IMG-USR-2).
104
+ test("only the decoded geometry, with no invented defaults", () => {
105
+ expect(dataset.Rows).toBe(4);
106
+ expect(dataset.Columns).toBe(4);
107
+ expect(dataset.BitsAllocated).toBe(8);
108
+ for (const keyword of [
109
+ "SamplesPerPixel",
110
+ "PhotometricInterpretation",
111
+ "BitsStored",
112
+ "HighBit",
113
+ "PixelRepresentation"
114
+ ]) {
115
+ expect(dataset[keyword]).toBeUndefined();
116
+ }
117
+ expect(dataset.PlanarConfiguration).toBeUndefined();
118
+ expect(dataset.NumberOfFrames).toBeUndefined();
119
+ expect(dataset._vrMap.PixelData).toBe("OB");
120
+ expect(dataset.PixelData.byteLength).toBe(16);
121
+ });
122
+ });
123
+
124
+ describe("decoded geometry replaces, absent geometry stays", () => {
125
+ // User experience: a caller that decodes only the size and the pixels
126
+ // keeps the photometric attributes of the series or of an override,
127
+ // and the decoded values replace the overrides (IMG-USR-2).
128
+ test("decoded Rows/Columns/BitsAllocated replace; the rest stays", () => {
129
+ const dataset = buildImageDataset(grayPixels(4, 4), {
130
+ instance: {
131
+ StudyInstanceUID: "1.2.3.4",
132
+ SeriesInstanceUID: "1.2.3.4.1",
133
+ Rows: 999,
134
+ PhotometricInterpretation: "MONOCHROME1"
135
+ },
136
+ dataLevel: "series",
137
+ levels: extendDataLevels(DATA_LEVELS, {
138
+ series: ["Rows", "PhotometricInterpretation"]
139
+ }),
140
+ overrides: {
141
+ Columns: 8,
142
+ BitsAllocated: 16,
143
+ SamplesPerPixel: 1,
144
+ BitsStored: 7
145
+ }
146
+ });
147
+ expect([
148
+ dataset.Rows,
149
+ dataset.Columns,
150
+ dataset.BitsAllocated,
151
+ dataset.PhotometricInterpretation,
152
+ dataset.SamplesPerPixel,
153
+ dataset.BitsStored,
154
+ dataset.HighBit
155
+ ]).toEqual([4, 4, 8, "MONOCHROME1", 1, 7, undefined]);
156
+ });
157
+
158
+ // API: an override or a base value without a decoded value stays, and
159
+ // the decoded values replace the base values (IMG-USR-2).
160
+ test("overrides MONOCHROME1 and BitsStored 12 stay over 16-bit pixels", () => {
161
+ const dataset = buildImageDataset(
162
+ { pixels: new Uint16Array(2 * 3), rows: 2, columns: 3 },
163
+ {
164
+ baseDicom: combineBases(imageBase, {
165
+ Rows: 512,
166
+ BitsAllocated: 8,
167
+ SamplesPerPixel: 1,
168
+ PixelRepresentation: 0
169
+ }),
170
+ overrides: {
171
+ PhotometricInterpretation: "MONOCHROME1",
172
+ BitsStored: 12
173
+ }
174
+ }
175
+ );
176
+ expect([
177
+ dataset.Rows,
178
+ dataset.Columns,
179
+ dataset.BitsAllocated,
180
+ dataset.PhotometricInterpretation,
181
+ dataset.BitsStored,
182
+ dataset.SamplesPerPixel,
183
+ dataset.PixelRepresentation,
184
+ dataset.HighBit,
185
+ dataset._vrMap.PixelData
186
+ ]).toEqual([2, 3, 16, "MONOCHROME1", 12, 1, 0, undefined, "OW"]);
187
+ });
188
+
189
+ // API: the checks use the final values, also the values of overrides.
190
+ test("an override SamplesPerPixel that disagrees with the pixels throws", () => {
191
+ expect(() =>
192
+ buildImageDataset(grayPixels(4, 4), {
193
+ overrides: { SamplesPerPixel: 3 }
194
+ })
195
+ ).toThrow(/16 bytes but 4x4x3 at 8 bits needs 48/);
196
+ });
197
+ });
198
+
199
+ describe("16-bit and color", () => {
200
+ // API: a decoded bitsStored without highBit gives HighBit = bitsStored - 1.
201
+ test("Uint16Array yields 16-bit OW", () => {
202
+ const dataset = buildImageDataset({
203
+ pixels: new Uint16Array(4 * 4),
204
+ rows: 4,
205
+ columns: 4,
206
+ bitsStored: 12
207
+ });
208
+ expect(dataset.BitsAllocated).toBe(16);
209
+ expect(dataset.BitsStored).toBe(12);
210
+ expect(dataset.HighBit).toBe(11);
211
+ expect(dataset._vrMap.PixelData).toBe("OW");
212
+ });
213
+
214
+ test("Int16Array defaults to signed PixelRepresentation", () => {
215
+ const dataset = buildImageDataset({
216
+ pixels: new Int16Array(4),
217
+ rows: 2,
218
+ columns: 2
219
+ });
220
+ expect(dataset.PixelRepresentation).toBe(1);
221
+ // API: a signed 32-bit array is also signed (IMG-USR-2).
222
+ expect(
223
+ buildImageDataset({
224
+ pixels: new Int32Array(4),
225
+ rows: 2,
226
+ columns: 2
227
+ }).PixelRepresentation
228
+ ).toBe(1);
229
+ });
230
+
231
+ test("RGB emits PlanarConfiguration", () => {
232
+ const dataset = buildImageDataset({
233
+ pixels: new Uint8Array(2 * 2 * 3),
234
+ rows: 2,
235
+ columns: 2,
236
+ samplesPerPixel: 3,
237
+ photometricInterpretation: "RGB",
238
+ planarConfiguration: 0
239
+ });
240
+ expect(dataset.PhotometricInterpretation).toBe("RGB");
241
+ expect(dataset.PlanarConfiguration).toBe(0);
242
+ });
243
+ });
244
+
245
+ describe("validation", () => {
246
+ test("pixel length mismatch reports expected vs actual", () => {
247
+ expect(() =>
248
+ buildImageDataset({
249
+ pixels: new Uint8Array(10),
250
+ rows: 4,
251
+ columns: 4,
252
+ samplesPerPixel: 1
253
+ })
254
+ ).toThrow(/10 bytes but 4x4x1 at 8 bits needs 16/);
255
+ });
256
+
257
+ test("bitsAllocated / typed-array mismatch throws", () => {
258
+ expect(() =>
259
+ buildImageDataset({
260
+ pixels: new Uint8Array(16),
261
+ rows: 4,
262
+ columns: 4,
263
+ bitsAllocated: 16
264
+ })
265
+ ).toThrow(/does not match the 8-bit typed array/);
266
+ // API: float pixels throw, and write no integer pixels (IMG-USR-9).
267
+ expect(() =>
268
+ buildImageDataset({
269
+ pixels: new Float32Array(4),
270
+ rows: 2,
271
+ columns: 2
272
+ })
273
+ ).toThrow(/needs an integer typed array/);
274
+ });
275
+
276
+ test("photometric vs samplesPerPixel mismatch throws", () => {
277
+ expect(() =>
278
+ buildImageDataset({
279
+ pixels: new Uint8Array(16),
280
+ rows: 4,
281
+ columns: 4,
282
+ samplesPerPixel: 1,
283
+ photometricInterpretation: "RGB"
284
+ })
285
+ ).toThrow(/RGB requires samplesPerPixel 3/);
286
+ });
287
+
288
+ test("pixels plus encapsulated throws", () => {
289
+ expect(() =>
290
+ buildImageDataset(grayPixels(), {
291
+ encapsulated: {
292
+ transferSyntaxUID: "1.2.840.10008.1.2.4.50",
293
+ frames: [new Uint8Array(4)]
294
+ }
295
+ })
296
+ ).toThrow(/not both/);
297
+ });
298
+ });
299
+
300
+ describe("overrides", () => {
301
+ // API: an override beats the value inherited from instance.
302
+ test("keyword overrides beat instance", () => {
303
+ const dataset = buildImageDataset(grayPixels(), {
304
+ instance: { PatientID: "998877", StudyInstanceUID: "1.2.3.4" },
305
+ overrides: { PatientID: "22446688", PatientName: "FOX^JANE" }
306
+ });
307
+ expect(dataset.StudyInstanceUID).toBe("1.2.3.4");
308
+ expect(dataset.PatientID).toBe("22446688");
309
+ expect(dataset.PatientName).toBe("FOX^JANE");
310
+ // API: an undefined override removes ConversionType (IMG-USR-5).
311
+ expect(
312
+ buildImageDataset(grayPixels(), {
313
+ overrides: { ConversionType: undefined }
314
+ })
315
+ ).not.toHaveProperty("ConversionType");
316
+ // API: Rows and Columns come from the merged dataset when the
317
+ // decoded image does not give them (IMG-USR-9).
318
+ expect(
319
+ buildImageDataset(
320
+ { pixels: new Uint8Array(6) },
321
+ { overrides: { Rows: 2, Columns: 3 } }
322
+ ).Rows
323
+ ).toBe(2);
324
+ });
325
+ });
326
+
327
+ describe("derived-instance conformance", () => {
328
+ const source = {
329
+ SOPClassUID: MR_SOP_CLASS_UID,
330
+ SOPInstanceUID: SOURCE_SOP_INSTANCE_UID,
331
+ Modality: "MR",
332
+ StudyInstanceUID: "1.2.3.4"
333
+ };
334
+
335
+ // User experience: a derived image references its source and never
336
+ // reuses the source identity.
337
+ test("derivedFrom gives a DERIVED\\SECONDARY image that references the source", () => {
338
+ const dataset = buildImageDataset(grayPixels(), {
339
+ instance: source,
340
+ derivedFrom: source
341
+ });
342
+ expect(dataset.StudyInstanceUID).toBe("1.2.3.4");
343
+ expect(dataset.SOPInstanceUID).not.toBe(SOURCE_SOP_INSTANCE_UID);
344
+ expect(dataset.SOPClassUID).toBe(SECONDARY_CAPTURE_SOP_CLASS_UID);
345
+ expect(dataset.ImageType).toEqual(["DERIVED", "SECONDARY"]);
346
+ expect(dataset.SourceImageSequence).toEqual([
347
+ {
348
+ ReferencedSOPClassUID: MR_SOP_CLASS_UID,
349
+ ReferencedSOPInstanceUID: SOURCE_SOP_INSTANCE_UID
350
+ }
351
+ ]);
352
+ expect(dataset.LossyImageCompression).toBe("01");
353
+ });
354
+
355
+ // API: an override ImageType wins over the derived default.
356
+ test("an override ImageType wins with derivedFrom", () => {
357
+ const dataset = buildImageDataset(grayPixels(), {
358
+ derivedFrom: [source],
359
+ overrides: { ImageType: ["DERIVED", "PRIMARY"] }
360
+ });
361
+ expect(dataset.ImageType).toEqual(["DERIVED", "PRIMARY"]);
362
+ expect(dataset.SourceImageSequence).toHaveLength(1);
363
+ });
364
+
365
+ // API: the lossy option sets the Lossy Image Compression attributes.
366
+ test("lossy: false marks a lossless derivation", () => {
367
+ const dataset = buildImageDataset(grayPixels(), {
368
+ derivedFrom: source,
369
+ lossy: false
370
+ });
371
+ expect(dataset.LossyImageCompression).toBe("00");
372
+ // A lossy source stays lossy (PS3.3 C.7.6.1.1.5).
373
+ expect(
374
+ buildImageDataset(grayPixels(), {
375
+ derivedFrom: { ...source, LossyImageCompression: "01" },
376
+ lossy: false
377
+ }).LossyImageCompression
378
+ ).toBe("01");
379
+ });
380
+
381
+ // API: ImageType is a base value, so a custom base sets it, and
382
+ // derivedImageBase composed after it replaces it.
383
+ test("a custom base sets ImageType, and derivedImageBase replaces it", () => {
384
+ const base = combineBases(imageBase, {
385
+ ImageType: ["DERIVED", "PRIMARY"]
386
+ });
387
+ expect(
388
+ buildImageDataset(grayPixels(), { baseDicom: base }).ImageType
389
+ ).toEqual(["DERIVED", "PRIMARY"]);
390
+ const derived = buildImageDataset(grayPixels(), {
391
+ baseDicom: combineBases(base, derivedImageBase(source))
392
+ });
393
+ expect(derived.ImageType).toEqual(["DERIVED", "SECONDARY"]);
394
+ expect(derived.SourceImageSequence).toHaveLength(1);
395
+ });
396
+
397
+ // API: a lossy object sets the method and the ratio.
398
+ test("lossy detail carries method and ratio", () => {
399
+ const dataset = buildImageDataset(grayPixels(), {
400
+ derivedFrom: source,
401
+ lossy: { method: "ISO_10918_1", ratio: 8 }
402
+ });
403
+ expect(dataset.LossyImageCompressionMethod).toBe("ISO_10918_1");
404
+ expect(dataset.LossyImageCompressionRatio).toBe(8);
405
+ });
406
+
407
+ // API: an override SOPInstanceUID always wins.
408
+ test("explicit SOPInstanceUID override is respected", () => {
409
+ const dataset = buildImageDataset(grayPixels(), {
410
+ instance: source,
411
+ derivedFrom: source,
412
+ overrides: { SOPInstanceUID: "2.25.42" }
413
+ });
414
+ expect(dataset.SOPInstanceUID).toBe("2.25.42");
415
+ });
416
+ });
417
+
418
+ describe("derivedImageAttributes", () => {
419
+ // API: one SourceImageSequence item for each source, and a clear error
420
+ // for a source without its identity.
421
+ test("references each partial instance, and names a missing keyword", () => {
422
+ const attributes = derivedImageAttributes([
423
+ { SOPClassUID: MR_SOP_CLASS_UID, SOPInstanceUID: "2.25.1" },
424
+ { SOPClassUID: MR_SOP_CLASS_UID, SOPInstanceUID: "2.25.2" }
425
+ ]);
426
+ expect(attributes.ImageType).toEqual(["DERIVED", "SECONDARY"]);
427
+ expect(
428
+ attributes.SourceImageSequence.map(
429
+ item => item.ReferencedSOPInstanceUID
430
+ )
431
+ ).toEqual(["2.25.1", "2.25.2"]);
432
+ expect(() =>
433
+ derivedImageAttributes([{ SOPClassUID: MR_SOP_CLASS_UID }])
434
+ ).toThrow(/derivedFrom\[0\] is missing SOPInstanceUID/);
435
+ expect(() => derivedImageAttributes([])).toThrow(
436
+ /derivedFrom needs at least one instance/
437
+ );
438
+ expect(() => derivedImageBase([])).toThrow(
439
+ /derivedFrom needs at least one instance/
440
+ );
441
+ });
442
+
443
+ // API: the lossy steps of a source stay in the history (PS3.3
444
+ // C.7.6.1.1.5), before the step of this derivation.
445
+ test("keeps the lossy compression history of a lossy source", () => {
446
+ const attributes = derivedImageAttributes(
447
+ {
448
+ SOPClassUID: MR_SOP_CLASS_UID,
449
+ SOPInstanceUID: "2.25.1",
450
+ LossyImageCompression: "01",
451
+ LossyImageCompressionMethod: "ISO_14495_1",
452
+ LossyImageCompressionRatio: 5
453
+ },
454
+ { lossy: { method: "ISO_10918_1", ratio: 10 } }
455
+ );
456
+ expect([
457
+ attributes.LossyImageCompressionMethod,
458
+ attributes.LossyImageCompressionRatio
459
+ ]).toEqual([
460
+ ["ISO_14495_1", "ISO_10918_1"],
461
+ [5, 10]
462
+ ]);
463
+
464
+ // A source method without a ratio: the ratios cannot pair by
465
+ // position, so the result has no ratio (IMG-USR-3).
466
+ const warn = jest.spyOn(log, "warn").mockImplementation(() => {});
467
+ const unpaired = derivedImageAttributes(
468
+ {
469
+ SOPClassUID: MR_SOP_CLASS_UID,
470
+ SOPInstanceUID: "2.25.1",
471
+ LossyImageCompression: "01",
472
+ LossyImageCompressionMethod: "ISO_15444_1"
473
+ },
474
+ { lossy: { method: "ISO_10918_1", ratio: 8 } }
475
+ );
476
+ expect([
477
+ unpaired.LossyImageCompressionMethod,
478
+ unpaired.LossyImageCompressionRatio,
479
+ warn.mock.calls.length
480
+ ]).toEqual([["ISO_15444_1", "ISO_10918_1"], undefined, 1]);
481
+ warn.mockRestore();
482
+ });
483
+ });
484
+
485
+ describe("encapsulated multi-frame (finding 10)", () => {
486
+ const JPEG_BASELINE_TS = "1.2.840.10008.1.2.4.50";
487
+ const frame = new Uint8Array([1, 2, 3, 4]);
488
+
489
+ // Review finding 10: numberOfFrames came only from
490
+ // decodedImage.numberOfFrames || 1 and the attribute was written only
491
+ // when above 1 — three encapsulated fragments produced an instance
492
+ // with no NumberOfFrames, so a conformant reader showed frame 1 and
493
+ // frames 2 and 3 were unreachable.
494
+ test("NumberOfFrames defaults to frames.length (finding 10)", () => {
495
+ const dataset = buildImageDataset(
496
+ { rows: 4, columns: 4 },
497
+ {
498
+ encapsulated: {
499
+ transferSyntaxUID: JPEG_BASELINE_TS,
500
+ frames: [frame, frame, frame]
501
+ }
502
+ }
503
+ );
504
+ expect(dataset.NumberOfFrames).toBe(3);
505
+ expect(dataset.PixelData).toHaveLength(3);
506
+ });
507
+
508
+ // The reverse shape also passed unchecked: an explicit frame count
509
+ // over a different number of fragments emitted the bogus claim.
510
+ test("explicit numberOfFrames over a different fragment count throws (finding 10)", () => {
511
+ expect(() =>
512
+ buildImageDataset(
513
+ { rows: 4, columns: 4, numberOfFrames: 7 },
514
+ {
515
+ encapsulated: {
516
+ transferSyntaxUID: JPEG_BASELINE_TS,
517
+ frames: [frame, frame]
518
+ }
519
+ }
520
+ )
521
+ ).toThrow(/does not match/);
522
+ });
523
+
524
+ test("a matching explicit count is accepted", () => {
525
+ const dataset = buildImageDataset(
526
+ { rows: 4, columns: 4, numberOfFrames: 2 },
527
+ {
528
+ encapsulated: {
529
+ transferSyntaxUID: JPEG_BASELINE_TS,
530
+ frames: [frame, frame]
531
+ }
532
+ }
533
+ );
534
+ expect(dataset.NumberOfFrames).toBe(2);
535
+ });
536
+
537
+ test("a single encapsulated frame still omits NumberOfFrames", () => {
538
+ const dataset = buildImageDataset(
539
+ { rows: 4, columns: 4 },
540
+ {
541
+ encapsulated: {
542
+ transferSyntaxUID: JPEG_BASELINE_TS,
543
+ frames: [frame]
544
+ }
545
+ }
546
+ );
547
+ expect(dataset.NumberOfFrames).toBeUndefined();
548
+ expect(dataset.PixelData).toHaveLength(1);
549
+ });
550
+ });
@@ -0,0 +1,29 @@
1
+ // test/h264.test.js
2
+ //
3
+ // h264TransferSyntaxUID: the AVC profile/level → DICOM transfer syntax
4
+ // mapping (Supplement 225). Extracted from the video package's mp4Info suite
5
+ // when this function moved to @dcmjs-org/imaging.
6
+
7
+ import { h264TransferSyntaxUID } from "../src/h264.js";
8
+
9
+ const H264_HIGH_41 = "1.2.840.10008.1.2.4.102.1";
10
+ const H264_HIGH_42 = "1.2.840.10008.1.2.4.104.1";
11
+
12
+ describe("h264TransferSyntaxUID", () => {
13
+ it("maps Baseline/Main/High ≤ 4.1 to the Level 4.1 fragmentable syntax", () => {
14
+ expect(h264TransferSyntaxUID(66, 30)).toBe(H264_HIGH_41);
15
+ expect(h264TransferSyntaxUID(77, 40)).toBe(H264_HIGH_41);
16
+ expect(h264TransferSyntaxUID(100, 41)).toBe(H264_HIGH_41);
17
+ });
18
+
19
+ it("maps level 4.2 to the Level 4.2 fragmentable syntax", () => {
20
+ expect(h264TransferSyntaxUID(100, 42)).toBe(H264_HIGH_42);
21
+ expect(h264TransferSyntaxUID(66, 42)).toBe(H264_HIGH_42);
22
+ });
23
+
24
+ it("returns null beyond the defined envelope", () => {
25
+ expect(h264TransferSyntaxUID(100, 51)).toBeNull(); // level 5.1
26
+ expect(h264TransferSyntaxUID(110, 42)).toBeNull(); // High-10
27
+ expect(h264TransferSyntaxUID(244, 41)).toBeNull(); // High-444
28
+ });
29
+ });