# HG changeset patch # User Sebastien Jodogne # Date 1604593249 -3600 # Node ID 785a2713323e10ca53800c8efc751d0ad3a42ca2 # Parent 3b70a2e6a06cc2b5ec6409f2695ba029e6ac7d7f abi continued diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Thu Nov 05 17:20:49 2020 +0100 @@ -179,13 +179,14 @@ if (ENABLE_MODULE_DICOM) list(APPEND ORTHANC_CORE_SOURCES_INTERNAL ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomArray.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomElement.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomImageInformation.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomInstanceHasher.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomIntegerPixelAccessor.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomMap.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomStreamReader.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomValue.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/StreamBlockReader.cpp - ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomStreamReader.cpp ) endif() diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Cache/MemoryStringCache.cpp --- a/OrthancFramework/Sources/Cache/MemoryStringCache.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Cache/MemoryStringCache.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -47,7 +47,7 @@ } }; - size_t Orthanc::MemoryStringCache::GetMaximumSize() + size_t MemoryStringCache::GetMaximumSize() { return cache_.GetMaximumSize(); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp --- a/OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -69,7 +69,7 @@ } - void Orthanc::DeflateBaseCompressor::SetPrefixWithUncompressedSize(bool prefix) + void DeflateBaseCompressor::SetPrefixWithUncompressedSize(bool prefix) { prefixWithUncompressedSize_ = prefix; } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Compression/GzipCompressor.cpp --- a/OrthancFramework/Sources/Compression/GzipCompressor.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Compression/GzipCompressor.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -75,7 +75,7 @@ } - Orthanc::GzipCompressor::GzipCompressor() + GzipCompressor::GzipCompressor() { SetPrefixWithUncompressedSize(false); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp --- a/OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -153,7 +153,7 @@ writer_.Close(); } - void Orthanc::HierarchicalZipWriter::SetZip64(bool isZip64) + void HierarchicalZipWriter::SetZip64(bool isZip64) { writer_.SetZip64(isZip64); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Compression/ZipWriter.cpp --- a/OrthancFramework/Sources/Compression/ZipWriter.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Compression/ZipWriter.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -264,9 +264,8 @@ return append_; } - bool Orthanc::ZipWriter::IsZip64() const + bool ZipWriter::IsZip64() const { return isZip64_; } - } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Compression/ZlibCompressor.cpp --- a/OrthancFramework/Sources/Compression/ZlibCompressor.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Compression/ZlibCompressor.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -32,7 +32,7 @@ namespace Orthanc { - Orthanc::ZlibCompressor::ZlibCompressor() + ZlibCompressor::ZlibCompressor() { SetPrefixWithUncompressedSize(true); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomArray.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomArray.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomArray.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -48,7 +48,7 @@ } - size_t Orthanc::DicomArray::GetSize() const + size_t DicomArray::GetSize() const { return elements_.size(); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomElement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancFramework/Sources/DicomFormat/DicomElement.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -0,0 +1,73 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2020 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * . + **/ + + +#include "../PrecompiledHeaders.h" +#include "DicomElement.h" + + +namespace Orthanc +{ + DicomElement::DicomElement(uint16_t group, + uint16_t element, + const DicomValue &value) : + tag_(group, element), + value_(value.Clone()) + { + } + + DicomElement::DicomElement(const DicomTag &tag, + const DicomValue &value) : + tag_(tag), + value_(value.Clone()) + { + } + + DicomElement::~DicomElement() + { + delete value_; + } + + const DicomTag &DicomElement::GetTag() const + { + return tag_; + } + + const DicomValue &DicomElement::GetValue() const + { + return *value_; + } + + uint16_t DicomElement::GetTagGroup() const + { + return tag_.GetGroup(); + } + + uint16_t DicomElement::GetTagElement() const + { + return tag_.GetElement(); + } + + bool DicomElement::operator<(const DicomElement &other) const + { + return GetTag() < other.GetTag(); + } +} diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomElement.h --- a/OrthancFramework/Sources/DicomFormat/DicomElement.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomElement.h Thu Nov 05 17:20:49 2020 +0100 @@ -36,47 +36,21 @@ public: DicomElement(uint16_t group, uint16_t element, - const DicomValue& value) : - tag_(group, element), - value_(value.Clone()) - { - } + const DicomValue& value); DicomElement(const DicomTag& tag, - const DicomValue& value) : - tag_(tag), - value_(value.Clone()) - { - } + const DicomValue& value); - ~DicomElement() - { - delete value_; - } + ~DicomElement(); - const DicomTag& GetTag() const - { - return tag_; - } + const DicomTag& GetTag() const; - const DicomValue& GetValue() const - { - return *value_; - } + const DicomValue& GetValue() const; - uint16_t GetTagGroup() const - { - return tag_.GetGroup(); - } + uint16_t GetTagGroup() const; - uint16_t GetTagElement() const - { - return tag_.GetElement(); - } + uint16_t GetTagElement() const; - bool operator< (const DicomElement& other) const - { - return GetTag() < other.GetTag(); - } + bool operator< (const DicomElement& other) const; }; } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -210,12 +210,12 @@ return target.release(); } - unsigned int Orthanc::DicomImageInformation::GetWidth() const + unsigned int DicomImageInformation::GetWidth() const { return width_; } - unsigned int Orthanc::DicomImageInformation::GetHeight() const + unsigned int DicomImageInformation::GetHeight() const { return height_; } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -56,10 +56,10 @@ instance.GetValue(DICOM_TAG_SOP_INSTANCE_UID).GetContent()); } - Orthanc::DicomInstanceHasher::DicomInstanceHasher(const std::string &patientId, - const std::string &studyUid, - const std::string &seriesUid, - const std::string &instanceUid) + DicomInstanceHasher::DicomInstanceHasher(const std::string &patientId, + const std::string &studyUid, + const std::string &seriesUid, + const std::string &instanceUid) { Setup(patientId, studyUid, seriesUid, instanceUid); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomMap.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -332,7 +332,7 @@ } - Orthanc::DicomMap::~DicomMap() + DicomMap::~DicomMap() { Clear(); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomTag.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomTag.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomTag.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -54,6 +54,28 @@ } + DicomTag::DicomTag(uint16_t group, uint16_t element) : + group_(group), + element_(element) + { + } + + uint16_t DicomTag::GetGroup() const + { + return group_; + } + + uint16_t DicomTag::GetElement() const + { + return element_; + } + + bool DicomTag::IsPrivate() const + { + return group_ % 2 == 1; + } + + bool DicomTag::operator< (const DicomTag& other) const { if (group_ < other.group_) @@ -77,6 +99,26 @@ return element_ <= other.element_; } + bool DicomTag::operator>(const DicomTag &other) const + { + return !(*this <= other); + } + + bool DicomTag::operator>=(const DicomTag &other) const + { + return !(*this < other); + } + + bool DicomTag::operator==(const DicomTag &other) const + { + return group_ == other.group_ && element_ == other.element_; + } + + bool DicomTag::operator!=(const DicomTag &other) const + { + return !(*this == other); + } + std::ostream& operator<< (std::ostream& o, const DicomTag& tag) { diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomTag.h --- a/OrthancFramework/Sources/DicomFormat/DicomTag.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomTag.h Thu Nov 05 17:20:49 2020 +0100 @@ -40,26 +40,13 @@ public: DicomTag(uint16_t group, - uint16_t element) : - group_(group), - element_(element) - { - } + uint16_t element); + + uint16_t GetGroup() const; - uint16_t GetGroup() const - { - return group_; - } + uint16_t GetElement() const; - uint16_t GetElement() const - { - return element_; - } - - bool IsPrivate() const - { - return group_ % 2 == 1; - } + bool IsPrivate() const; const char* GetMainTagsName() const; @@ -67,25 +54,13 @@ bool operator<= (const DicomTag& other) const; - bool operator> (const DicomTag& other) const - { - return !(*this <= other); - } + bool operator> (const DicomTag& other) const; - bool operator>= (const DicomTag& other) const - { - return !(*this < other); - } + bool operator>= (const DicomTag& other) const; - bool operator== (const DicomTag& other) const - { - return group_ == other.group_ && element_ == other.element_; - } + bool operator== (const DicomTag& other) const; - bool operator!= (const DicomTag& other) const - { - return !(*this == other); - } + bool operator!= (const DicomTag& other) const; std::string Format() const; diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/DicomValue.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomValue.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomValue.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -31,7 +31,7 @@ namespace Orthanc { - Orthanc::DicomValue::DicomValue() : + DicomValue::DicomValue() : type_(Type_Null) { } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomFormat/StreamBlockReader.cpp --- a/OrthancFramework/Sources/DicomFormat/StreamBlockReader.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/StreamBlockReader.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -86,7 +86,7 @@ } } - uint64_t Orthanc::StreamBlockReader::GetProcessedBytes() const + uint64_t StreamBlockReader::GetProcessedBytes() const { return processedBytes_; } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp --- a/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -44,6 +44,12 @@ namespace Orthanc { + DcmtkTranscoder::DcmtkTranscoder() : + lossyQuality_(90) + { + } + + static bool GetBitsStored(uint16_t& bitsStored, DcmDataset& dataset) { @@ -68,7 +74,12 @@ } } - + unsigned int DcmtkTranscoder::GetLossyQuality() const + { + return lossyQuality_; + } + + bool DcmtkTranscoder::InplaceTranscode(DicomTransferSyntax& selectedSyntax /* out */, DcmFileFormat& dicom, const std::set& allowedSyntaxes, @@ -224,7 +235,6 @@ return false; } - bool DcmtkTranscoder::IsSupported(DicomTransferSyntax syntax) { if (syntax == DicomTransferSyntax_LittleEndianImplicit || diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.h --- a/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.h Thu Nov 05 17:20:49 2020 +0100 @@ -45,17 +45,11 @@ bool allowNewSopInstanceUid); public: - DcmtkTranscoder() : - lossyQuality_(90) - { - } + DcmtkTranscoder(); void SetLossyQuality(unsigned int quality); - unsigned int GetLossyQuality() const - { - return lossyQuality_; - } + unsigned int GetLossyQuality() const; static bool IsSupported(DicomTransferSyntax syntax); diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/DicomModification.cpp --- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -487,6 +487,11 @@ } } + bool DicomModification::ArePrivateTagsRemoved() const + { + return removePrivateTags_; + } + void DicomModification::SetLevel(ResourceType level) { uidMap_.clear(); @@ -498,6 +503,11 @@ } } + ResourceType DicomModification::GetLevel() const + { + return level_; + } + void DicomModification::SetupAnonymization2008() { @@ -1123,6 +1133,16 @@ } } + void DicomModification::SetAllowManualIdentifiers(bool check) + { + allowManualIdentifiers_ = check; + } + + bool DicomModification::AreAllowManualIdentifiers() const + { + return allowManualIdentifiers_; + } + static bool IsDatabaseKey(const DicomTag& tag) { @@ -1334,6 +1354,11 @@ } } + void DicomModification::SetDicomIdentifierGenerator(DicomModification::IDicomIdentifierGenerator &generator) + { + identifierGenerator_ = &generator; + } + @@ -1430,7 +1455,6 @@ } } - void DicomModification::UnserializeUidMap(ResourceType level, const Json::Value& serialized, const char* field) @@ -1508,4 +1532,15 @@ UnserializeUidMap(ResourceType_Series, serialized, MAP_SERIES); UnserializeUidMap(ResourceType_Instance, serialized, MAP_INSTANCES); } + + + void DicomModification::SetPrivateCreator(const std::string &privateCreator) + { + privateCreator_ = privateCreator; + } + + const std::string &DicomModification::GetPrivateCreator() const + { + return privateCreator_; + } } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/DicomModification.h --- a/OrthancFramework/Sources/DicomParsing/DicomModification.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.h Thu Nov 05 17:20:49 2020 +0100 @@ -1,4 +1,4 @@ -/** +/** * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium @@ -139,52 +139,31 @@ void SetRemovePrivateTags(bool removed); - bool ArePrivateTagsRemoved() const - { - return removePrivateTags_; - } + bool ArePrivateTagsRemoved() const; void SetLevel(ResourceType level); - ResourceType GetLevel() const - { - return level_; - } + ResourceType GetLevel() const; void SetupAnonymization(DicomVersion version); void Apply(ParsedDicomFile& toModify); - void SetAllowManualIdentifiers(bool check) - { - allowManualIdentifiers_ = check; - } + void SetAllowManualIdentifiers(bool check); - bool AreAllowManualIdentifiers() const - { - return allowManualIdentifiers_; - } + bool AreAllowManualIdentifiers() const; void ParseModifyRequest(const Json::Value& request); void ParseAnonymizationRequest(bool& patientNameReplaced, const Json::Value& request); - void SetDicomIdentifierGenerator(IDicomIdentifierGenerator& generator) - { - identifierGenerator_ = &generator; - } + void SetDicomIdentifierGenerator(IDicomIdentifierGenerator& generator); void Serialize(Json::Value& value) const; - void SetPrivateCreator(const std::string& privateCreator) - { - privateCreator_ = privateCreator; - } + void SetPrivateCreator(const std::string& privateCreator); - const std::string& GetPrivateCreator() - { - return privateCreator_; - } + const std::string& GetPrivateCreator() const; }; } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp --- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -336,6 +336,27 @@ } } + DicomWebJsonVisitor::DicomWebJsonVisitor() : + formatter_(NULL) + { + Clear(); + } + + void DicomWebJsonVisitor::SetFormatter(DicomWebJsonVisitor::IBinaryFormatter &formatter) + { + formatter_ = &formatter; + } + + void DicomWebJsonVisitor::Clear() + { + result_ = Json::objectValue; + } + + const Json::Value &DicomWebJsonVisitor::GetResult() const + { + return result_; + } + #if ORTHANC_ENABLE_PUGIXML == 1 void DicomWebJsonVisitor::FormatXml(std::string& target) const @@ -347,6 +368,14 @@ #endif + void DicomWebJsonVisitor::VisitNotSupported(const std::vector &parentTags, + const std::vector &parentIndexes, + const DicomTag &tag, + ValueRepresentation vr) + { + } + + void DicomWebJsonVisitor::VisitEmptySequence(const std::vector& parentTags, const std::vector& parentIndexes, const DicomTag& tag) @@ -597,7 +626,7 @@ * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ **/ - std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); + std::string t = Toolbox::StripSpaces(tokens[i]); if (t.empty()) { node[KEY_VALUE].append(Json::nullValue); @@ -613,7 +642,7 @@ case ValueRepresentation_DecimalString: { - std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); + std::string t = Toolbox::StripSpaces(tokens[i]); if (t.empty()) { node[KEY_VALUE].append(Json::nullValue); diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.h --- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.h Thu Nov 05 17:20:49 2020 +0100 @@ -73,26 +73,13 @@ static Json::Value FormatDouble(double value); public: - DicomWebJsonVisitor() : - formatter_(NULL) - { - Clear(); - } + DicomWebJsonVisitor(); - void SetFormatter(IBinaryFormatter& formatter) - { - formatter_ = &formatter; - } + void SetFormatter(IBinaryFormatter& formatter); - void Clear() - { - result_ = Json::objectValue; - } + void Clear(); - const Json::Value& GetResult() const - { - return result_; - } + const Json::Value& GetResult() const; #if ORTHANC_ENABLE_PUGIXML == 1 void FormatXml(std::string& target) const; @@ -102,9 +89,7 @@ const std::vector& parentIndexes, const DicomTag& tag, ValueRepresentation vr) - ORTHANC_OVERRIDE - { - } + ORTHANC_OVERRIDE; virtual void VisitEmptySequence(const std::vector& parentTags, const std::vector& parentIndexes, diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -467,7 +467,15 @@ } - void FromDcmtkBridge::ExtractDicomSummary(DicomMap& target, + Encoding FromDcmtkBridge::DetectEncoding(DcmItem &dataset, + Encoding defaultEncoding) + { + bool hasCodeExtensions; // ignored + return DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); + } + + + void FromDcmtkBridge::ExtractDicomSummary(DicomMap& target, DcmItem& dataset, unsigned int maxStringLength, const std::set& ignoreTagLength) @@ -1069,6 +1077,11 @@ return GetTagNameInternal(tag); } + std::string FromDcmtkBridge::GetTagName(const DicomElement &element) + { + return GetTagName(element.GetTag(), ""); + } + DicomTag FromDcmtkBridge::ParseTag(const char* name) @@ -1109,6 +1122,30 @@ #endif } + DicomTag FromDcmtkBridge::ParseTag(const std::string &name) + { + return ParseTag(name.c_str()); + } + + bool FromDcmtkBridge::HasTag(const DicomMap &fields, const std::string &tagName) + { + return fields.HasTag(ParseTag(tagName)); + } + + const DicomValue &FromDcmtkBridge::GetValue(const DicomMap &fields, + const std::string &tagName) + { + return fields.GetValue(ParseTag(tagName)); + } + + void FromDcmtkBridge::SetValue(DicomMap &target, + const std::string &tagName, + DicomValue *value) + { + const DicomTag tag = ParseTag(tagName); + target.SetValueInternal(tag.GetGroup(), tag.GetElement(), value); + } + bool FromDcmtkBridge::IsUnknownTag(const DicomTag& tag) { diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Thu Nov 05 17:20:49 2020 +0100 @@ -99,13 +99,9 @@ DcmItem& dataset, Encoding defaultEncoding); + // Compatibility wrapper for Orthanc <= 1.5.4 static Encoding DetectEncoding(DcmItem& dataset, - Encoding defaultEncoding) - { - // Compatibility wrapper for Orthanc <= 1.5.4 - bool hasCodeExtensions; // ignored - return DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); - } + Encoding defaultEncoding); static DicomTag Convert(const DcmTag& tag); @@ -131,37 +127,21 @@ static std::string GetTagName(const DcmElement& element); - static std::string GetTagName(const DicomElement& element) - { - return GetTagName(element.GetTag(), ""); - } + static std::string GetTagName(const DicomElement& element); static DicomTag ParseTag(const char* name); - static DicomTag ParseTag(const std::string& name) - { - return ParseTag(name.c_str()); - } + static DicomTag ParseTag(const std::string& name); static bool HasTag(const DicomMap& fields, - const std::string& tagName) - { - return fields.HasTag(ParseTag(tagName)); - } + const std::string& tagName); static const DicomValue& GetValue(const DicomMap& fields, - const std::string& tagName) - { - return fields.GetValue(ParseTag(tagName)); - } + const std::string& tagName); static void SetValue(DicomMap& target, const std::string& tagName, - DicomValue* value) - { - const DicomTag tag = ParseTag(tagName); - target.SetValueInternal(tag.GetGroup(), tag.GetElement(), value); - } + DicomValue* value); static void ToJson(Json::Value& result, const DicomMap& values, diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp --- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -971,7 +971,7 @@ if (invert) { - Orthanc::ImageProcessing::Invert(*image); + ImageProcessing::Invert(*image); } } else diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp --- a/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -142,6 +142,16 @@ } } + ParsedDicomDir::~ParsedDicomDir() + { + Clear(); + } + + size_t ParsedDicomDir::GetSize() const + { + return content_.size(); + } + const DicomMap& ParsedDicomDir::GetItem(size_t i) const { diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/ParsedDicomDir.h --- a/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.h Thu Nov 05 17:20:49 2020 +0100 @@ -48,15 +48,9 @@ public: explicit ParsedDicomDir(const std::string& content); - ~ParsedDicomDir() - { - Clear(); - } + ~ParsedDicomDir(); - size_t GetSize() const - { - return content_.size(); - } + size_t GetSize() const; const DicomMap& GetItem(size_t i) const; diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp --- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -1159,7 +1159,7 @@ } } - Orthanc::ParsedDicomFile *Orthanc::ParsedDicomFile::AcquireDcmtkObject(DcmFileFormat *dicom) // No clone here + ParsedDicomFile *ParsedDicomFile::AcquireDcmtkObject(DcmFileFormat *dicom) // No clone here { return new ParsedDicomFile(dicom); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/FileStorage/StorageAccessor.cpp --- a/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -58,6 +58,19 @@ }; + StorageAccessor::StorageAccessor(IStorageArea &area) : + area_(area), + metrics_(NULL) + { + } + + StorageAccessor::StorageAccessor(IStorageArea &area, MetricsRegistry &metrics) : + area_(area), + metrics_(&metrics) + { + } + + FileInfo StorageAccessor::Write(const void* data, size_t size, FileContentType type, @@ -119,16 +132,25 @@ } } + FileInfo StorageAccessor::Write(const std::string &data, + FileContentType type, + CompressionType compression, + bool storeMd5) + { + return Write((data.size() == 0 ? NULL : data.c_str()), + data.size(), type, compression, storeMd5); + } + void StorageAccessor::Read(std::string& content, const FileInfo& info) { switch (info.GetCompressionType()) { - case CompressionType_None: - { - MetricsTimer timer(*this, METRICS_READ); - area_.Read(content, info.GetUuid(), info.GetContentType()); + case CompressionType_None: + { + MetricsTimer timer(*this, METRICS_READ); + area_.Read(content, info.GetUuid(), info.GetContentType()); break; } @@ -172,6 +194,10 @@ area_.Remove(fileUuid, type); } + void StorageAccessor::Remove(const FileInfo &info) + { + Remove(info.GetUuid(), info.GetContentType()); + } #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void StorageAccessor::SetupSender(BufferHttpSender& sender, @@ -209,6 +235,16 @@ #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void StorageAccessor::AnswerFile(HttpOutput& output, const FileInfo& info, + MimeType mime) + { + AnswerFile(output, info, EnumerationToString(mime)); + } +#endif + + +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 + void StorageAccessor::AnswerFile(HttpOutput& output, + const FileInfo& info, const std::string& mime) { BufferHttpSender sender; @@ -223,6 +259,16 @@ #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void StorageAccessor::AnswerFile(RestApiOutput& output, const FileInfo& info, + MimeType mime) + { + AnswerFile(output, info, EnumerationToString(mime)); + } +#endif + + +#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 + void StorageAccessor::AnswerFile(RestApiOutput& output, + const FileInfo& info, const std::string& mime) { BufferHttpSender sender; diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/FileStorage/StorageAccessor.h --- a/OrthancFramework/Sources/FileStorage/StorageAccessor.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/FileStorage/StorageAccessor.h Thu Nov 05 17:20:49 2020 +0100 @@ -75,18 +75,10 @@ #endif public: - explicit StorageAccessor(IStorageArea& area) : - area_(area), - metrics_(NULL) - { - } + explicit StorageAccessor(IStorageArea& area); StorageAccessor(IStorageArea& area, - MetricsRegistry& metrics) : - area_(area), - metrics_(&metrics) - { - } + MetricsRegistry& metrics); FileInfo Write(const void* data, size_t size, @@ -94,14 +86,10 @@ CompressionType compression, bool storeMd5); - FileInfo Write(const std::string& data, + FileInfo Write(const std::string& data, FileContentType type, CompressionType compression, - bool storeMd5) - { - return Write((data.size() == 0 ? NULL : data.c_str()), - data.size(), type, compression, storeMd5); - } + bool storeMd5); void Read(std::string& content, const FileInfo& info); @@ -112,18 +100,12 @@ void Remove(const std::string& fileUuid, FileContentType type); - void Remove(const FileInfo& info) - { - Remove(info.GetUuid(), info.GetContentType()); - } + void Remove(const FileInfo& info); #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 void AnswerFile(HttpOutput& output, const FileInfo& info, - MimeType mime) - { - AnswerFile(output, info, EnumerationToString(mime)); - } + MimeType mime); void AnswerFile(HttpOutput& output, const FileInfo& info, @@ -131,10 +113,7 @@ void AnswerFile(RestApiOutput& output, const FileInfo& info, - MimeType mime) - { - AnswerFile(output, info, EnumerationToString(mime)); - } + MimeType mime); void AnswerFile(RestApiOutput& output, const FileInfo& info, diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/HttpClient.cpp --- a/OrthancFramework/Sources/HttpClient.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/HttpClient.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -677,6 +677,41 @@ curl_easy_cleanup(pimpl_->curl_); } + void HttpClient::SetUrl(const char *url) + { + url_ = std::string(url); + } + + void HttpClient::SetUrl(const std::string &url) + { + url_ = url; + } + + const std::string &HttpClient::GetUrl() const + { + return url_; + } + + void HttpClient::SetMethod(HttpMethod method) + { + method_ = method; + } + + HttpMethod HttpClient::GetMethod() const + { + return method_; + } + + void HttpClient::SetTimeout(long seconds) + { + timeout_ = seconds; + } + + long HttpClient::GetTimeout() const + { + return timeout_; + } + void HttpClient::SetBody(const std::string& data) { @@ -684,6 +719,16 @@ pimpl_->requestBody_.Clear(); } + std::string &HttpClient::GetBody() + { + return body_; + } + + const std::string &HttpClient::GetBody() const + { + return body_; + } + void HttpClient::SetBody(IRequestBody& body) { @@ -714,6 +759,11 @@ } } + bool HttpClient::IsVerbose() const + { + return isVerbose_; + } + void HttpClient::AddHeader(const std::string& key, const std::string& value) @@ -1033,6 +1083,31 @@ credentials_ = std::string(username) + ":" + std::string(password); } + void HttpClient::SetProxy(const std::string &proxy) + { + proxy_ = proxy; + } + + void HttpClient::SetHttpsVerifyPeers(bool verify) + { + verifyPeers_ = verify; + } + + bool HttpClient::IsHttpsVerifyPeers() const + { + return verifyPeers_; + } + + void HttpClient::SetHttpsCACertificates(const std::string &certificates) + { + caCertificates_ = certificates; + } + + const std::string &HttpClient::GetHttpsCACertificates() const + { + return caCertificates_; + } + void HttpClient::ConfigureSsl(bool httpsVerifyPeers, const std::string& httpsVerifyCertificates) @@ -1104,6 +1179,33 @@ return ApplyInternal(wrapper); } + bool HttpClient::Apply(std::string &answerBody) + { + return ApplyInternal(answerBody, NULL); + } + + bool HttpClient::Apply(Json::Value &answerBody) + { + return ApplyInternal(answerBody, NULL); + } + + bool HttpClient::Apply(std::string &answerBody, + HttpClient::HttpHeaders &answerHeaders) + { + return ApplyInternal(answerBody, &answerHeaders); + } + + bool HttpClient::Apply(Json::Value &answerBody, + HttpClient::HttpHeaders &answerHeaders) + { + return ApplyInternal(answerBody, &answerHeaders); + } + + HttpStatus HttpClient::GetLastStatus() const + { + return lastStatus_; + } + void HttpClient::ApplyAndThrowException(IAnswer& answer) { @@ -1181,6 +1283,51 @@ clientCertificateKeyPassword_ = certificateKeyPassword; } + void HttpClient::SetPkcs11Enabled(bool enabled) + { + pkcs11Enabled_ = enabled; + } + + bool HttpClient::IsPkcs11Enabled() const + { + return pkcs11Enabled_; + } + + const std::string &HttpClient::GetClientCertificateFile() const + { + return clientCertificateFile_; + } + + const std::string &HttpClient::GetClientCertificateKeyFile() const + { + return clientCertificateKeyFile_; + } + + const std::string &HttpClient::GetClientCertificateKeyPassword() const + { + return clientCertificateKeyPassword_; + } + + void HttpClient::SetConvertHeadersToLowerCase(bool lowerCase) + { + headersToLowerCase_ = lowerCase; + } + + bool HttpClient::IsConvertHeadersToLowerCase() const + { + return headersToLowerCase_; + } + + void HttpClient::SetRedirectionFollowed(bool follow) + { + redirectionFollowed_ = follow; + } + + bool HttpClient::IsRedirectionFollowed() const + { + return redirectionFollowed_; + } + void HttpClient::InitializePkcs11(const std::string& module, const std::string& pin, diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/HttpClient.h --- a/OrthancFramework/Sources/HttpClient.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/HttpClient.h Thu Nov 05 17:20:49 2020 +0100 @@ -127,52 +127,25 @@ ~HttpClient(); - void SetUrl(const char* url) - { - url_ = std::string(url); - } + void SetUrl(const char* url); - void SetUrl(const std::string& url) - { - url_ = url; - } + void SetUrl(const std::string& url); - const std::string& GetUrl() const - { - return url_; - } + const std::string& GetUrl() const; - void SetMethod(HttpMethod method) - { - method_ = method; - } + void SetMethod(HttpMethod method); - HttpMethod GetMethod() const - { - return method_; - } + HttpMethod GetMethod() const; - void SetTimeout(long seconds) - { - timeout_ = seconds; - } + void SetTimeout(long seconds); - long GetTimeout() const - { - return timeout_; - } + long GetTimeout() const; void SetBody(const std::string& data); - std::string& GetBody() - { - return body_; - } + std::string& GetBody(); - const std::string& GetBody() const - { - return body_; - } + const std::string& GetBody() const; void SetBody(IRequestBody& body); @@ -180,10 +153,7 @@ void SetVerbose(bool isVerbose); - bool IsVerbose() const - { - return isVerbose_; - } + bool IsVerbose() const; void AddHeader(const std::string& key, const std::string& value); @@ -192,109 +162,52 @@ bool Apply(IAnswer& answer); - bool Apply(std::string& answerBody) - { - return ApplyInternal(answerBody, NULL); - } + bool Apply(std::string& answerBody); - bool Apply(Json::Value& answerBody) - { - return ApplyInternal(answerBody, NULL); - } + bool Apply(Json::Value& answerBody); bool Apply(std::string& answerBody, - HttpHeaders& answerHeaders) - { - return ApplyInternal(answerBody, &answerHeaders); - } + HttpHeaders& answerHeaders); bool Apply(Json::Value& answerBody, - HttpHeaders& answerHeaders) - { - return ApplyInternal(answerBody, &answerHeaders); - } + HttpHeaders& answerHeaders); - HttpStatus GetLastStatus() const - { - return lastStatus_; - } + HttpStatus GetLastStatus() const; void SetCredentials(const char* username, const char* password); - void SetProxy(const std::string& proxy) - { - proxy_ = proxy; - } + void SetProxy(const std::string& proxy); - void SetHttpsVerifyPeers(bool verify) - { - verifyPeers_ = verify; - } + void SetHttpsVerifyPeers(bool verify); - bool IsHttpsVerifyPeers() const - { - return verifyPeers_; - } + bool IsHttpsVerifyPeers() const; - void SetHttpsCACertificates(const std::string& certificates) - { - caCertificates_ = certificates; - } + void SetHttpsCACertificates(const std::string& certificates); - const std::string& GetHttpsCACertificates() const - { - return caCertificates_; - } + const std::string& GetHttpsCACertificates() const; void SetClientCertificate(const std::string& certificateFile, const std::string& certificateKeyFile, const std::string& certificateKeyPassword); - void SetPkcs11Enabled(bool enabled) - { - pkcs11Enabled_ = enabled; - } + void SetPkcs11Enabled(bool enabled); - bool IsPkcs11Enabled() const - { - return pkcs11Enabled_; - } + bool IsPkcs11Enabled() const; - const std::string& GetClientCertificateFile() const - { - return clientCertificateFile_; - } + const std::string& GetClientCertificateFile() const; - const std::string& GetClientCertificateKeyFile() const - { - return clientCertificateKeyFile_; - } + const std::string& GetClientCertificateKeyFile() const; - const std::string& GetClientCertificateKeyPassword() const - { - return clientCertificateKeyPassword_; - } + const std::string& GetClientCertificateKeyPassword() const; - void SetConvertHeadersToLowerCase(bool lowerCase) - { - headersToLowerCase_ = lowerCase; - } + void SetConvertHeadersToLowerCase(bool lowerCase); - bool IsConvertHeadersToLowerCase() const - { - return headersToLowerCase_; - } + bool IsConvertHeadersToLowerCase() const; - void SetRedirectionFollowed(bool follow) - { - redirectionFollowed_ = follow; - } + void SetRedirectionFollowed(bool follow); - bool IsRedirectionFollowed() const - { - return redirectionFollowed_; - } + bool IsRedirectionFollowed() const; static void GlobalInitialize(); diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp --- a/OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -292,15 +292,15 @@ const std::string& contentTypeHeader) { std::vector tokens; - Orthanc::Toolbox::TokenizeString(tokens, contentTypeHeader, ';'); + Toolbox::TokenizeString(tokens, contentTypeHeader, ';'); if (tokens.empty()) { return false; } - contentType = Orthanc::Toolbox::StripSpaces(tokens[0]); - Orthanc::Toolbox::ToLowerCase(contentType); + contentType = Toolbox::StripSpaces(tokens[0]); + Toolbox::ToLowerCase(contentType); if (contentType.empty()) { @@ -313,19 +313,19 @@ for (size_t i = 0; i < tokens.size(); i++) { std::vector items; - Orthanc::Toolbox::TokenizeString(items, tokens[i], '='); + Toolbox::TokenizeString(items, tokens[i], '='); if (items.size() == 2) { - if (boost::iequals("boundary", Orthanc::Toolbox::StripSpaces(items[0]))) + if (boost::iequals("boundary", Toolbox::StripSpaces(items[0]))) { - boundary = Orthanc::Toolbox::StripSpaces(items[1]); + boundary = Toolbox::StripSpaces(items[1]); valid = !boundary.empty(); } - else if (boost::iequals("type", Orthanc::Toolbox::StripSpaces(items[0]))) + else if (boost::iequals("type", Toolbox::StripSpaces(items[0]))) { - subType = Orthanc::Toolbox::StripSpaces(items[1]); - Orthanc::Toolbox::ToLowerCase(subType); + subType = Toolbox::StripSpaces(items[1]); + Toolbox::ToLowerCase(subType); // https://bitbucket.org/sjodogne/orthanc/issues/54/decide-what-to-do-wrt-quoting-of-multipart // https://tools.ietf.org/html/rfc7231#section-3.1.1.1 diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Images/Font.cpp --- a/OrthancFramework/Sources/Images/Font.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Images/Font.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -42,6 +42,13 @@ namespace Orthanc { + Font::Font() : + size_(0), + maxHeight_(0) + { + } + + Font::~Font() { for (Characters::iterator it = characters_.begin(); @@ -141,8 +148,18 @@ } #endif + const std::string &Font::GetName() const + { + return name_; + } - static unsigned int MyMin(unsigned int a, + unsigned int Font::GetSize() const + { + return size_; + } + + + static unsigned int MyMin(unsigned int a, unsigned int b) { return a < b ? a : b; diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Images/Font.h --- a/OrthancFramework/Sources/Images/Font.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Images/Font.h Thu Nov 05 17:20:49 2020 +0100 @@ -65,11 +65,7 @@ const uint8_t color[4]) const; public: - Font() : - size_(0), - maxHeight_(0) - { - } + Font(); ~Font(); @@ -79,15 +75,9 @@ void LoadFromFile(const std::string& path); #endif - const std::string& GetName() const - { - return name_; - } + const std::string& GetName() const; - unsigned int GetSize() const - { - return size_; - } + unsigned int GetSize() const; void Draw(ImageAccessor& target, const std::string& utf8, diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Images/IImageWriter.cpp --- a/OrthancFramework/Sources/Images/IImageWriter.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Images/IImageWriter.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -41,4 +41,24 @@ SystemToolbox::WriteFile(compressed, path); } #endif + + IImageWriter::~IImageWriter() + { + } + + void IImageWriter::WriteToMemory(std::string &compressed, + const ImageAccessor &accessor) + { + WriteToMemoryInternal(compressed, accessor.GetWidth(), accessor.GetHeight(), + accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); + } + +#if ORTHANC_SANDBOXED == 0 + void IImageWriter::WriteToFile(const std::string &path, + const ImageAccessor &accessor) + { + WriteToFileInternal(path, accessor.GetWidth(), accessor.GetHeight(), + accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); + } +#endif } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Images/IImageWriter.h --- a/OrthancFramework/Sources/Images/IImageWriter.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Images/IImageWriter.h Thu Nov 05 17:20:49 2020 +0100 @@ -52,24 +52,14 @@ #endif public: - virtual ~IImageWriter() - { - } + virtual ~IImageWriter(); virtual void WriteToMemory(std::string& compressed, - const ImageAccessor& accessor) - { - WriteToMemoryInternal(compressed, accessor.GetWidth(), accessor.GetHeight(), - accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); - } + const ImageAccessor& accessor); #if ORTHANC_SANDBOXED == 0 virtual void WriteToFile(const std::string& path, - const ImageAccessor& accessor) - { - WriteToFileInternal(path, accessor.GetWidth(), accessor.GetHeight(), - accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); - } + const ImageAccessor& accessor); #endif }; } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Images/ImageAccessor.h --- a/OrthancFramework/Sources/Images/ImageAccessor.h Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageAccessor.h Thu Nov 05 17:20:49 2020 +0100 @@ -34,7 +34,7 @@ class ORTHANC_PUBLIC ImageAccessor : public boost::noncopyable { private: - template + template friend struct ImageTraits; bool readOnly_; diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Images/ImageProcessing.cpp --- a/OrthancFramework/Sources/Images/ImageProcessing.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -562,42 +562,42 @@ switch (source.GetFormat()) { - case Orthanc::PixelFormat_Float32: + case PixelFormat_Float32: { switch (target.GetFormat()) { - case Orthanc::PixelFormat_Grayscale8: + case PixelFormat_Grayscale8: ApplyWindowingInternal(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert); break; - case Orthanc::PixelFormat_Grayscale16: + case PixelFormat_Grayscale16: ApplyWindowingInternal(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert); break; default: throw OrthancException(ErrorCode_NotImplemented); } };break; - case Orthanc::PixelFormat_Grayscale8: + case PixelFormat_Grayscale8: { switch (target.GetFormat()) { - case Orthanc::PixelFormat_Grayscale8: + case PixelFormat_Grayscale8: ApplyWindowingInternal(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert); break; - case Orthanc::PixelFormat_Grayscale16: + case PixelFormat_Grayscale16: ApplyWindowingInternal(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert); break; default: throw OrthancException(ErrorCode_NotImplemented); } };break; - case Orthanc::PixelFormat_Grayscale16: + case PixelFormat_Grayscale16: { switch (target.GetFormat()) { - case Orthanc::PixelFormat_Grayscale8: + case PixelFormat_Grayscale8: ApplyWindowingInternal(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert); break; - case Orthanc::PixelFormat_Grayscale16: + case PixelFormat_Grayscale16: ApplyWindowingInternal(target, source, windowCenter, windowWidth, rescaleSlope, rescaleIntercept, invert); break; default: @@ -1555,13 +1555,13 @@ namespace { - template + template class BresenhamPixelWriter { private: typedef typename PixelTraits::PixelType PixelType; - Orthanc::ImageAccessor& image_; + ImageAccessor& image_; PixelType value_; void PlotLineLow(int x0, @@ -1629,14 +1629,14 @@ } public: - BresenhamPixelWriter(Orthanc::ImageAccessor& image, + BresenhamPixelWriter(ImageAccessor& image, int64_t value) : image_(image), value_(PixelTraits::IntegerToPixel(value)) { } - BresenhamPixelWriter(Orthanc::ImageAccessor& image, + BresenhamPixelWriter(ImageAccessor& image, const PixelType& value) : image_(image), value_(value) @@ -1700,29 +1700,29 @@ { switch (image.GetFormat()) { - case Orthanc::PixelFormat_Grayscale8: + case PixelFormat_Grayscale8: { - BresenhamPixelWriter writer(image, value); + BresenhamPixelWriter writer(image, value); writer.DrawSegment(x0, y0, x1, y1); break; } - case Orthanc::PixelFormat_Grayscale16: + case PixelFormat_Grayscale16: { - BresenhamPixelWriter writer(image, value); + BresenhamPixelWriter writer(image, value); writer.DrawSegment(x0, y0, x1, y1); break; } - case Orthanc::PixelFormat_SignedGrayscale16: + case PixelFormat_SignedGrayscale16: { - BresenhamPixelWriter writer(image, value); + BresenhamPixelWriter writer(image, value); writer.DrawSegment(x0, y0, x1, y1); break; } default: - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented); } } @@ -1739,46 +1739,46 @@ { switch (image.GetFormat()) { - case Orthanc::PixelFormat_BGRA32: + case PixelFormat_BGRA32: { - PixelTraits::PixelType pixel; + PixelTraits::PixelType pixel; pixel.red_ = red; pixel.green_ = green; pixel.blue_ = blue; pixel.alpha_ = alpha; - BresenhamPixelWriter writer(image, pixel); + BresenhamPixelWriter writer(image, pixel); writer.DrawSegment(x0, y0, x1, y1); break; } - case Orthanc::PixelFormat_RGBA32: + case PixelFormat_RGBA32: { - PixelTraits::PixelType pixel; + PixelTraits::PixelType pixel; pixel.red_ = red; pixel.green_ = green; pixel.blue_ = blue; pixel.alpha_ = alpha; - BresenhamPixelWriter writer(image, pixel); + BresenhamPixelWriter writer(image, pixel); writer.DrawSegment(x0, y0, x1, y1); break; } - case Orthanc::PixelFormat_RGB24: + case PixelFormat_RGB24: { - PixelTraits::PixelType pixel; + PixelTraits::PixelType pixel; pixel.red_ = red; pixel.green_ = green; pixel.blue_ = blue; - BresenhamPixelWriter writer(image, pixel); + BresenhamPixelWriter writer(image, pixel); writer.DrawSegment(x0, y0, x1, y1); break; } default: - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented); } } @@ -1845,7 +1845,7 @@ if (points[i].GetX() < 0 || points[i].GetX() >= imageWidth || points[i].GetY() < 0 || points[i].GetY() >= imageHeight) { - throw Orthanc::OrthancException(ErrorCode_ParameterOutOfRange); + throw OrthancException(ErrorCode_ParameterOutOfRange); } cpx.push_back((double)points[i].GetX()); cpy.push_back((double)points[i].GetY()); @@ -1933,23 +1933,23 @@ { switch (image.GetFormat()) { - case Orthanc::PixelFormat_Grayscale8: + case PixelFormat_Grayscale8: { - FillPolygon_(image, points, value); + FillPolygon_(image, points, value); break; } - case Orthanc::PixelFormat_Grayscale16: + case PixelFormat_Grayscale16: { - FillPolygon_(image, points, value); + FillPolygon_(image, points, value); break; } - case Orthanc::PixelFormat_SignedGrayscale16: + case PixelFormat_SignedGrayscale16: { - FillPolygon_(image, points, value); + FillPolygon_(image, points, value); break; } default: - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_NotImplemented); } } @@ -2172,7 +2172,7 @@ // This is a slow implementation of horizontal convolution on one // individual channel, that checks for out-of-image values template - static float GetHorizontalConvolutionFloatSecure(const Orthanc::ImageAccessor& source, + static float GetHorizontalConvolutionFloatSecure(const ImageAccessor& source, const std::vector& horizontal, size_t horizontalAnchor, unsigned int x, diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/SystemToolbox.cpp --- a/OrthancFramework/Sources/SystemToolbox.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/SystemToolbox.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -233,7 +233,7 @@ } - void Orthanc::SystemToolbox::ReadFile(std::string &content, const std::string &path) + void SystemToolbox::ReadFile(std::string &content, const std::string &path) { ReadFile(content, path, true /* log */); } diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/TemporaryFile.cpp --- a/OrthancFramework/Sources/TemporaryFile.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/TemporaryFile.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -52,7 +52,7 @@ } // We use UUID to create unique path to temporary files - const std::string uuid = Orthanc::Toolbox::GenerateUuid(); + const std::string uuid = Toolbox::GenerateUuid(); // New in Orthanc 1.5.8: Prefix the process ID to the name of the // temporary files, in order to locate orphan temporary files that diff -r 3b70a2e6a06c -r 785a2713323e OrthancFramework/Sources/Toolbox.cpp --- a/OrthancFramework/Sources/Toolbox.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/Toolbox.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -2119,8 +2119,8 @@ (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9'))) { - throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange, - "Not an hexadecimal number"); + throw OrthancException(ErrorCode_ParameterOutOfRange, + "Not an hexadecimal number"); } } @@ -2213,7 +2213,7 @@ { if (!source.isObject()) { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat); } target = Json::objectValue;