Mercurial > hg > orthanc
diff Core/DicomNetworking/DicomStoreUserConnection.h @ 3896:210af28c4087 transcoding
merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 07 May 2020 11:32:15 +0200 |
parents | 8f7ad4989fec |
children |
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomStoreUserConnection.h Thu May 07 11:31:58 2020 +0200 +++ b/Core/DicomNetworking/DicomStoreUserConnection.h Thu May 07 11:32:15 2020 +0200 @@ -33,15 +33,23 @@ #pragma once +#if !defined(ORTHANC_ENABLE_DCMTK_TRANSCODING) +# error Macro ORTHANC_ENABLE_DCMTK_TRANSCODING must be defined to use this file +#endif + #include "DicomAssociationParameters.h" +#if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 +# include "../DicomParsing/IDicomTranscoder.h" +#endif + #include <boost/shared_ptr.hpp> #include <boost/noncopyable.hpp> #include <set> #include <stdint.h> // For uint8_t -class DcmDataset; +class DcmFileFormat; namespace Orthanc { @@ -64,30 +72,41 @@ **/ class DicomAssociation; // Forward declaration for PImpl design pattern - class ParsedDicomFile; class DicomStoreUserConnection : public boost::noncopyable { private: - typedef std::map<std::string, std::set<DicomTransferSyntax> > StorageClasses; + typedef std::map<std::string, std::set<DicomTransferSyntax> > RegisteredClasses; + + // "ProposedOriginalClasses" keeps track of the storage classes + // that were proposed with a single transfer syntax + typedef std::set< std::pair<std::string, DicomTransferSyntax> > ProposedOriginalClasses; DicomAssociationParameters parameters_; boost::shared_ptr<DicomAssociation> association_; // "shared_ptr" is for PImpl - StorageClasses storageClasses_; + RegisteredClasses registeredClasses_; + ProposedOriginalClasses proposedOriginalClasses_; bool proposeCommonClasses_; bool proposeUncompressedSyntaxes_; bool proposeRetiredBigEndian_; - void Setup(); - // Return "false" if there is not enough room remaining in the association bool ProposeStorageClass(const std::string& sopClassUid, const std::set<DicomTransferSyntax>& syntaxes); + bool LookupPresentationContext(uint8_t& presentationContextId, + const std::string& sopClassUid, + DicomTransferSyntax transferSyntax); + + bool NegotiatePresentationContext(uint8_t& presentationContextId, + const std::string& sopClassUid, + DicomTransferSyntax transferSyntax); + + void LookupTranscoding(std::set<DicomTransferSyntax>& acceptedSyntaxes, + const std::string& sopClassUid, + DicomTransferSyntax sourceSyntax); + public: - DicomStoreUserConnection(const std::string& localAet, - const RemoteModalityParameters& remote); - DicomStoreUserConnection(const DicomAssociationParameters& params); const DicomAssociationParameters& GetParameters() const @@ -95,11 +114,6 @@ return parameters_; } - void SetTimeout(int timeout) - { - parameters_.SetTimeout(timeout); - } - void SetCommonClassesProposed(bool proposed) { proposeCommonClasses_ = proposed; @@ -133,50 +147,33 @@ void RegisterStorageClass(const std::string& sopClassUid, DicomTransferSyntax syntax); - // Should only be used if transcoding - // TODO => to private - bool LookupPresentationContext(uint8_t& presentationContextId, - const std::string& sopClassUid, - DicomTransferSyntax transferSyntax); - - // TODO => to private - bool NegotiatePresentationContext(uint8_t& presentationContextId, - const std::string& sopClassUid, - DicomTransferSyntax transferSyntax); - - // TODO => to private - void LookupParameters(std::string& sopClassUid, - std::string& sopInstanceUid, - DicomTransferSyntax& transferSyntax, - DcmDataset& dataset); - - private: void Store(std::string& sopClassUid, std::string& sopInstanceUid, - DcmDataset& dataset, - const std::string& moveOriginatorAET, - uint16_t moveOriginatorID); - - void Store(std::string& sopClassUid, - std::string& sopInstanceUid, - ParsedDicomFile& parsed, - const std::string& moveOriginatorAET, - uint16_t moveOriginatorID); - - public: - void Store(std::string& sopClassUid, - std::string& sopInstanceUid, - const void* buffer, - size_t size, + DcmFileFormat& dicom, + bool hasMoveOriginator, const std::string& moveOriginatorAET, uint16_t moveOriginatorID); void Store(std::string& sopClassUid, std::string& sopInstanceUid, const void* buffer, - size_t size) - { - Store(sopClassUid, sopInstanceUid, buffer, size, "", 0); // Not a C-Move - } + size_t size, + bool hasMoveOriginator, + const std::string& moveOriginatorAET, + uint16_t moveOriginatorID); + + void LookupParameters(std::string& sopClassUid, + std::string& sopInstanceUid, + DicomTransferSyntax& transferSyntax, + DcmFileFormat& dicom); + + void Transcode(std::string& sopClassUid /* out */, + std::string& sopInstanceUid /* out */, + IDicomTranscoder& transcoder, + const void* buffer, + size_t size, + bool hasMoveOriginator, + const std::string& moveOriginatorAET, + uint16_t moveOriginatorID); }; }