diff OrthancServer/ParsedDicomFile.cpp @ 2281:e002430baa41

Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Jun 2017 16:14:52 +0200
parents a3a65de1840f
children b7fba68747f6
line wrap: on
line diff
--- a/OrthancServer/ParsedDicomFile.cpp	Mon May 22 20:39:53 2017 +0200
+++ b/OrthancServer/ParsedDicomFile.cpp	Fri Jun 09 16:14:52 2017 +0200
@@ -1409,4 +1409,25 @@
   {
     return FromDcmtkBridge::LookupTransferSyntax(result, *pimpl_->file_);
   }
+
+
+  bool ParsedDicomFile::LookupPhotometricInterpretation(PhotometricInterpretation& result) const
+  {
+    DcmTagKey k(DICOM_TAG_PHOTOMETRIC_INTERPRETATION.GetGroup(),
+                DICOM_TAG_PHOTOMETRIC_INTERPRETATION.GetElement());
+
+    DcmDataset& dataset = *pimpl_->file_->getDataset();
+
+    const char *c = NULL;
+    if (dataset.findAndGetString(k, c).good() &&
+        c != NULL)
+    {
+      result = StringToPhotometricInterpretation(c);
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
 }