# HG changeset patch # User Sebastien Jodogne # Date 1504102990 -7200 # Node ID 75c779ca948c7ad097475154be47e17cfc6ef339 # Parent 807ddffc0eeb810ee1eb048a63859e26a3b27e24 fix compilation without Web server diff -r 807ddffc0eeb -r 75c779ca948c Core/DicomNetworking/IFindRequestHandler.h --- a/Core/DicomNetworking/IFindRequestHandler.h Wed Aug 30 13:27:05 2017 +0200 +++ b/Core/DicomNetworking/IFindRequestHandler.h Wed Aug 30 16:23:10 2017 +0200 @@ -35,6 +35,8 @@ #include "DicomFindAnswers.h" +#include + namespace Orthanc { class IFindRequestHandler : public boost::noncopyable diff -r 807ddffc0eeb -r 75c779ca948c Core/DicomParsing/ParsedDicomFile.cpp --- a/Core/DicomParsing/ParsedDicomFile.cpp Wed Aug 30 13:27:05 2017 +0200 +++ b/Core/DicomParsing/ParsedDicomFile.cpp Wed Aug 30 16:23:10 2017 +0200 @@ -146,9 +146,6 @@ #endif -static const char* CONTENT_TYPE_OCTET_STREAM = "application/octet-stream"; - - namespace Orthanc { @@ -159,6 +156,33 @@ }; +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 + static const char* CONTENT_TYPE_OCTET_STREAM = "application/octet-stream"; + + static void ParseTagAndGroup(DcmTagKey& key, + const std::string& tag) + { + DicomTag t = FromDcmtkBridge::ParseTag(tag); + key = DcmTagKey(t.GetGroup(), t.GetElement()); + } + + + static unsigned int GetPixelDataBlockCount(DcmPixelData& pixelData, + E_TransferSyntax transferSyntax) + { + DcmPixelSequence* pixelSequence = NULL; + if (pixelData.getEncapsulatedRepresentation + (transferSyntax, NULL, pixelSequence).good() && pixelSequence) + { + return pixelSequence->card(); + } + else + { + return 1; + } + } + + static void SendPathValueForDictionary(RestApiOutput& output, DcmItem& dicom) { @@ -178,33 +202,6 @@ output.AnswerJson(v); } - static inline uint16_t GetCharValue(char c) - { - if (c >= '0' && c <= '9') - return c - '0'; - else if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - else - return 0; - } - - static inline uint16_t GetTagValue(const char* c) - { - return ((GetCharValue(c[0]) << 12) + - (GetCharValue(c[1]) << 8) + - (GetCharValue(c[2]) << 4) + - GetCharValue(c[3])); - } - - static void ParseTagAndGroup(DcmTagKey& key, - const std::string& tag) - { - DicomTag t = FromDcmtkBridge::ParseTag(tag); - key = DcmTagKey(t.GetGroup(), t.GetElement()); - } - static void SendSequence(RestApiOutput& output, DcmSequenceOfItems& sequence) @@ -221,22 +218,6 @@ } - static unsigned int GetPixelDataBlockCount(DcmPixelData& pixelData, - E_TransferSyntax transferSyntax) - { - DcmPixelSequence* pixelSequence = NULL; - if (pixelData.getEncapsulatedRepresentation - (transferSyntax, NULL, pixelSequence).good() && pixelSequence) - { - return pixelSequence->card(); - } - else - { - return 1; - } - } - - namespace { class DicomFieldStream : public IHttpStreamAnswer @@ -413,7 +394,6 @@ } - static void SendPathValueForLeaf(RestApiOutput& output, const std::string& tag, DcmItem& dicom, @@ -441,7 +421,32 @@ output.AnswerStream(stream); } } +#endif + + static inline uint16_t GetCharValue(char c) + { + if (c >= '0' && c <= '9') + return c - '0'; + else if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + else + return 0; + } + + + static inline uint16_t GetTagValue(const char* c) + { + return ((GetCharValue(c[0]) << 12) + + (GetCharValue(c[1]) << 8) + + (GetCharValue(c[2]) << 4) + + GetCharValue(c[3])); + } + + +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void ParsedDicomFile::SendPathValue(RestApiOutput& output, const UriComponents& uri) { @@ -498,7 +503,8 @@ SendPathValueForLeaf(output, uri.back(), *dicom, transferSyntax); } } - +#endif + void ParsedDicomFile::Remove(const DicomTag& tag) { @@ -782,6 +788,7 @@ } +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void ParsedDicomFile::Answer(RestApiOutput& output) { std::string serialized; @@ -790,7 +797,7 @@ output.AnswerBuffer(serialized, CONTENT_TYPE_OCTET_STREAM); } } - +#endif bool ParsedDicomFile::GetTagValue(std::string& value, diff -r 807ddffc0eeb -r 75c779ca948c Core/DicomParsing/ParsedDicomFile.h --- a/Core/DicomParsing/ParsedDicomFile.h Wed Aug 30 13:27:05 2017 +0200 +++ b/Core/DicomParsing/ParsedDicomFile.h Wed Aug 30 16:23:10 2017 +0200 @@ -33,12 +33,6 @@ #pragma once -#include "../DicomFormat/DicomInstanceHasher.h" -#include "../Images/ImageAccessor.h" -#include "../IDynamicObject.h" -#include "../RestApi/RestApiOutput.h" -#include "../Toolbox.h" - #if !defined(ORTHANC_ENABLE_JPEG) # error Macro ORTHANC_ENABLE_JPEG must be defined to use this file #endif @@ -47,6 +41,24 @@ # error Macro ORTHANC_ENABLE_PNG must be defined to use this file #endif +#if !defined(ORTHANC_ENABLE_CIVETWEB) +# error Macro ORTHANC_ENABLE_CIVETWEB must be defined to use this file +#endif + +#if !defined(ORTHANC_ENABLE_MONGOOSE) +# error Macro ORTHANC_ENABLE_MONGOOSE must be defined to use this file +#endif + +#include "../DicomFormat/DicomInstanceHasher.h" +#include "../Images/ImageAccessor.h" +#include "../IDynamicObject.h" +#include "../Toolbox.h" + +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 +# include "../RestApi/RestApiOutput.h" +#endif + + class DcmDataset; class DcmFileFormat; @@ -96,10 +108,12 @@ ParsedDicomFile* Clone(); +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void SendPathValue(RestApiOutput& output, const UriComponents& uri); void Answer(RestApiOutput& output); +#endif void Remove(const DicomTag& tag); diff -r 807ddffc0eeb -r 75c779ca948c Core/FileStorage/StorageAccessor.cpp --- a/Core/FileStorage/StorageAccessor.cpp Wed Aug 30 13:27:05 2017 +0200 +++ b/Core/FileStorage/StorageAccessor.cpp Wed Aug 30 16:23:10 2017 +0200 @@ -36,10 +36,13 @@ #include "../Compression/ZlibCompressor.h" #include "../OrthancException.h" -#include "../HttpServer/HttpStreamTranscoder.h" #include "../Toolbox.h" #include "../SystemToolbox.h" +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 +# include "../HttpServer/HttpStreamTranscoder.h" +#endif + namespace Orthanc { FileInfo StorageAccessor::Write(const void* data, @@ -143,6 +146,7 @@ } +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void StorageAccessor::SetupSender(BufferHttpSender& sender, const FileInfo& info, const std::string& mime) @@ -168,8 +172,10 @@ sender.SetContentFilename(info.GetUuid() + std::string(extension)); } +#endif +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void StorageAccessor::AnswerFile(HttpOutput& output, const FileInfo& info, const std::string& mime) @@ -180,8 +186,10 @@ HttpStreamTranscoder transcoder(sender, info.GetCompressionType()); output.Answer(transcoder); } +#endif +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void StorageAccessor::AnswerFile(RestApiOutput& output, const FileInfo& info, const std::string& mime) @@ -192,4 +200,5 @@ HttpStreamTranscoder transcoder(sender, info.GetCompressionType()); output.AnswerStream(transcoder); } +#endif } diff -r 807ddffc0eeb -r 75c779ca948c Core/FileStorage/StorageAccessor.h --- a/Core/FileStorage/StorageAccessor.h Wed Aug 30 13:27:05 2017 +0200 +++ b/Core/FileStorage/StorageAccessor.h Wed Aug 30 16:23:10 2017 +0200 @@ -33,10 +33,21 @@ #pragma once +#if !defined(ORTHANC_ENABLE_CIVETWEB) +# error Macro ORTHANC_ENABLE_CIVETWEB must be defined to use this file +#endif + +#if !defined(ORTHANC_ENABLE_MONGOOSE) +# error Macro ORTHANC_ENABLE_MONGOOSE must be defined to use this file +#endif + #include "IStorageArea.h" #include "FileInfo.h" -#include "../HttpServer/BufferHttpSender.h" -#include "../RestApi/RestApiOutput.h" + +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 +# include "../HttpServer/BufferHttpSender.h" +# include "../RestApi/RestApiOutput.h" +#endif #include #include @@ -51,9 +62,11 @@ private: IStorageArea& area_; +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void SetupSender(BufferHttpSender& sender, const FileInfo& info, const std::string& mime); +#endif public: StorageAccessor(IStorageArea& area) : area_(area) @@ -86,6 +99,7 @@ area_.Remove(info.GetUuid(), info.GetContentType()); } +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void AnswerFile(HttpOutput& output, const FileInfo& info, const std::string& mime); @@ -93,5 +107,6 @@ void AnswerFile(RestApiOutput& output, const FileInfo& info, const std::string& mime); +#endif }; }