diff Framework/Radiography/RadiographyDicomLayer.cpp @ 1118:35e798b16b65

RadiographyDicomLayer: allow replacing low res image by high res image
author Alain Mazy <alain@mazy.be>
date Mon, 04 Nov 2019 22:16:04 +0100
parents be9c1530d40a
children d7e06542304c a5f2a6b04a31
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyDicomLayer.cpp	Mon Nov 04 12:47:13 2019 +0100
+++ b/Framework/Radiography/RadiographyDicomLayer.cpp	Mon Nov 04 22:16:04 2019 +0100
@@ -111,6 +111,25 @@
     BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
   }
 
+  void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY)   // Takes ownership
+  {
+    std::auto_ptr<Orthanc::ImageAccessor> raii(image);
+
+    if (image == NULL)
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
+    }
+
+    SetSize(image->GetWidth(), image->GetHeight());
+
+    source_ = raii;
+    ApplyConverter();
+
+    SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false);
+
+    BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
+  }
+
 
   void RadiographyDicomLayer::SetDicomFrameConverter(Deprecated::DicomFrameConverter* converter)
   {