/src/dcmtk/dcmdata/libsrc/dcxfer.cc
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * Copyright (C) 1994-2025, OFFIS e.V. |
4 | | * All rights reserved. See COPYRIGHT file for details. |
5 | | * |
6 | | * This software and supporting documentation were developed by |
7 | | * |
8 | | * OFFIS e.V. |
9 | | * R&D Division Health |
10 | | * Escherweg 2 |
11 | | * D-26121 Oldenburg, Germany |
12 | | * |
13 | | * |
14 | | * Module: dcmdata |
15 | | * |
16 | | * Author: Gerd Ehlers, Joerg Riesmeier |
17 | | * |
18 | | * Purpose: handling of transfer syntaxes |
19 | | * |
20 | | */ |
21 | | |
22 | | #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ |
23 | | #include "dcmtk/dcmdata/dcxfer.h" |
24 | | #include "dcmtk/dcmdata/dcuid.h" |
25 | | #include <cstring> |
26 | | |
27 | 1.06M | #define DCXFER_DEFAULT_MIME_TYPE "application/dicom" |
28 | 1.06M | #define DCXFER_DEFAULT_EXTENSION ".bin" |
29 | | |
30 | | typedef struct |
31 | | { |
32 | | const char *xferID; |
33 | | const char *xferName; |
34 | | E_TransferSyntax xfer; |
35 | | E_ByteOrder byteOrder; |
36 | | E_ByteOrder pixelDataByteOrder; |
37 | | E_VRType vrType; |
38 | | E_PixelDataEncoding pixelDataEncoding; |
39 | | E_PixelDataCompression pixelDataCompression; |
40 | | OFBool pixelDataFragmentable; |
41 | | Uint32 JPEGProcess8; |
42 | | Uint32 JPEGProcess12; |
43 | | E_StreamCompression streamCompression; |
44 | | E_XferValidity xferValidity; |
45 | | const char *mimeType; |
46 | | const char *filenameExtension; |
47 | | } S_XferNames; |
48 | | |
49 | | |
50 | 1.06M | #define ERROR_XferName "Unknown Transfer Syntax" |
51 | | |
52 | | |
53 | | const S_XferNames XferNames[] = |
54 | | { |
55 | | // entry #0 |
56 | | { UID_LittleEndianImplicitTransferSyntax, |
57 | | "Little Endian Implicit", |
58 | | EXS_LittleEndianImplicit, |
59 | | EBO_LittleEndian, |
60 | | EBO_LittleEndian, |
61 | | EVT_Implicit, |
62 | | EPE_Native, |
63 | | EPC_Uncompressed, |
64 | | OFFalse, |
65 | | 0L, 0L, |
66 | | ESC_none, |
67 | | EXV_Standard, |
68 | | DCXFER_DEFAULT_MIME_TYPE, |
69 | | DCXFER_DEFAULT_EXTENSION |
70 | | }, |
71 | | // entry #1 |
72 | | { "", // internal type, no UID defined |
73 | | "Virtual Big Endian Implicit", |
74 | | EXS_BigEndianImplicit, |
75 | | EBO_BigEndian, |
76 | | EBO_BigEndian, |
77 | | EVT_Implicit, |
78 | | EPE_Native, |
79 | | EPC_Uncompressed, |
80 | | OFFalse, |
81 | | 0L, 0L, |
82 | | ESC_none, |
83 | | EXV_Internal, |
84 | | DCXFER_DEFAULT_MIME_TYPE, |
85 | | DCXFER_DEFAULT_EXTENSION |
86 | | }, |
87 | | // entry #2 |
88 | | { UID_LittleEndianExplicitTransferSyntax, |
89 | | "Little Endian Explicit", |
90 | | EXS_LittleEndianExplicit, |
91 | | EBO_LittleEndian, |
92 | | EBO_LittleEndian, |
93 | | EVT_Explicit, |
94 | | EPE_Native, |
95 | | EPC_Uncompressed, |
96 | | OFFalse, |
97 | | 0L, 0L, |
98 | | ESC_none, |
99 | | EXV_Standard, |
100 | | DCXFER_DEFAULT_MIME_TYPE, |
101 | | DCXFER_DEFAULT_EXTENSION |
102 | | }, |
103 | | // entry #3 |
104 | | { UID_BigEndianExplicitTransferSyntax, |
105 | | "Big Endian Explicit", |
106 | | EXS_BigEndianExplicit, |
107 | | EBO_BigEndian, |
108 | | EBO_BigEndian, |
109 | | EVT_Explicit, |
110 | | EPE_Native, |
111 | | EPC_Uncompressed, |
112 | | OFFalse, |
113 | | 0L, 0L, |
114 | | ESC_none, |
115 | | EXV_Retired, // retired with Supplement 98 |
116 | | DCXFER_DEFAULT_MIME_TYPE, |
117 | | DCXFER_DEFAULT_EXTENSION |
118 | | }, |
119 | | // entry #4 |
120 | | { UID_EncapsulatedUncompressedExplicitVRLittleEndianTransferSyntax, |
121 | | "Encapsulated Uncompressed Explicit VR Little Endian", |
122 | | EXS_EncapsulatedUncompressedLittleEndianExplicit, |
123 | | EBO_LittleEndian, |
124 | | EBO_LittleEndian, |
125 | | EVT_Explicit, |
126 | | EPE_Encapsulated, |
127 | | EPC_Uncompressed, |
128 | | OFFalse, |
129 | | 0L, 0L, |
130 | | ESC_none, |
131 | | EXV_Standard, |
132 | | DCXFER_DEFAULT_MIME_TYPE, |
133 | | DCXFER_DEFAULT_EXTENSION |
134 | | }, |
135 | | // entry #5 |
136 | | { UID_JPEGProcess1TransferSyntax, |
137 | | "JPEG Baseline", |
138 | | EXS_JPEGProcess1, |
139 | | EBO_LittleEndian, |
140 | | EBO_LittleEndian, |
141 | | EVT_Explicit, |
142 | | EPE_Encapsulated, |
143 | | EPC_LossyCompressed, |
144 | | OFTrue, |
145 | | 1L, 1L, |
146 | | ESC_none, |
147 | | EXV_Standard, |
148 | | "image/jpeg", |
149 | | ".jpeg" |
150 | | }, |
151 | | // entry #6 |
152 | | { UID_JPEGProcess2_4TransferSyntax, |
153 | | "JPEG Extended, Process 2+4", |
154 | | EXS_JPEGProcess2_4, |
155 | | EBO_LittleEndian, |
156 | | EBO_LittleEndian, |
157 | | EVT_Explicit, |
158 | | EPE_Encapsulated, |
159 | | EPC_LossyCompressed, |
160 | | OFTrue, |
161 | | 2L, 4L, |
162 | | ESC_none, |
163 | | EXV_Standard, |
164 | | "image/jpeg", |
165 | | ".jpeg" |
166 | | }, |
167 | | // entry #7 |
168 | | { UID_JPEGProcess3_5TransferSyntax, |
169 | | "JPEG Extended, Process 3+5", |
170 | | EXS_JPEGProcess3_5, |
171 | | EBO_LittleEndian, |
172 | | EBO_LittleEndian, |
173 | | EVT_Explicit, |
174 | | EPE_Encapsulated, |
175 | | EPC_LossyCompressed, |
176 | | OFTrue, |
177 | | 3L, 5L, |
178 | | ESC_none, |
179 | | EXV_Retired, // retired with Supplement 61 |
180 | | "image/jpeg", |
181 | | ".jpeg" |
182 | | }, |
183 | | // entry #8 |
184 | | { UID_JPEGProcess6_8TransferSyntax, |
185 | | "JPEG Spectral Selection, Non-hierarchical, Process 6+8", |
186 | | EXS_JPEGProcess6_8, |
187 | | EBO_LittleEndian, |
188 | | EBO_LittleEndian, |
189 | | EVT_Explicit, |
190 | | EPE_Encapsulated, |
191 | | EPC_LossyCompressed, |
192 | | OFTrue, |
193 | | 6L, 8L, |
194 | | ESC_none, |
195 | | EXV_Retired, // retired with Supplement 61 |
196 | | "image/jpeg", |
197 | | ".jpeg" |
198 | | }, |
199 | | // entry #9 |
200 | | { UID_JPEGProcess7_9TransferSyntax, |
201 | | "JPEG Spectral Selection, Non-hierarchical, Process 7+9", |
202 | | EXS_JPEGProcess7_9, |
203 | | EBO_LittleEndian, |
204 | | EBO_LittleEndian, |
205 | | EVT_Explicit, |
206 | | EPE_Encapsulated, |
207 | | EPC_LossyCompressed, |
208 | | OFTrue, |
209 | | 7L, 9L, |
210 | | ESC_none, |
211 | | EXV_Retired, // retired with Supplement 61 |
212 | | "image/jpeg", |
213 | | ".jpeg" |
214 | | }, |
215 | | // entry #10 |
216 | | { UID_JPEGProcess10_12TransferSyntax, |
217 | | "JPEG Full Progression, Non-hierarchical, Process 10+12", |
218 | | EXS_JPEGProcess10_12, |
219 | | EBO_LittleEndian, |
220 | | EBO_LittleEndian, |
221 | | EVT_Explicit, |
222 | | EPE_Encapsulated, |
223 | | EPC_LossyCompressed, |
224 | | OFTrue, |
225 | | 10L, 12L, |
226 | | ESC_none, |
227 | | EXV_Retired, // retired with Supplement 61 |
228 | | "image/jpeg", |
229 | | ".jpeg" |
230 | | }, |
231 | | // entry #11 |
232 | | { UID_JPEGProcess11_13TransferSyntax, |
233 | | "JPEG Full Progression, Non-hierarchical, Process 11+13", |
234 | | EXS_JPEGProcess11_13, |
235 | | EBO_LittleEndian, |
236 | | EBO_LittleEndian, |
237 | | EVT_Explicit, |
238 | | EPE_Encapsulated, |
239 | | EPC_LossyCompressed, |
240 | | OFTrue, |
241 | | 11L, 13L, |
242 | | ESC_none, |
243 | | EXV_Retired, // retired with Supplement 61 |
244 | | "image/jpeg", |
245 | | ".jpeg" |
246 | | }, |
247 | | // entry #12 |
248 | | { UID_JPEGProcess14TransferSyntax, |
249 | | "JPEG Lossless, Non-hierarchical, Process 14", |
250 | | EXS_JPEGProcess14, |
251 | | EBO_LittleEndian, |
252 | | EBO_LittleEndian, |
253 | | EVT_Explicit, |
254 | | EPE_Encapsulated, |
255 | | EPC_LosslessCompressed, |
256 | | OFTrue, |
257 | | 14, 14L, |
258 | | ESC_none, |
259 | | EXV_Standard, |
260 | | "image/jpeg", |
261 | | ".jpeg" |
262 | | }, |
263 | | // entry #13 |
264 | | { UID_JPEGProcess15TransferSyntax, |
265 | | "JPEG Lossless, Non-hierarchical, Process 15", |
266 | | EXS_JPEGProcess15, |
267 | | EBO_LittleEndian, |
268 | | EBO_LittleEndian, |
269 | | EVT_Explicit, |
270 | | EPE_Encapsulated, |
271 | | EPC_LosslessCompressed, |
272 | | OFTrue, |
273 | | 15L, 15L, |
274 | | ESC_none, |
275 | | EXV_Retired, // retired with Supplement 61 |
276 | | "image/jpeg", |
277 | | ".jpeg" |
278 | | }, |
279 | | // entry #14 |
280 | | { UID_JPEGProcess16_18TransferSyntax, |
281 | | "JPEG Extended, Hierarchical, Process 16+18", |
282 | | EXS_JPEGProcess16_18, |
283 | | EBO_LittleEndian, |
284 | | EBO_LittleEndian, |
285 | | EVT_Explicit, |
286 | | EPE_Encapsulated, |
287 | | EPC_LossyCompressed, |
288 | | OFTrue, |
289 | | 16L, 18L, |
290 | | ESC_none, |
291 | | EXV_Retired, // retired with Supplement 61 |
292 | | "image/jpeg", |
293 | | ".jpeg" |
294 | | }, |
295 | | // entry #15 |
296 | | { UID_JPEGProcess17_19TransferSyntax, |
297 | | "JPEG Extended, Hierarchical, Process 17+19", |
298 | | EXS_JPEGProcess17_19, |
299 | | EBO_LittleEndian, |
300 | | EBO_LittleEndian, |
301 | | EVT_Explicit, |
302 | | EPE_Encapsulated, |
303 | | EPC_LossyCompressed, |
304 | | OFTrue, |
305 | | 17L, 19L, |
306 | | ESC_none, |
307 | | EXV_Retired, // retired with Supplement 61 |
308 | | "image/jpeg", |
309 | | ".jpeg" |
310 | | }, |
311 | | // entry #16 |
312 | | { UID_JPEGProcess20_22TransferSyntax, |
313 | | "JPEG Spectral Selection, Hierarchical, Process 20+22", |
314 | | EXS_JPEGProcess20_22, |
315 | | EBO_LittleEndian, |
316 | | EBO_LittleEndian, |
317 | | EVT_Explicit, |
318 | | EPE_Encapsulated, |
319 | | EPC_LossyCompressed, |
320 | | OFTrue, |
321 | | 20L, 22L, |
322 | | ESC_none, |
323 | | EXV_Retired, // retired with Supplement 61 |
324 | | "image/jpeg", |
325 | | ".jpeg" |
326 | | }, |
327 | | // entry #17 |
328 | | { UID_JPEGProcess21_23TransferSyntax, |
329 | | "JPEG Spectral Selection, Hierarchical, Process 21+23", |
330 | | EXS_JPEGProcess21_23, |
331 | | EBO_LittleEndian, |
332 | | EBO_LittleEndian, |
333 | | EVT_Explicit, |
334 | | EPE_Encapsulated, |
335 | | EPC_LossyCompressed, |
336 | | OFTrue, |
337 | | 21L, 23L, |
338 | | ESC_none, |
339 | | EXV_Retired, // retired with Supplement 61 |
340 | | "image/jpeg", |
341 | | ".jpeg" |
342 | | }, |
343 | | // entry #18 |
344 | | { UID_JPEGProcess24_26TransferSyntax, |
345 | | "JPEG Full Progression, Hierarchical, Process 24+26", |
346 | | EXS_JPEGProcess24_26, |
347 | | EBO_LittleEndian, |
348 | | EBO_LittleEndian, |
349 | | EVT_Explicit, |
350 | | EPE_Encapsulated, |
351 | | EPC_LossyCompressed, |
352 | | OFTrue, |
353 | | 24L, 26L, |
354 | | ESC_none, |
355 | | EXV_Retired, // retired with Supplement 61 |
356 | | "image/jpeg", |
357 | | ".jpeg" |
358 | | }, |
359 | | // entry #19 |
360 | | { UID_JPEGProcess25_27TransferSyntax, |
361 | | "JPEG Full Progression, Hierarchical, Process 25+27", |
362 | | EXS_JPEGProcess25_27, |
363 | | EBO_LittleEndian, |
364 | | EBO_LittleEndian, |
365 | | EVT_Explicit, |
366 | | EPE_Encapsulated, |
367 | | EPC_LossyCompressed, |
368 | | OFTrue, |
369 | | 25L, 27L, |
370 | | ESC_none, |
371 | | EXV_Retired, // retired with Supplement 61 |
372 | | "image/jpeg", |
373 | | ".jpeg" |
374 | | }, |
375 | | // entry #20 |
376 | | { UID_JPEGProcess28TransferSyntax, |
377 | | "JPEG Lossless, Hierarchical, Process 28", |
378 | | EXS_JPEGProcess28, |
379 | | EBO_LittleEndian, |
380 | | EBO_LittleEndian, |
381 | | EVT_Explicit, |
382 | | EPE_Encapsulated, |
383 | | EPC_LosslessCompressed, |
384 | | OFTrue, |
385 | | 28L, 28L, |
386 | | ESC_none, |
387 | | EXV_Retired, // retired with Supplement 61 |
388 | | "image/jpeg", |
389 | | ".jpeg" |
390 | | }, |
391 | | // entry #21 |
392 | | { UID_JPEGProcess29TransferSyntax, |
393 | | "JPEG Lossless, Hierarchical, Process 29", |
394 | | EXS_JPEGProcess29, |
395 | | EBO_LittleEndian, |
396 | | EBO_LittleEndian, |
397 | | EVT_Explicit, |
398 | | EPE_Encapsulated, |
399 | | EPC_LosslessCompressed, |
400 | | OFTrue, |
401 | | 29L, 29L, |
402 | | ESC_none, |
403 | | EXV_Retired, // retired with Supplement 61 |
404 | | "image/jpeg", |
405 | | ".jpeg" |
406 | | }, |
407 | | // entry #22 |
408 | | { UID_JPEGProcess14SV1TransferSyntax, |
409 | | "JPEG Lossless, Non-hierarchical, 1st Order Prediction", |
410 | | EXS_JPEGProcess14SV1, |
411 | | EBO_LittleEndian, |
412 | | EBO_LittleEndian, |
413 | | EVT_Explicit, |
414 | | EPE_Encapsulated, |
415 | | EPC_LosslessCompressed, |
416 | | OFTrue, |
417 | | 14L, 14L, |
418 | | ESC_none, |
419 | | EXV_Standard, |
420 | | "image/jpeg", |
421 | | ".jpeg" |
422 | | }, |
423 | | // entry #23 |
424 | | { UID_RLELosslessTransferSyntax, |
425 | | "RLE Lossless", |
426 | | EXS_RLELossless, |
427 | | EBO_LittleEndian, |
428 | | EBO_LittleEndian, |
429 | | EVT_Explicit, |
430 | | EPE_Encapsulated, |
431 | | EPC_LosslessCompressed, |
432 | | OFFalse, |
433 | | 0L, 0L, |
434 | | ESC_none, |
435 | | EXV_Standard, |
436 | | "image/dicom-rle", |
437 | | ".dicom-rle" |
438 | | }, |
439 | | // entry #24 |
440 | | { UID_DeflatedExplicitVRLittleEndianTransferSyntax, |
441 | | "Deflated Explicit VR Little Endian", |
442 | | EXS_DeflatedLittleEndianExplicit, |
443 | | EBO_LittleEndian, |
444 | | EBO_LittleEndian, |
445 | | EVT_Explicit, |
446 | | EPE_Native, |
447 | | EPC_Uncompressed, |
448 | | OFFalse, |
449 | | 0L, 0L, |
450 | | #ifdef WITH_ZLIB |
451 | | ESC_zlib, |
452 | | #else |
453 | | ESC_unsupported, |
454 | | #endif |
455 | | EXV_Standard, |
456 | | DCXFER_DEFAULT_MIME_TYPE, |
457 | | DCXFER_DEFAULT_EXTENSION |
458 | | }, |
459 | | // entry #25 |
460 | | { UID_DeflatedImageFrameCompressionTransferSyntax, |
461 | | "Deflated Image Frame Compression", |
462 | | EXS_DeflatedImageFrameCompression, |
463 | | EBO_LittleEndian, |
464 | | EBO_LittleEndian, |
465 | | EVT_Explicit, |
466 | | EPE_Encapsulated, |
467 | | EPC_LosslessCompressed, |
468 | | OFFalse, |
469 | | 0L, 0L, |
470 | | ESC_none, |
471 | | EXV_Standard, |
472 | | "application/x-deflate", |
473 | | ".x-deflate" |
474 | | }, |
475 | | // entry #26 |
476 | | { UID_JPEGLSLosslessTransferSyntax, |
477 | | "JPEG-LS Lossless", |
478 | | EXS_JPEGLSLossless, |
479 | | EBO_LittleEndian, |
480 | | EBO_LittleEndian, |
481 | | EVT_Explicit, |
482 | | EPE_Encapsulated, |
483 | | EPC_LosslessCompressed, |
484 | | OFTrue, |
485 | | 0L, 0L, |
486 | | ESC_none, |
487 | | EXV_Standard, |
488 | | "image/jls", |
489 | | ".jls" |
490 | | }, |
491 | | // entry #27 |
492 | | { UID_JPEGLSLossyTransferSyntax, |
493 | | "JPEG-LS Lossy (Near-lossless)", |
494 | | EXS_JPEGLSLossy, |
495 | | EBO_LittleEndian, |
496 | | EBO_LittleEndian, |
497 | | EVT_Explicit, |
498 | | EPE_Encapsulated, |
499 | | EPC_LossyCompressed, |
500 | | OFTrue, |
501 | | 0L, 0L, |
502 | | ESC_none, |
503 | | EXV_Standard, |
504 | | "image/jls", |
505 | | ".jls" |
506 | | }, |
507 | | // entry #28 |
508 | | { UID_JPEG2000LosslessOnlyTransferSyntax, |
509 | | "JPEG 2000 (Lossless only)", |
510 | | EXS_JPEG2000LosslessOnly, |
511 | | EBO_LittleEndian, |
512 | | EBO_LittleEndian, |
513 | | EVT_Explicit, |
514 | | EPE_Encapsulated, |
515 | | EPC_LosslessCompressed, |
516 | | OFTrue, |
517 | | 0L, 0L, |
518 | | ESC_none, |
519 | | EXV_Standard, |
520 | | "image/jp2", |
521 | | ".jp2" |
522 | | }, |
523 | | // entry #29 |
524 | | { UID_JPEG2000TransferSyntax, |
525 | | "JPEG 2000 (Lossless or Lossy)", |
526 | | EXS_JPEG2000, |
527 | | EBO_LittleEndian, |
528 | | EBO_LittleEndian, |
529 | | EVT_Explicit, |
530 | | EPE_Encapsulated, |
531 | | EPC_LossyCompressed, |
532 | | OFTrue, |
533 | | 0L, 0L, |
534 | | ESC_none, |
535 | | EXV_Standard, |
536 | | "image/jp2", |
537 | | ".jp2" |
538 | | }, |
539 | | // entry #30 |
540 | | { UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax, |
541 | | "JPEG 2000 Part 2 Multicomponent Image Compression (Lossless only)", |
542 | | EXS_JPEG2000MulticomponentLosslessOnly, |
543 | | EBO_LittleEndian, |
544 | | EBO_LittleEndian, |
545 | | EVT_Explicit, |
546 | | EPE_Encapsulated, |
547 | | EPC_LosslessCompressed, |
548 | | OFTrue, |
549 | | 0L, 0L, |
550 | | ESC_none, |
551 | | EXV_Standard, |
552 | | "image/jpx", |
553 | | ".jpx" |
554 | | }, |
555 | | // entry #31 |
556 | | { UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax, |
557 | | "JPEG 2000 Part 2 Multicomponent Image Compression (Lossless or Lossy)", |
558 | | EXS_JPEG2000Multicomponent, |
559 | | EBO_LittleEndian, |
560 | | EBO_LittleEndian, |
561 | | EVT_Explicit, |
562 | | EPE_Encapsulated, |
563 | | EPC_LossyCompressed, |
564 | | OFTrue, |
565 | | 0L, 0L, |
566 | | ESC_none, |
567 | | EXV_Standard, |
568 | | "image/jpx", |
569 | | ".jpx" |
570 | | }, |
571 | | // entry #32 |
572 | | { UID_JPIPReferencedTransferSyntax, |
573 | | "JPIP Referenced", |
574 | | EXS_JPIPReferenced, |
575 | | EBO_LittleEndian, |
576 | | EBO_LittleEndian, |
577 | | EVT_Explicit, |
578 | | EPE_Referenced, |
579 | | EPC_unknown, |
580 | | OFFalse, |
581 | | 0L, 0L, |
582 | | ESC_none, |
583 | | EXV_Standard, |
584 | | DCXFER_DEFAULT_MIME_TYPE, |
585 | | DCXFER_DEFAULT_EXTENSION |
586 | | }, |
587 | | // entry #33 |
588 | | { UID_JPIPReferencedDeflateTransferSyntax, |
589 | | "JPIP Referenced Deflate", |
590 | | EXS_JPIPReferencedDeflate, |
591 | | EBO_LittleEndian, |
592 | | EBO_LittleEndian, |
593 | | EVT_Explicit, |
594 | | EPE_Referenced, |
595 | | EPC_unknown, |
596 | | OFFalse, |
597 | | 0L, 0L, |
598 | | #ifdef WITH_ZLIB |
599 | | ESC_zlib, |
600 | | #else |
601 | | ESC_unsupported, |
602 | | #endif |
603 | | EXV_Standard, |
604 | | DCXFER_DEFAULT_MIME_TYPE, |
605 | | DCXFER_DEFAULT_EXTENSION |
606 | | }, |
607 | | // entry #34 |
608 | | { UID_MPEG2MainProfileAtMainLevelTransferSyntax, |
609 | | "MPEG2 Main Profile @ Main Level", // changed with DICOM 2016e to: MPEG2 Main Profile / Main Level |
610 | | EXS_MPEG2MainProfileAtMainLevel, |
611 | | EBO_LittleEndian, |
612 | | EBO_LittleEndian, |
613 | | EVT_Explicit, |
614 | | EPE_Encapsulated, |
615 | | EPC_LossyCompressed, |
616 | | OFFalse, |
617 | | 0L, 0L, |
618 | | ESC_none, |
619 | | EXV_Standard, |
620 | | "video/mpeg", |
621 | | ".mpeg" |
622 | | }, |
623 | | // entry #35 |
624 | | { UID_FragmentableMPEG2MainProfileMainLevelTransferSyntax, |
625 | | "Fragmentable MPEG2 Main Profile / Main Level", |
626 | | EXS_FragmentableMPEG2MainProfileMainLevel, |
627 | | EBO_LittleEndian, |
628 | | EBO_LittleEndian, |
629 | | EVT_Explicit, |
630 | | EPE_Encapsulated, |
631 | | EPC_LossyCompressed, |
632 | | OFTrue, |
633 | | 0L, 0L, |
634 | | ESC_none, |
635 | | EXV_Standard, |
636 | | "video/mpeg", |
637 | | ".mpeg" |
638 | | }, |
639 | | // entry #36 |
640 | | { UID_MPEG2MainProfileAtHighLevelTransferSyntax, |
641 | | "MPEG2 Main Profile @ High Level", // changed with DICOM 2016e to: MPEG2 Main Profile / High Level |
642 | | EXS_MPEG2MainProfileAtHighLevel, |
643 | | EBO_LittleEndian, |
644 | | EBO_LittleEndian, |
645 | | EVT_Explicit, |
646 | | EPE_Encapsulated, |
647 | | EPC_LossyCompressed, |
648 | | OFFalse, |
649 | | 0L, 0L, |
650 | | ESC_none, |
651 | | EXV_Standard, |
652 | | "video/mpeg", |
653 | | ".mpeg" |
654 | | }, |
655 | | // entry #37 |
656 | | { UID_FragmentableMPEG2MainProfileHighLevelTransferSyntax, |
657 | | "Fragmentable MPEG2 Main Profile / High Level", |
658 | | EXS_FragmentableMPEG2MainProfileHighLevel, |
659 | | EBO_LittleEndian, |
660 | | EBO_LittleEndian, |
661 | | EVT_Explicit, |
662 | | EPE_Encapsulated, |
663 | | EPC_LossyCompressed, |
664 | | OFTrue, |
665 | | 0L, 0L, |
666 | | ESC_none, |
667 | | EXV_Standard, |
668 | | "video/mpeg", |
669 | | ".mpeg" |
670 | | }, |
671 | | // entry #38 |
672 | | { UID_MPEG4HighProfileLevel4_1TransferSyntax, |
673 | | "MPEG-4 AVC/H.264 High Profile / Level 4.1", |
674 | | EXS_MPEG4HighProfileLevel4_1, |
675 | | EBO_LittleEndian, |
676 | | EBO_LittleEndian, |
677 | | EVT_Explicit, |
678 | | EPE_Encapsulated, |
679 | | EPC_LossyCompressed, |
680 | | OFFalse, |
681 | | 0L, 0L, |
682 | | ESC_none, |
683 | | EXV_Standard, |
684 | | "video/mp4", |
685 | | ".mp4" |
686 | | }, |
687 | | // entry #39 |
688 | | { UID_FragmentableMPEG4HighProfileLevel4_1TransferSyntax, |
689 | | "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.1", |
690 | | EXS_FragmentableMPEG4HighProfileLevel4_1, |
691 | | EBO_LittleEndian, |
692 | | EBO_LittleEndian, |
693 | | EVT_Explicit, |
694 | | EPE_Encapsulated, |
695 | | EPC_LossyCompressed, |
696 | | OFTrue, |
697 | | 0L, 0L, |
698 | | ESC_none, |
699 | | EXV_Standard, |
700 | | "video/mp4", |
701 | | ".mp4" |
702 | | }, |
703 | | // entry #40 |
704 | | { UID_MPEG4BDcompatibleHighProfileLevel4_1TransferSyntax, |
705 | | "MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1", |
706 | | EXS_MPEG4BDcompatibleHighProfileLevel4_1, |
707 | | EBO_LittleEndian, |
708 | | EBO_LittleEndian, |
709 | | EVT_Explicit, |
710 | | EPE_Encapsulated, |
711 | | EPC_LossyCompressed, |
712 | | OFFalse, |
713 | | 0L, 0L, |
714 | | ESC_none, |
715 | | EXV_Standard, |
716 | | "video/mp4", |
717 | | ".mp4" |
718 | | }, |
719 | | // entry #41 |
720 | | { UID_FragmentableMPEG4BDcompatibleHighProfileLevel4_1TransferSyntax, |
721 | | "Fragmentable MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1", |
722 | | EXS_FragmentableMPEG4BDcompatibleHighProfileLevel4_1, |
723 | | EBO_LittleEndian, |
724 | | EBO_LittleEndian, |
725 | | EVT_Explicit, |
726 | | EPE_Encapsulated, |
727 | | EPC_LossyCompressed, |
728 | | OFTrue, |
729 | | 0L, 0L, |
730 | | ESC_none, |
731 | | EXV_Standard, |
732 | | "video/mp4", |
733 | | ".mp4" |
734 | | }, |
735 | | // entry #42 |
736 | | { UID_MPEG4HighProfileLevel4_2_For2DVideoTransferSyntax, |
737 | | "MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video", |
738 | | EXS_MPEG4HighProfileLevel4_2_For2DVideo, |
739 | | EBO_LittleEndian, |
740 | | EBO_LittleEndian, |
741 | | EVT_Explicit, |
742 | | EPE_Encapsulated, |
743 | | EPC_LossyCompressed, |
744 | | OFFalse, |
745 | | 0L, 0L, |
746 | | ESC_none, |
747 | | EXV_Standard, |
748 | | "video/mp4", |
749 | | ".mp4" |
750 | | }, |
751 | | // entry #43 |
752 | | { UID_FragmentableMPEG4HighProfileLevel4_2_For2DVideoTransferSyntax, |
753 | | "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video", |
754 | | EXS_FragmentableMPEG4HighProfileLevel4_2_For2DVideo, |
755 | | EBO_LittleEndian, |
756 | | EBO_LittleEndian, |
757 | | EVT_Explicit, |
758 | | EPE_Encapsulated, |
759 | | EPC_LossyCompressed, |
760 | | OFTrue, |
761 | | 0L, 0L, |
762 | | ESC_none, |
763 | | EXV_Standard, |
764 | | "video/mp4", |
765 | | ".mp4" |
766 | | }, |
767 | | // entry #44 |
768 | | { UID_MPEG4HighProfileLevel4_2_For3DVideoTransferSyntax, |
769 | | "MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video", |
770 | | EXS_MPEG4HighProfileLevel4_2_For3DVideo, |
771 | | EBO_LittleEndian, |
772 | | EBO_LittleEndian, |
773 | | EVT_Explicit, |
774 | | EPE_Encapsulated, |
775 | | EPC_LossyCompressed, |
776 | | OFFalse, |
777 | | 0L, 0L, |
778 | | ESC_none, |
779 | | EXV_Standard, |
780 | | "video/mp4", |
781 | | ".mp4" |
782 | | }, |
783 | | // entry #45 |
784 | | { UID_FragmentableMPEG4HighProfileLevel4_2_For3DVideoTransferSyntax, |
785 | | "Fragmentable MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video", |
786 | | EXS_FragmentableMPEG4HighProfileLevel4_2_For3DVideo, |
787 | | EBO_LittleEndian, |
788 | | EBO_LittleEndian, |
789 | | EVT_Explicit, |
790 | | EPE_Encapsulated, |
791 | | EPC_LossyCompressed, |
792 | | OFTrue, |
793 | | 0L, 0L, |
794 | | ESC_none, |
795 | | EXV_Standard, |
796 | | "video/mp4", |
797 | | ".mp4" |
798 | | }, |
799 | | // entry #46 |
800 | | { UID_MPEG4StereoHighProfileLevel4_2TransferSyntax, |
801 | | "MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2", |
802 | | EXS_MPEG4StereoHighProfileLevel4_2, |
803 | | EBO_LittleEndian, |
804 | | EBO_LittleEndian, |
805 | | EVT_Explicit, |
806 | | EPE_Encapsulated, |
807 | | EPC_LossyCompressed, |
808 | | OFFalse, |
809 | | 0L, 0L, |
810 | | ESC_none, |
811 | | EXV_Standard, |
812 | | "video/mp4", |
813 | | ".mp4" |
814 | | }, |
815 | | // entry #47 |
816 | | { UID_FragmentableMPEG4StereoHighProfileLevel4_2TransferSyntax, |
817 | | "Fragmentable MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2", |
818 | | EXS_FragmentableMPEG4StereoHighProfileLevel4_2, |
819 | | EBO_LittleEndian, |
820 | | EBO_LittleEndian, |
821 | | EVT_Explicit, |
822 | | EPE_Encapsulated, |
823 | | EPC_LossyCompressed, |
824 | | OFTrue, |
825 | | 0L, 0L, |
826 | | ESC_none, |
827 | | EXV_Standard, |
828 | | "video/mp4", |
829 | | ".mp4" |
830 | | }, |
831 | | // entry #48 |
832 | | { UID_HEVCMainProfileLevel5_1TransferSyntax, |
833 | | "HEVC/H.265 Main Profile / Level 5.1", |
834 | | EXS_HEVCMainProfileLevel5_1, |
835 | | EBO_LittleEndian, |
836 | | EBO_LittleEndian, |
837 | | EVT_Explicit, |
838 | | EPE_Encapsulated, |
839 | | EPC_LossyCompressed, |
840 | | OFTrue, |
841 | | 0L, 0L, |
842 | | ESC_none, |
843 | | EXV_Standard, |
844 | | "video/H265", |
845 | | ".H265" |
846 | | }, |
847 | | // entry #49 |
848 | | { UID_HEVCMain10ProfileLevel5_1TransferSyntax, |
849 | | "HEVC/H.265 Main 10 Profile / Level 5.1", |
850 | | EXS_HEVCMain10ProfileLevel5_1, |
851 | | EBO_LittleEndian, |
852 | | EBO_LittleEndian, |
853 | | EVT_Explicit, |
854 | | EPE_Encapsulated, |
855 | | EPC_LossyCompressed, |
856 | | OFTrue, |
857 | | 0L, 0L, |
858 | | ESC_none, |
859 | | EXV_Standard, |
860 | | "video/H265", |
861 | | ".H265" |
862 | | }, |
863 | | // entry #50 |
864 | | { UID_JPEGXLLosslessTransferSyntax, |
865 | | "JPEG XL Lossless", |
866 | | EXS_JPEGXLLossless, |
867 | | EBO_LittleEndian, |
868 | | EBO_LittleEndian, |
869 | | EVT_Explicit, |
870 | | EPE_Encapsulated, |
871 | | EPC_LosslessCompressed, |
872 | | OFFalse, |
873 | | 0L, 0L, |
874 | | ESC_none, |
875 | | EXV_Standard, |
876 | | "image/jxl", |
877 | | ".jxl" |
878 | | }, |
879 | | // entry #51 |
880 | | { UID_JPEGXLJPEGRecompressionTransferSyntax, |
881 | | "JPEG XL JPEG Recompression", |
882 | | EXS_JPEGXLJPEGRecompression, |
883 | | EBO_LittleEndian, |
884 | | EBO_LittleEndian, |
885 | | EVT_Explicit, |
886 | | EPE_Encapsulated, |
887 | | EPC_LossyCompressed, |
888 | | OFFalse, |
889 | | 0L, 0L, |
890 | | ESC_none, |
891 | | EXV_Standard, |
892 | | "image/jxl", |
893 | | ".jxl" |
894 | | }, |
895 | | // entry #52 |
896 | | { UID_JPEGXLTransferSyntax, |
897 | | "JPEG XL", |
898 | | EXS_JPEGXL, |
899 | | EBO_LittleEndian, |
900 | | EBO_LittleEndian, |
901 | | EVT_Explicit, |
902 | | EPE_Encapsulated, |
903 | | EPC_LossyCompressed, |
904 | | OFFalse, |
905 | | 0L, 0L, |
906 | | ESC_none, |
907 | | EXV_Standard, |
908 | | "image/jxl", |
909 | | ".jxl" |
910 | | }, |
911 | | // entry #53 |
912 | | { UID_HighThroughputJPEG2000ImageCompressionLosslessOnlyTransferSyntax, |
913 | | "High-Throughput JPEG 2000 Image Compression (Lossless Only)", |
914 | | EXS_HighThroughputJPEG2000LosslessOnly, |
915 | | EBO_LittleEndian, |
916 | | EBO_LittleEndian, |
917 | | EVT_Explicit, |
918 | | EPE_Encapsulated, |
919 | | EPC_LosslessCompressed, |
920 | | OFFalse, |
921 | | 0L, 0L, |
922 | | ESC_none, |
923 | | EXV_Standard, |
924 | | "image/jphc", |
925 | | ".jphc" |
926 | | }, |
927 | | // entry #54 |
928 | | { UID_HighThroughputJPEG2000RPCLImageCompressionLosslessOnlyTransferSyntax, |
929 | | "High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)", |
930 | | EXS_HighThroughputJPEG2000withRPCLOptionsLosslessOnly, |
931 | | EBO_LittleEndian, |
932 | | EBO_LittleEndian, |
933 | | EVT_Explicit, |
934 | | EPE_Encapsulated, |
935 | | EPC_LosslessCompressed, |
936 | | OFFalse, |
937 | | 0L, 0L, |
938 | | ESC_none, |
939 | | EXV_Standard, |
940 | | "image/jphc", |
941 | | ".jphc" |
942 | | }, |
943 | | // entry #55 |
944 | | { UID_HighThroughputJPEG2000ImageCompressionTransferSyntax, |
945 | | "High-Throughput JPEG 2000 Image Compression", |
946 | | EXS_HighThroughputJPEG2000, |
947 | | EBO_LittleEndian, |
948 | | EBO_LittleEndian, |
949 | | EVT_Explicit, |
950 | | EPE_Encapsulated, |
951 | | EPC_LossyCompressed, |
952 | | OFFalse, |
953 | | 0L, 0L, |
954 | | ESC_none, |
955 | | EXV_Standard, |
956 | | "image/jphc", |
957 | | ".jphc" |
958 | | }, |
959 | | // entry #56 |
960 | | { UID_JPIPHTJ2KReferencedTransferSyntax, |
961 | | "JPIP HTJ2K Referenced", |
962 | | EXS_JPIPHTJ2KReferenced, |
963 | | EBO_LittleEndian, |
964 | | EBO_LittleEndian, |
965 | | EVT_Explicit, |
966 | | EPE_Referenced, |
967 | | EPC_unknown, |
968 | | OFFalse, |
969 | | 0L, 0L, |
970 | | ESC_none, |
971 | | EXV_Standard, |
972 | | DCXFER_DEFAULT_MIME_TYPE, |
973 | | DCXFER_DEFAULT_EXTENSION |
974 | | }, |
975 | | // entry #57 |
976 | | { UID_JPIPHTJ2KReferencedDeflateTransferSyntax, |
977 | | "JPIP HTJ2K Referenced Deflate", |
978 | | EXS_JPIPHTJ2KReferencedDeflate, |
979 | | EBO_LittleEndian, |
980 | | EBO_LittleEndian, |
981 | | EVT_Explicit, |
982 | | EPE_Referenced, |
983 | | EPC_unknown, |
984 | | OFFalse, |
985 | | 0L, 0L, |
986 | | #ifdef WITH_ZLIB |
987 | | ESC_zlib, |
988 | | #else |
989 | | ESC_unsupported, |
990 | | #endif |
991 | | EXV_Standard, |
992 | | DCXFER_DEFAULT_MIME_TYPE, |
993 | | DCXFER_DEFAULT_EXTENSION |
994 | | }, |
995 | | // entry #58 |
996 | | { UID_PrivateGE_LEI_WithBigEndianPixelDataTransferSyntax, |
997 | | "Private GE Little Endian Implicit with big endian pixel data", |
998 | | EXS_PrivateGE_LEI_WithBigEndianPixelData, |
999 | | EBO_LittleEndian, |
1000 | | EBO_BigEndian, |
1001 | | EVT_Implicit, |
1002 | | EPE_Native, |
1003 | | EPC_Uncompressed, |
1004 | | OFFalse, |
1005 | | 0L, 0L, |
1006 | | ESC_none, |
1007 | | EXV_Private, |
1008 | | DCXFER_DEFAULT_MIME_TYPE, |
1009 | | DCXFER_DEFAULT_EXTENSION |
1010 | | } |
1011 | | }; |
1012 | | |
1013 | | const int DIM_OF_XferNames = OFstatic_cast(int, sizeof(XferNames) / sizeof(S_XferNames)); |
1014 | | |
1015 | | |
1016 | | // ******************************** |
1017 | | |
1018 | | |
1019 | | DcmXfer::DcmXfer(E_TransferSyntax xfer) |
1020 | 1.06M | : xferID(""), |
1021 | 1.06M | xferName(ERROR_XferName), |
1022 | 1.06M | xferSyn(EXS_Unknown), |
1023 | 1.06M | byteOrder(EBO_unknown), |
1024 | 1.06M | pixelDataByteOrder(EBO_unknown), |
1025 | 1.06M | vrType(EVT_Implicit), |
1026 | 1.06M | pixelDataEncoding(EPE_unknown), |
1027 | 1.06M | pixelDataCompression(EPC_unknown), |
1028 | 1.06M | pixelDataFragmentable(OFFalse), |
1029 | 1.06M | JPEGProcess8(0L), |
1030 | 1.06M | JPEGProcess12(0L), |
1031 | 1.06M | streamCompression(ESC_none), |
1032 | 1.06M | xferValidity(EXV_unknown), |
1033 | 1.06M | mimeType(DCXFER_DEFAULT_MIME_TYPE), |
1034 | 1.06M | filenameExtension(DCXFER_DEFAULT_EXTENSION) |
1035 | 1.06M | { |
1036 | | /* casting the enum to an integer should be safe */ |
1037 | 1.06M | const int i = OFstatic_cast(int, xfer); |
1038 | | /* ... but double-check this to avoid invalid array access, e.g. for EXS_Unknown */ |
1039 | 1.06M | if ((i >= 0) && (i < DIM_OF_XferNames) && (XferNames[i].xfer == xfer)) |
1040 | 1.04M | { |
1041 | 1.04M | xferSyn = XferNames[i].xfer; |
1042 | 1.04M | xferID = XferNames[i].xferID; |
1043 | 1.04M | xferName = XferNames[i].xferName; |
1044 | 1.04M | byteOrder = XferNames[i].byteOrder; |
1045 | 1.04M | pixelDataByteOrder = XferNames[i].pixelDataByteOrder; |
1046 | 1.04M | vrType = XferNames[i].vrType; |
1047 | 1.04M | pixelDataEncoding = XferNames[i].pixelDataEncoding; |
1048 | 1.04M | pixelDataCompression = XferNames[i].pixelDataCompression; |
1049 | 1.04M | pixelDataFragmentable = XferNames[i].pixelDataFragmentable; |
1050 | 1.04M | JPEGProcess8 = XferNames[i].JPEGProcess8; |
1051 | 1.04M | JPEGProcess12 = XferNames[i].JPEGProcess12; |
1052 | 1.04M | streamCompression = XferNames[i].streamCompression; |
1053 | 1.04M | xferValidity = XferNames[i].xferValidity; |
1054 | 1.04M | mimeType = XferNames[i].mimeType; |
1055 | 1.04M | filenameExtension = XferNames[i].filenameExtension; |
1056 | 1.04M | } |
1057 | 1.06M | } |
1058 | | |
1059 | | |
1060 | | // ******************************** |
1061 | | |
1062 | | |
1063 | | DcmXfer::DcmXfer(const char *xferName_xferID) |
1064 | 2.13k | : xferID(""), |
1065 | 2.13k | xferName(ERROR_XferName), |
1066 | 2.13k | xferSyn(EXS_Unknown), |
1067 | 2.13k | byteOrder(EBO_unknown), |
1068 | 2.13k | pixelDataByteOrder(EBO_unknown), |
1069 | 2.13k | vrType(EVT_Implicit), |
1070 | 2.13k | pixelDataEncoding(EPE_unknown), |
1071 | 2.13k | pixelDataCompression(EPC_unknown), |
1072 | 2.13k | pixelDataFragmentable(OFFalse), |
1073 | 2.13k | JPEGProcess8(0L), |
1074 | 2.13k | JPEGProcess12(0L), |
1075 | 2.13k | streamCompression(ESC_none), |
1076 | 2.13k | xferValidity(EXV_unknown), |
1077 | 2.13k | mimeType(DCXFER_DEFAULT_MIME_TYPE), |
1078 | 2.13k | filenameExtension(DCXFER_DEFAULT_EXTENSION) |
1079 | 2.13k | { |
1080 | 2.13k | if (xferName_xferID != NULL) |
1081 | 2.12k | { |
1082 | 2.12k | int i; |
1083 | | /* first search for transfer syntax identifier (UID) */ |
1084 | 112k | for (i = 0; (i < DIM_OF_XferNames) && (strcmp(XferNames[i].xferID, xferName_xferID) != 0); ++i); |
1085 | | /* and then, if not found... */ |
1086 | 2.12k | if (i >= DIM_OF_XferNames) |
1087 | 553 | { |
1088 | | /* try with the transfer syntax name */ |
1089 | 33.1k | for (i = 0; (i < DIM_OF_XferNames) && (strcmp(XferNames[i].xferName, xferName_xferID) != 0); ++i); |
1090 | 553 | } |
1091 | 2.12k | if (i < DIM_OF_XferNames) |
1092 | 1.56k | { |
1093 | | /* if found, copy all properties */ |
1094 | 1.56k | xferSyn = XferNames[i].xfer; |
1095 | 1.56k | xferID = XferNames[i].xferID; |
1096 | 1.56k | xferName = XferNames[i].xferName; |
1097 | 1.56k | byteOrder = XferNames[i].byteOrder; |
1098 | 1.56k | pixelDataByteOrder = XferNames[i].pixelDataByteOrder; |
1099 | 1.56k | vrType = XferNames[i].vrType; |
1100 | 1.56k | pixelDataEncoding = XferNames[i].pixelDataEncoding; |
1101 | 1.56k | pixelDataCompression = XferNames[i].pixelDataCompression; |
1102 | 1.56k | pixelDataFragmentable = XferNames[i].pixelDataFragmentable; |
1103 | 1.56k | JPEGProcess8 = XferNames[i].JPEGProcess8; |
1104 | 1.56k | JPEGProcess12 = XferNames[i].JPEGProcess12; |
1105 | 1.56k | streamCompression = XferNames[i].streamCompression; |
1106 | 1.56k | xferValidity = XferNames[i].xferValidity; |
1107 | 1.56k | mimeType = XferNames[i].mimeType; |
1108 | 1.56k | filenameExtension = XferNames[i].filenameExtension; |
1109 | 1.56k | } |
1110 | 2.12k | } |
1111 | 2.13k | } |
1112 | | |
1113 | | |
1114 | | // ******************************** |
1115 | | |
1116 | | |
1117 | | DcmXfer::DcmXfer(const DcmXfer &newXfer) |
1118 | 0 | : xferID(newXfer.xferID), |
1119 | 0 | xferName(newXfer.xferName), |
1120 | 0 | xferSyn(newXfer.xferSyn), |
1121 | 0 | byteOrder(newXfer.byteOrder), |
1122 | 0 | pixelDataByteOrder(newXfer.pixelDataByteOrder), |
1123 | 0 | vrType(newXfer.vrType), |
1124 | 0 | pixelDataEncoding(newXfer.pixelDataEncoding), |
1125 | 0 | pixelDataCompression(newXfer.pixelDataCompression), |
1126 | 0 | pixelDataFragmentable(newXfer.pixelDataFragmentable), |
1127 | 0 | JPEGProcess8(newXfer.JPEGProcess8), |
1128 | 0 | JPEGProcess12(newXfer.JPEGProcess12), |
1129 | 0 | streamCompression(newXfer.streamCompression), |
1130 | 0 | xferValidity(newXfer.xferValidity), |
1131 | 0 | mimeType(newXfer.mimeType), |
1132 | 0 | filenameExtension(newXfer.filenameExtension) |
1133 | 0 | { |
1134 | 0 | } |
1135 | | |
1136 | | |
1137 | | // ******************************** |
1138 | | |
1139 | | |
1140 | | DcmXfer::~DcmXfer() |
1141 | 1.06M | { |
1142 | 1.06M | } |
1143 | | |
1144 | | |
1145 | | // ******************************** |
1146 | | |
1147 | | |
1148 | | DcmXfer &DcmXfer::operator=(const E_TransferSyntax xfer) |
1149 | 0 | { |
1150 | | /* casting the enum to an integer should be safe */ |
1151 | 0 | const int i = OFstatic_cast(int, xfer); |
1152 | | /* ... but double-check this to avoid invalid array access, e.g. for EXS_Unknown */ |
1153 | 0 | if ((i >= 0) && (i < DIM_OF_XferNames) && (XferNames[i].xfer == xfer)) |
1154 | 0 | { |
1155 | 0 | xferSyn = XferNames[i].xfer; |
1156 | 0 | xferID = XferNames[i].xferID; |
1157 | 0 | xferName = XferNames[i].xferName; |
1158 | 0 | byteOrder = XferNames[i].byteOrder; |
1159 | 0 | pixelDataByteOrder = XferNames[i].pixelDataByteOrder; |
1160 | 0 | vrType = XferNames[i].vrType; |
1161 | 0 | pixelDataEncoding = XferNames[i].pixelDataEncoding; |
1162 | 0 | pixelDataCompression = XferNames[i].pixelDataCompression; |
1163 | 0 | pixelDataFragmentable = XferNames[i].pixelDataFragmentable; |
1164 | 0 | JPEGProcess8 = XferNames[i].JPEGProcess8; |
1165 | 0 | JPEGProcess12 = XferNames[i].JPEGProcess12; |
1166 | 0 | streamCompression = XferNames[i].streamCompression; |
1167 | 0 | xferValidity = XferNames[i].xferValidity; |
1168 | 0 | mimeType = XferNames[i].mimeType; |
1169 | 0 | filenameExtension = XferNames[i].filenameExtension; |
1170 | 0 | } else { |
1171 | 0 | xferSyn = EXS_Unknown; |
1172 | 0 | xferID = ""; |
1173 | 0 | xferName = ERROR_XferName; |
1174 | 0 | byteOrder = EBO_unknown; |
1175 | 0 | pixelDataByteOrder = EBO_unknown; |
1176 | 0 | vrType = EVT_Implicit; |
1177 | 0 | pixelDataEncoding = EPE_unknown; |
1178 | 0 | pixelDataCompression = EPC_unknown; |
1179 | 0 | pixelDataFragmentable = OFFalse; |
1180 | 0 | JPEGProcess8 = 0L; |
1181 | 0 | JPEGProcess12 = 0L; |
1182 | 0 | streamCompression = ESC_none; |
1183 | 0 | xferValidity = EXV_unknown; |
1184 | 0 | mimeType = DCXFER_DEFAULT_MIME_TYPE; |
1185 | 0 | filenameExtension = DCXFER_DEFAULT_EXTENSION; |
1186 | 0 | } |
1187 | 0 | return *this; |
1188 | 0 | } |
1189 | | |
1190 | | |
1191 | | // ******************************** |
1192 | | |
1193 | | |
1194 | | DcmXfer &DcmXfer::operator=(const DcmXfer &newXfer) |
1195 | 0 | { |
1196 | 0 | if (this != &newXfer) |
1197 | 0 | { |
1198 | 0 | xferSyn = newXfer.xferSyn; |
1199 | 0 | xferID = newXfer.xferID; |
1200 | 0 | xferName = newXfer.xferName; |
1201 | 0 | byteOrder = newXfer.byteOrder; |
1202 | 0 | pixelDataByteOrder = newXfer.pixelDataByteOrder; |
1203 | 0 | vrType = newXfer.vrType; |
1204 | 0 | pixelDataEncoding = newXfer.pixelDataEncoding; |
1205 | 0 | pixelDataCompression = newXfer.pixelDataCompression; |
1206 | 0 | pixelDataFragmentable = newXfer.pixelDataFragmentable; |
1207 | 0 | JPEGProcess8 = newXfer.JPEGProcess8; |
1208 | 0 | JPEGProcess12 = newXfer.JPEGProcess12; |
1209 | 0 | streamCompression = newXfer.streamCompression; |
1210 | 0 | xferValidity = newXfer.xferValidity; |
1211 | 0 | mimeType = newXfer.mimeType; |
1212 | 0 | filenameExtension = newXfer.filenameExtension; |
1213 | 0 | } |
1214 | 0 | return *this; |
1215 | 0 | } |
1216 | | |
1217 | | |
1218 | | // ******************************** |
1219 | | |
1220 | | const char *DcmXfer::getXferKeyword() const |
1221 | 0 | { |
1222 | 0 | return dcmFindKeywordOfUID(xferID, "" /* defaultValue */); |
1223 | 0 | } |
1224 | | |
1225 | | // ******************************** |
1226 | | |
1227 | | Uint32 DcmXfer::sizeofTagHeader(DcmEVR evr) const |
1228 | 363k | { |
1229 | 363k | Uint32 len = 0; |
1230 | 363k | if (isExplicitVR()) |
1231 | 263k | { |
1232 | | // some VRs have an extended format |
1233 | 263k | DcmVR vr(evr); |
1234 | 263k | if (vr.usesExtendedLengthEncoding()) { |
1235 | 60.8k | len = 12; // for Tag, Length, VR and reserved |
1236 | 202k | } else { |
1237 | 202k | len = 8; // for Tag, Length and VR |
1238 | 202k | } |
1239 | 263k | } else { |
1240 | | // all implicit VRs have the same format |
1241 | 99.8k | len = 8; // for Tag and Length |
1242 | 99.8k | } |
1243 | 363k | return len; |
1244 | 363k | } |
1245 | | |
1246 | | // ******************************** |
1247 | | |
1248 | | static E_ByteOrder FindMachineTransferSyntax() |
1249 | 6 | { |
1250 | 6 | E_ByteOrder localByteOrderFlag; |
1251 | 6 | union |
1252 | 6 | { |
1253 | 6 | Uint32 ul; |
1254 | 6 | char uc[4]; |
1255 | 6 | } tl; |
1256 | | |
1257 | 6 | union |
1258 | 6 | { |
1259 | 6 | Uint16 us; |
1260 | 6 | char uc[2]; |
1261 | 6 | } ts; |
1262 | | |
1263 | 6 | tl.ul = 1; |
1264 | 6 | ts.us = 1; |
1265 | | |
1266 | 6 | if (tl.uc[0] == 1 && !(tl.uc[1] | tl.uc[2] | tl.uc[3]) && ts.uc[0] == 1 && !(ts.uc[1])) |
1267 | 6 | localByteOrderFlag = EBO_LittleEndian; |
1268 | 0 | else if (tl.uc[3] == 1 && !(tl.uc[0] | tl.uc[1] | tl.uc[2]) && ts.uc[1] == 1 && !(ts.uc[0])) |
1269 | 0 | localByteOrderFlag = EBO_BigEndian; |
1270 | 0 | else |
1271 | 0 | localByteOrderFlag = EBO_unknown; |
1272 | | |
1273 | 6 | return localByteOrderFlag; |
1274 | 6 | } |
1275 | | |
1276 | | // global constant: local byte order (little or big endian) |
1277 | | const E_ByteOrder gLocalByteOrder = FindMachineTransferSyntax(); |