Mercurial > hg > orthanc-stone
changeset 1726:0257339b0884
new method ParseDicomFromWadoCommand::IsSameCommand()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 01 Dec 2020 18:01:42 +0100 |
parents | c8d0ffb3047d |
children | c6139e08132b |
files | OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.cpp OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.h TODO |
diffstat | 4 files changed, 60 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp Tue Dec 01 17:43:31 2020 +0100 +++ b/OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp Tue Dec 01 18:01:42 2020 +0100 @@ -444,7 +444,9 @@ const std::map<std::string, std::string> empty; std::unique_ptr<ParseDicomFromWadoCommand> command( - new ParseDicomFromWadoCommand(source, sopInstanceUid, source.CreateDicomWebCommand(uri, empty, empty, NULL))); + new ParseDicomFromWadoCommand(source, sopInstanceUid, false /* no server-side transcoding */, + Orthanc::DicomTransferSyntax_LittleEndianExplicit /* dummy value */, + source.CreateDicomWebCommand(uri, empty, empty, NULL))); command->AcquirePayload(payload.release()); {
--- a/OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.cpp Tue Dec 01 17:43:31 2020 +0100 +++ b/OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.cpp Tue Dec 01 18:01:42 2020 +0100 @@ -30,16 +30,20 @@ { ParseDicomFromWadoCommand::ParseDicomFromWadoCommand(const DicomSource& source, const std::string& sopInstanceUid, + bool transcode, + Orthanc::DicomTransferSyntax transferSyntax, IOracleCommand* restCommand) : source_(source), sopInstanceUid_(sopInstanceUid), + transcode_(transcode), + transferSyntax_(transferSyntax), restCommand_(restCommand) { if (restCommand == NULL) { throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); } - + if (restCommand_->GetType() != Type_Http && restCommand_->GetType() != Type_OrthancRestApi) { @@ -51,10 +55,46 @@ IOracleCommand* ParseDicomFromWadoCommand::Clone() const { assert(restCommand_.get() != NULL); - return new ParseDicomFromWadoCommand(source_, sopInstanceUid_, restCommand_->Clone()); + return new ParseDicomFromWadoCommand(source_, sopInstanceUid_, transcode_, transferSyntax_, restCommand_->Clone()); } + Orthanc::DicomTransferSyntax ParseDicomFromWadoCommand::GetTranscodeTransferSyntax() const + { + if (transcode_) + { + return transferSyntax_; + } + else + { + // "IsTranscode()" should have been called + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); + } + } + + + bool ParseDicomFromWadoCommand::IsSameCommand(const ParseDicomFromWadoCommand& other) const + { + if (source_.IsSameSource(other.source_) && + sopInstanceUid_ == other.sopInstanceUid_ && + transcode_ == other.transcode_) + { + if (transcode_) + { + return transferSyntax_ == other.transferSyntax_; + } + else + { + return true; + } + } + else + { + return false; + } + } + + const IOracleCommand& ParseDicomFromWadoCommand::GetRestCommand() const { assert(restCommand_.get() != NULL); @@ -94,7 +134,7 @@ source.CreateDicomWebCommand(uri, arguments, headers, NULL)); std::unique_ptr<ParseDicomFromWadoCommand> command( - new ParseDicomFromWadoCommand(source, sopInstanceUid, rest.release())); + new ParseDicomFromWadoCommand(source, sopInstanceUid, transcode, transferSyntax, rest.release())); if (protection.get() != NULL) {
--- a/OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.h Tue Dec 01 17:43:31 2020 +0100 +++ b/OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.h Tue Dec 01 18:01:42 2020 +0100 @@ -36,11 +36,15 @@ private: DicomSource source_; std::string sopInstanceUid_; + bool transcode_; + Orthanc::DicomTransferSyntax transferSyntax_; std::unique_ptr<IOracleCommand> restCommand_; public: ParseDicomFromWadoCommand(const DicomSource& source, const std::string& sopInstanceUid, + bool transcode, + Orthanc::DicomTransferSyntax transferSyntax, IOracleCommand* restCommand); virtual Type GetType() const ORTHANC_OVERRIDE @@ -59,6 +63,15 @@ { return sopInstanceUid_; } + + bool IsTranscode() const + { + return transcode_; + } + + Orthanc::DicomTransferSyntax GetTranscodeTransferSyntax() const; + + bool IsSameCommand(const ParseDicomFromWadoCommand& other) const; const IOracleCommand& GetRestCommand() const;