Mercurial > hg > orthanc
diff OrthancServer/DicomInstanceToStore.cpp @ 3845:281045a1e6db
new "info" field in "ReceivedInstanceFilter()" callback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 16 Apr 2020 17:59:47 +0200 |
parents | be7df7fe3d80 |
children | 1491d501836a |
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.cpp Thu Apr 16 17:27:18 2020 +0200 +++ b/OrthancServer/DicomInstanceToStore.cpp Thu Apr 16 17:59:47 2020 +0200 @@ -169,6 +169,26 @@ private: std::unique_ptr<DicomInstanceHasher> hasher_; + void ParseDicomFile() + { + if (!parsed_.HasContent()) + { + if (!hasBuffer_) + { + throw OrthancException(ErrorCode_InternalError); + } + + if (ownBuffer_.get() != NULL) + { + parsed_.TakeOwnership(new ParsedDicomFile(*ownBuffer_)); + } + else + { + parsed_.TakeOwnership(new ParsedDicomFile(bufferData_, bufferSize_)); + } + } + } + void ComputeMissingInformation() { if (hasBuffer_ && @@ -217,18 +237,8 @@ // memory buffer, but that its summary or its JSON version is // missing - assert(hasBuffer_); - if (!parsed_.HasContent()) - { - if (ownBuffer_.get() != NULL) - { - parsed_.TakeOwnership(new ParsedDicomFile(*ownBuffer_)); - } - else - { - parsed_.TakeOwnership(new ParsedDicomFile(bufferData_, bufferSize_)); - } - } + ParseDicomFile(); + assert(parsed_.HasContent()); // At this point, we have parsed the DICOM file @@ -369,6 +379,22 @@ return false; } + + + bool HasPixelData() + { + ComputeMissingInformation(); + ParseDicomFile(); + + if (parsed_.HasContent()) + { + return parsed_.GetContent().HasTag(DICOM_TAG_PIXEL_DATA); + } + else + { + throw OrthancException(ErrorCode_InternalError); + } + } }; @@ -459,9 +485,9 @@ } - bool DicomInstanceToStore::LookupTransferSyntax(std::string& result) + bool DicomInstanceToStore::LookupTransferSyntax(std::string& result) const { - return pimpl_->LookupTransferSyntax(result); + return const_cast<PImpl&>(*pimpl_).LookupTransferSyntax(result); } @@ -469,4 +495,9 @@ { return pimpl_->GetHasher(); } + + bool DicomInstanceToStore::HasPixelData() const + { + return const_cast<PImpl&>(*pimpl_).HasPixelData(); + } }