changeset 2107:88831c3edd8f

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Oct 2016 17:22:09 +0200
parents 09cb73980740
children 68510b1c2433
files Core/HttpClient.cpp Core/Images/Image.cpp Core/Images/Image.h Core/Images/ImageBuffer.cpp Core/Images/ImageBuffer.h OrthancServer/Internals/DicomImageDecoder.cpp Plugins/Engine/OrthancPlugins.cpp UnitTestsSources/FromDcmtkTests.cpp UnitTestsSources/ImageTests.cpp
diffstat 9 files changed, 27 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpClient.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/Core/HttpClient.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -328,7 +328,8 @@
     pimpl_(new PImpl), 
     verifyPeers_(true),
     pkcs11Enabled_(false),
-    headersToLowerCase_(true)
+    headersToLowerCase_(true),
+    redirectionFollowed_(true)
   {
     Setup();
   }
@@ -338,7 +339,8 @@
                          const std::string& uri) : 
     pimpl_(new PImpl), 
     verifyPeers_(true),
-    headersToLowerCase_(true)
+    headersToLowerCase_(true),
+    redirectionFollowed_(true)
   {
     Setup();
 
--- a/Core/Images/Image.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/Core/Images/Image.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -40,8 +40,9 @@
 {
   Image::Image(PixelFormat format,
                unsigned int width,
-               unsigned int height) :
-    image_(format, width, height)
+               unsigned int height,
+               bool forceMinimalPitch) :
+    image_(format, width, height, forceMinimalPitch)
   {
     ImageAccessor accessor = image_.GetAccessor();
     AssignWritable(format, width, height, accessor.GetPitch(), accessor.GetBuffer());
@@ -50,7 +51,7 @@
 
   Image* Image::Clone(const ImageAccessor& source)
   {
-    std::auto_ptr<Image> target(new Image(source.GetFormat(), source.GetWidth(), source.GetHeight()));
+    std::auto_ptr<Image> target(new Image(source.GetFormat(), source.GetWidth(), source.GetHeight(), false));
     ImageProcessing::Copy(*target, source);
     return target.release();
   }
--- a/Core/Images/Image.h	Mon Oct 17 15:36:50 2016 +0200
+++ b/Core/Images/Image.h	Wed Oct 19 17:22:09 2016 +0200
@@ -45,7 +45,8 @@
   public:
     Image(PixelFormat format,
           unsigned int width,
-          unsigned int height);
+          unsigned int height,
+          bool forceMinimalPitch);
 
     static Image* Clone(const ImageAccessor& source);
   };
--- a/Core/Images/ImageBuffer.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/Core/Images/ImageBuffer.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -87,7 +87,9 @@
 
   ImageBuffer::ImageBuffer(PixelFormat format,
                            unsigned int width,
-                           unsigned int height)
+                           unsigned int height,
+                           bool forceMinimalPitch) :
+    forceMinimalPitch_(forceMinimalPitch)
   {
     Initialize();
     SetWidth(width);
@@ -158,16 +160,6 @@
   }
 
 
-  void ImageBuffer::SetMinimalPitchForced(bool force)
-  {
-    if (force != forceMinimalPitch_)
-    {
-      changed_ = true;
-      forceMinimalPitch_ = force;
-    }
-  }
-
-
   void ImageBuffer::AcquireOwnership(ImageBuffer& other)
   {
     // Remove the content of the current image
--- a/Core/Images/ImageBuffer.h	Mon Oct 17 15:36:50 2016 +0200
+++ b/Core/Images/ImageBuffer.h	Wed Oct 19 17:22:09 2016 +0200
@@ -61,7 +61,8 @@
   public:
     ImageBuffer(PixelFormat format,
                 unsigned int width,
-                unsigned int height);
+                unsigned int height,
+                bool forceMinimalPitch);
 
     ImageBuffer()
     {
@@ -108,8 +109,6 @@
       return forceMinimalPitch_;
     }
 
-    void SetMinimalPitchForced(bool force);
-
     void AcquireOwnership(ImageBuffer& other);
   };
 }
--- a/OrthancServer/Internals/DicomImageDecoder.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/OrthancServer/Internals/DicomImageDecoder.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -340,7 +340,7 @@
       throw OrthancException(ErrorCode_NotImplemented);
     }
 
-    return new Image(format, info.GetWidth(), info.GetHeight());
+    return new Image(format, info.GetWidth(), info.GetHeight(), false);
   }
 
 
@@ -674,7 +674,7 @@
     if (image->GetFormat() != format)
     {
       // A conversion is required
-      std::auto_ptr<ImageAccessor> target(new Image(format, image->GetWidth(), image->GetHeight()));
+      std::auto_ptr<ImageAccessor> target(new Image(format, image->GetWidth(), image->GetHeight(), false));
       ImageProcessing::Convert(*target, *image);
       image = target;
     }
@@ -713,7 +713,7 @@
         // If the source image is not grayscale 8bpp, convert it
         if (image->GetFormat() != PixelFormat_Grayscale8)
         {
-          std::auto_ptr<ImageAccessor> target(new Image(PixelFormat_Grayscale8, image->GetWidth(), image->GetHeight()));
+          std::auto_ptr<ImageAccessor> target(new Image(PixelFormat_Grayscale8, image->GetWidth(), image->GetHeight(), false));
           ImageProcessing::Convert(*target, *image);
           image = target;
         }
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/Plugins/Engine/OrthancPlugins.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -1646,7 +1646,7 @@
 
     if (image->IsReadOnly())
     {
-      std::auto_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight()));
+      std::auto_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight(), false));
       ImageProcessing::Copy(*copy, *image);
       image.reset(NULL);
       return reinterpret_cast<OrthancPluginImage*>(copy.release());
@@ -1885,7 +1885,7 @@
     const _OrthancPluginConvertPixelFormat& p = *reinterpret_cast<const _OrthancPluginConvertPixelFormat*>(parameters);
     const ImageAccessor& source = *reinterpret_cast<const ImageAccessor*>(p.source);
 
-    std::auto_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight()));
+    std::auto_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight(), false));
     ImageProcessing::Convert(*target, source);
 
     *(p.target) = ReturnImage(target);
@@ -2038,7 +2038,7 @@
     switch (service)
     {
       case _OrthancPluginService_CreateImage:
-        result.reset(new Image(Plugins::Convert(p.format), p.width, p.height));
+        result.reset(new Image(Plugins::Convert(p.format), p.width, p.height, false));
         break;
 
       case _OrthancPluginService_CreateImageAccessor:
--- a/UnitTestsSources/FromDcmtkTests.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -818,7 +818,7 @@
 {
   static const char* PATH = "UnitTestsResults/PatternGrayscale8.dcm";
 
-  Orthanc::Image image(Orthanc::PixelFormat_Grayscale8, 256, 256);
+  Orthanc::Image image(Orthanc::PixelFormat_Grayscale8, 256, 256, false);
 
   for (int y = 0; y < 256; y++)
   {
@@ -871,7 +871,7 @@
 {
   static const char* PATH = "UnitTestsResults/PatternRGB24.dcm";
 
-  Orthanc::Image image(Orthanc::PixelFormat_RGB24, 384, 256);
+  Orthanc::Image image(Orthanc::PixelFormat_RGB24, 384, 256, false);
 
   for (int y = 0; y < 256; y++)
   {
@@ -933,7 +933,7 @@
 {
   static const char* PATH = "UnitTestsResults/PatternGrayscale16.dcm";
 
-  Orthanc::Image image(Orthanc::PixelFormat_Grayscale16, 256, 256);
+  Orthanc::Image image(Orthanc::PixelFormat_Grayscale16, 256, 256, false);
 
   uint16_t v = 0;
   for (int y = 0; y < 256; y++)
@@ -987,7 +987,7 @@
 {
   static const char* PATH = "UnitTestsResults/PatternSignedGrayscale16.dcm";
 
-  Orthanc::Image image(Orthanc::PixelFormat_SignedGrayscale16, 256, 256);
+  Orthanc::Image image(Orthanc::PixelFormat_SignedGrayscale16, 256, 256, false);
 
   int16_t v = -32768;
   for (int y = 0; y < 256; y++)
--- a/UnitTestsSources/ImageTests.cpp	Mon Oct 17 15:36:50 2016 +0200
+++ b/UnitTestsSources/ImageTests.cpp	Wed Oct 19 17:22:09 2016 +0200
@@ -211,7 +211,7 @@
   std::string s;
 
   {
-    Orthanc::Image img(Orthanc::PixelFormat_Grayscale8, 16, 16);
+    Orthanc::Image img(Orthanc::PixelFormat_Grayscale8, 16, 16, false);
     for (unsigned int y = 0, value = 0; y < img.GetHeight(); y++)
     {
       uint8_t* p = reinterpret_cast<uint8_t*>(img.GetRow(y));
@@ -258,7 +258,7 @@
 
 TEST(Font, Basic)
 {
-  Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480);
+  Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480, false);
   memset(s.GetBuffer(), 0, s.GetPitch() * s.GetHeight());
 
   ASSERT_GE(1u, Orthanc::Configuration::GetFontRegistry().GetSize());