comparison Core/DicomParsing/FromDcmtkBridge.cpp @ 3727:090022f1b5e1

auto-generation of primitives to handle transfer syntaxes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Mar 2020 17:10:03 +0100
parents 2a170a8f1faf
children ae31ba2b09a6
comparison
equal deleted inserted replaced
3726:7b7ca203f1a3 3727:090022f1b5e1
105 # include <EmbeddedResources.h> 105 # include <EmbeddedResources.h>
106 #endif 106 #endif
107 107
108 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 108 #if ORTHANC_ENABLE_DCMTK_JPEG == 1
109 # include <dcmtk/dcmjpeg/djdecode.h> 109 # include <dcmtk/dcmjpeg/djdecode.h>
110 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
111 # include <dcmtk/dcmjpeg/djencode.h>
112 # endif
110 #endif 113 #endif
111 114
112 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 115 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1
113 # include <dcmtk/dcmjpls/djdecode.h> 116 # include <dcmtk/dcmjpls/djdecode.h>
117 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
118 # include <dcmtk/dcmjpls/djencode.h>
119 # endif
114 #endif 120 #endif
115 121
116 122
117 namespace Orthanc 123 namespace Orthanc
118 { 124 {
2043 2049
2044 void FromDcmtkBridge::InitializeCodecs() 2050 void FromDcmtkBridge::InitializeCodecs()
2045 { 2051 {
2046 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 2052 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1
2047 LOG(INFO) << "Registering JPEG Lossless codecs in DCMTK"; 2053 LOG(INFO) << "Registering JPEG Lossless codecs in DCMTK";
2048 DJLSDecoderRegistration::registerCodecs(); 2054 DJLSDecoderRegistration::registerCodecs();
2055 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
2056 DJLSEncoderRegistration::registerCodecs();
2057 # endif
2049 #endif 2058 #endif
2050 2059
2051 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 2060 #if ORTHANC_ENABLE_DCMTK_JPEG == 1
2052 LOG(INFO) << "Registering JPEG codecs in DCMTK"; 2061 LOG(INFO) << "Registering JPEG codecs in DCMTK";
2053 DJDecoderRegistration::registerCodecs(); 2062 DJDecoderRegistration::registerCodecs();
2063 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
2064 DJEncoderRegistration::registerCodecs();
2065 # endif
2054 #endif 2066 #endif
2055 } 2067 }
2056 2068
2057 2069
2058 void FromDcmtkBridge::FinalizeCodecs() 2070 void FromDcmtkBridge::FinalizeCodecs()
2059 { 2071 {
2060 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 2072 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1
2061 // Unregister JPEG-LS codecs 2073 // Unregister JPEG-LS codecs
2062 DJLSDecoderRegistration::cleanup(); 2074 DJLSDecoderRegistration::cleanup();
2075 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
2076 DJLSEncoderRegistration::cleanup();
2077 # endif
2063 #endif 2078 #endif
2064 2079
2065 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 2080 #if ORTHANC_ENABLE_DCMTK_JPEG == 1
2066 // Unregister JPEG codecs 2081 // Unregister JPEG codecs
2067 DJDecoderRegistration::cleanup(); 2082 DJDecoderRegistration::cleanup();
2083 # if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
2084 DJDecoderRegistration::cleanup();
2085 # endif
2068 #endif 2086 #endif
2069 } 2087 }
2070 2088
2071 2089
2072 2090
2549 std::vector<size_t> parentIndexes; 2567 std::vector<size_t> parentIndexes;
2550 bool hasCodeExtensions; 2568 bool hasCodeExtensions;
2551 Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); 2569 Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding);
2552 ApplyVisitorToDataset(dataset, visitor, parentTags, parentIndexes, encoding, hasCodeExtensions); 2570 ApplyVisitorToDataset(dataset, visitor, parentTags, parentIndexes, encoding, hasCodeExtensions);
2553 } 2571 }
2572
2573
2574 // This function is autogenerated by the script
2575 // "Resources/GenerateTransferSyntaxes.py"
2576 bool FromDcmtkBridge::GetDcmtkTransferSyntax(E_TransferSyntax& target,
2577 DicomTransferSyntax syntax)
2578 {
2579 switch (syntax)
2580 {
2581 case DicomTransferSyntax_LittleEndianImplicit:
2582 target = EXS_LittleEndianImplicit;
2583 return true;
2584
2585 case DicomTransferSyntax_LittleEndianExplicit:
2586 target = EXS_LittleEndianExplicit;
2587 return true;
2588
2589 case DicomTransferSyntax_DeflatedLittleEndianExplicit:
2590 target = EXS_DeflatedLittleEndianExplicit;
2591 return true;
2592
2593 case DicomTransferSyntax_BigEndianExplicit:
2594 target = EXS_BigEndianExplicit;
2595 return true;
2596
2597 case DicomTransferSyntax_JPEGProcess1:
2598 target = EXS_JPEGProcess1;
2599 return true;
2600
2601 case DicomTransferSyntax_JPEGProcess2_4:
2602 target = EXS_JPEGProcess2_4;
2603 return true;
2604
2605 case DicomTransferSyntax_JPEGProcess3_5:
2606 target = EXS_JPEGProcess3_5;
2607 return true;
2608
2609 case DicomTransferSyntax_JPEGProcess6_8:
2610 target = EXS_JPEGProcess6_8;
2611 return true;
2612
2613 case DicomTransferSyntax_JPEGProcess7_9:
2614 target = EXS_JPEGProcess7_9;
2615 return true;
2616
2617 case DicomTransferSyntax_JPEGProcess10_12:
2618 target = EXS_JPEGProcess10_12;
2619 return true;
2620
2621 case DicomTransferSyntax_JPEGProcess11_13:
2622 target = EXS_JPEGProcess11_13;
2623 return true;
2624
2625 case DicomTransferSyntax_JPEGProcess14:
2626 target = EXS_JPEGProcess14;
2627 return true;
2628
2629 case DicomTransferSyntax_JPEGProcess15:
2630 target = EXS_JPEGProcess15;
2631 return true;
2632
2633 case DicomTransferSyntax_JPEGProcess16_18:
2634 target = EXS_JPEGProcess16_18;
2635 return true;
2636
2637 case DicomTransferSyntax_JPEGProcess17_19:
2638 target = EXS_JPEGProcess17_19;
2639 return true;
2640
2641 case DicomTransferSyntax_JPEGProcess20_22:
2642 target = EXS_JPEGProcess20_22;
2643 return true;
2644
2645 case DicomTransferSyntax_JPEGProcess21_23:
2646 target = EXS_JPEGProcess21_23;
2647 return true;
2648
2649 case DicomTransferSyntax_JPEGProcess24_26:
2650 target = EXS_JPEGProcess24_26;
2651 return true;
2652
2653 case DicomTransferSyntax_JPEGProcess25_27:
2654 target = EXS_JPEGProcess25_27;
2655 return true;
2656
2657 case DicomTransferSyntax_JPEGProcess28:
2658 target = EXS_JPEGProcess28;
2659 return true;
2660
2661 case DicomTransferSyntax_JPEGProcess29:
2662 target = EXS_JPEGProcess29;
2663 return true;
2664
2665 case DicomTransferSyntax_JPEGProcess14SV1:
2666 target = EXS_JPEGProcess14SV1;
2667 return true;
2668
2669 case DicomTransferSyntax_JPEGLSLossless:
2670 target = EXS_JPEGLSLossless;
2671 return true;
2672
2673 case DicomTransferSyntax_JPEGLSLossy:
2674 target = EXS_JPEGLSLossy;
2675 return true;
2676
2677 case DicomTransferSyntax_JPEG2000LosslessOnly:
2678 target = EXS_JPEG2000LosslessOnly;
2679 return true;
2680
2681 case DicomTransferSyntax_JPEG2000:
2682 target = EXS_JPEG2000;
2683 return true;
2684
2685 case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
2686 target = EXS_JPEG2000MulticomponentLosslessOnly;
2687 return true;
2688
2689 case DicomTransferSyntax_JPEG2000Multicomponent:
2690 target = EXS_JPEG2000Multicomponent;
2691 return true;
2692
2693 case DicomTransferSyntax_JPIPReferenced:
2694 target = EXS_JPIPReferenced;
2695 return true;
2696
2697 case DicomTransferSyntax_JPIPReferencedDeflate:
2698 target = EXS_JPIPReferencedDeflate;
2699 return true;
2700
2701 case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
2702 target = EXS_MPEG2MainProfileAtMainLevel;
2703 return true;
2704
2705 case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
2706 target = EXS_MPEG2MainProfileAtHighLevel;
2707 return true;
2708
2709 case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
2710 target = EXS_MPEG4HighProfileLevel4_1;
2711 return true;
2712
2713 case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
2714 target = EXS_MPEG4BDcompatibleHighProfileLevel4_1;
2715 return true;
2716
2717 case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
2718 target = EXS_MPEG4HighProfileLevel4_2_For2DVideo;
2719 return true;
2720
2721 case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
2722 target = EXS_MPEG4HighProfileLevel4_2_For3DVideo;
2723 return true;
2724
2725 case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
2726 target = EXS_MPEG4StereoHighProfileLevel4_2;
2727 return true;
2728
2729 #if DCMTK_VERSION_NUMBER >= 362
2730 case DicomTransferSyntax_HEVCMainProfileLevel5_1:
2731 target = EXS_HEVCMainProfileLevel5_1;
2732 return true;
2733 #endif
2734
2735 #if DCMTK_VERSION_NUMBER >= 362
2736 case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
2737 target = EXS_HEVCMain10ProfileLevel5_1;
2738 return true;
2739 #endif
2740
2741 case DicomTransferSyntax_RLELossless:
2742 target = EXS_RLELossless;
2743 return true;
2744
2745 default:
2746 return false;
2747 }
2748 }
2554 } 2749 }