Mercurial > hg > orthanc
diff OrthancServer/DicomInstanceToStore.cpp @ 2189:c4b3259c8bce
New metadata automatically computed at the instance level: "TransferSyntax"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Nov 2016 16:07:14 +0100 |
parents | bb199bccdc45 |
children | a3a65de1840f |
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.cpp Tue Nov 29 15:39:46 2016 +0100 +++ b/OrthancServer/DicomInstanceToStore.cpp Tue Nov 29 16:07:14 2016 +0100 @@ -38,6 +38,7 @@ #include "../Core/Logging.h" #include <dcmtk/dcmdata/dcfilefo.h> +#include <dcmtk/dcmdata/dcdeftag.h> namespace Orthanc @@ -270,4 +271,25 @@ return ""; } } + + + bool DicomInstanceToStore::LookupTransferSyntax(std::string& result) + { + ComputeMissingInformation(); + + DicomMap header; + if (DicomMap::ParseDicomMetaInformation(header, GetBufferData(), GetBufferSize())) + { + const DicomValue* value = header.TestAndGetValue(DICOM_TAG_TRANSFER_SYNTAX_UID); + if (value != NULL && + !value->IsBinary() && + !value->IsNull()) + { + result = Toolbox::StripSpaces(value->GetContent()); + return true; + } + } + + return false; + } }