Mercurial > hg > orthanc
comparison OrthancServer/Internals/DicomImageDecoder.cpp @ 2380:96b3ec054b69
reorganization in macros
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Aug 2017 16:49:44 +0200 |
parents | e002430baa41 |
children | b8969010b534 |
comparison
equal
deleted
inserted
replaced
2379:4900688827a8 | 2380:96b3ec054b69 |
---|---|
79 | 79 |
80 #include "../../Core/Logging.h" | 80 #include "../../Core/Logging.h" |
81 #include "../../Core/OrthancException.h" | 81 #include "../../Core/OrthancException.h" |
82 #include "../../Core/Images/Image.h" | 82 #include "../../Core/Images/Image.h" |
83 #include "../../Core/Images/ImageProcessing.h" | 83 #include "../../Core/Images/ImageProcessing.h" |
84 #include "../../Core/Images/PngWriter.h" | |
85 #include "../../Core/Images/JpegWriter.h" | |
86 #include "../../Core/DicomFormat/DicomIntegerPixelAccessor.h" | 84 #include "../../Core/DicomFormat/DicomIntegerPixelAccessor.h" |
87 #include "../ToDcmtkBridge.h" | 85 #include "../ToDcmtkBridge.h" |
88 #include "../FromDcmtkBridge.h" | 86 #include "../FromDcmtkBridge.h" |
89 #include "../ParsedDicomFile.h" | 87 #include "../ParsedDicomFile.h" |
90 #include "../OrthancInitialization.h" | 88 #include "../OrthancInitialization.h" |
91 | 89 |
90 #if ORTHANC_ENABLE_PNG == 1 | |
91 # include "../../Core/Images/PngWriter.h" | |
92 #endif | |
93 | |
94 #if ORTHANC_ENABLE_JPEG == 1 | |
95 # include "../../Core/Images/JpegWriter.h" | |
96 #endif | |
97 | |
92 #include <boost/lexical_cast.hpp> | 98 #include <boost/lexical_cast.hpp> |
93 | 99 |
94 #include <dcmtk/dcmdata/dcfilefo.h> | 100 #include <dcmtk/dcmdata/dcfilefo.h> |
95 #include <dcmtk/dcmdata/dcrleccd.h> | 101 #include <dcmtk/dcmdata/dcrleccd.h> |
96 #include <dcmtk/dcmdata/dcrlecp.h> | 102 #include <dcmtk/dcmdata/dcrlecp.h> |
97 | 103 |
98 #if ORTHANC_ENABLE_JPEG_LOSSLESS == 1 | 104 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 |
99 # include <dcmtk/dcmjpls/djcodecd.h> | 105 # include <dcmtk/dcmjpls/djcodecd.h> |
100 # include <dcmtk/dcmjpls/djcparam.h> | 106 # include <dcmtk/dcmjpls/djcparam.h> |
101 # include <dcmtk/dcmjpeg/djrplol.h> | 107 # include <dcmtk/dcmjpeg/djrplol.h> |
102 #endif | 108 #endif |
103 | 109 |
104 #if ORTHANC_ENABLE_JPEG == 1 | 110 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 |
105 # include <dcmtk/dcmjpeg/djcodecd.h> | 111 # include <dcmtk/dcmjpeg/djcodecd.h> |
106 # include <dcmtk/dcmjpeg/djcparam.h> | 112 # include <dcmtk/dcmjpeg/djcparam.h> |
107 # include <dcmtk/dcmjpeg/djdecbas.h> | 113 # include <dcmtk/dcmjpeg/djdecbas.h> |
108 # include <dcmtk/dcmjpeg/djdecext.h> | 114 # include <dcmtk/dcmjpeg/djdecext.h> |
109 # include <dcmtk/dcmjpeg/djdeclol.h> | 115 # include <dcmtk/dcmjpeg/djdeclol.h> |
516 { | 522 { |
517 return DecodeUncompressedImage(dataset, frame); | 523 return DecodeUncompressedImage(dataset, frame); |
518 } | 524 } |
519 | 525 |
520 | 526 |
521 #if ORTHANC_ENABLE_JPEG_LOSSLESS == 1 | 527 #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 |
522 /** | 528 /** |
523 * Deal with JPEG-LS images. | 529 * Deal with JPEG-LS images. |
524 **/ | 530 **/ |
525 | 531 |
526 if (syntax == EXS_JPEGLSLossless || | 532 if (syntax == EXS_JPEGLSLossless || |
548 return ApplyCodec(*decoder, parameters, dataset, frame); | 554 return ApplyCodec(*decoder, parameters, dataset, frame); |
549 } | 555 } |
550 #endif | 556 #endif |
551 | 557 |
552 | 558 |
553 #if ORTHANC_ENABLE_JPEG == 1 | 559 #if ORTHANC_ENABLE_DCMTK_JPEG == 1 |
554 /** | 560 /** |
555 * Deal with JPEG images. | 561 * Deal with JPEG images. |
556 **/ | 562 **/ |
557 | 563 |
558 if (syntax == EXS_JPEGProcess1 || // DJDecoderBaseline | 564 if (syntax == EXS_JPEGProcess1 || // DJDecoderBaseline |
773 throw OrthancException(ErrorCode_NotImplemented); | 779 throw OrthancException(ErrorCode_NotImplemented); |
774 } | 780 } |
775 } | 781 } |
776 | 782 |
777 | 783 |
784 #if ORTHANC_ENABLE_PNG == 1 | |
778 void DicomImageDecoder::ExtractPngImage(std::string& result, | 785 void DicomImageDecoder::ExtractPngImage(std::string& result, |
779 std::auto_ptr<ImageAccessor>& image, | 786 std::auto_ptr<ImageAccessor>& image, |
780 ImageExtractionMode mode, | 787 ImageExtractionMode mode, |
781 bool invert) | 788 bool invert) |
782 { | 789 { |
783 ApplyExtractionMode(image, mode, invert); | 790 ApplyExtractionMode(image, mode, invert); |
784 | 791 |
785 PngWriter writer; | 792 PngWriter writer; |
786 writer.WriteToMemory(result, *image); | 793 writer.WriteToMemory(result, *image); |
787 } | 794 } |
788 | 795 #endif |
789 | 796 |
797 | |
798 #if ORTHANC_ENABLE_JPEG == 1 | |
790 void DicomImageDecoder::ExtractJpegImage(std::string& result, | 799 void DicomImageDecoder::ExtractJpegImage(std::string& result, |
791 std::auto_ptr<ImageAccessor>& image, | 800 std::auto_ptr<ImageAccessor>& image, |
792 ImageExtractionMode mode, | 801 ImageExtractionMode mode, |
793 bool invert, | 802 bool invert, |
794 uint8_t quality) | 803 uint8_t quality) |
803 | 812 |
804 JpegWriter writer; | 813 JpegWriter writer; |
805 writer.SetQuality(quality); | 814 writer.SetQuality(quality); |
806 writer.WriteToMemory(result, *image); | 815 writer.WriteToMemory(result, *image); |
807 } | 816 } |
817 #endif | |
808 } | 818 } |