# HG changeset patch
# User Benjamin Golinvaux <bgo@osimis.io>
# Date 1575363060 -3600
# Node ID c93a6218f0cd4bbc0796080a3c1065f3f0604424
# Parent  9added0d371ea851aa5d973e2d83ff784b208d54
Fixed photometric interpretation in texture creation

diff -r 9added0d371e -r c93a6218f0cd Framework/Toolbox/DicomInstanceParameters.cpp
--- a/Framework/Toolbox/DicomInstanceParameters.cpp	Fri Nov 29 18:08:56 2019 +0100
+++ b/Framework/Toolbox/DicomInstanceParameters.cpp	Tue Dec 03 09:51:00 2019 +0100
@@ -420,7 +420,19 @@
         texture->SetCustomWindowing(data_.defaultWindowingCenter_,
                                     data_.defaultWindowingWidth_);
       }
-        
+      
+
+      if (data_.imageInformation_.GetPhotometricInterpretation()
+        == Orthanc::PhotometricInterpretation_Monochrome1)
+      {
+        texture->SetInverted(true);
+      }
+      else if (data_.imageInformation_.GetPhotometricInterpretation()
+        == Orthanc::PhotometricInterpretation_Monochrome2)
+      {
+        texture->SetInverted(false);
+      }
+
       return texture.release();
     }
   }