[med-svn] [orthanc] 01/05: Imported Upstream version 0.9.6+dfsg

Sebastien Jodogne jodogne-guest at moszumanska.debian.org
Fri Dec 11 08:38:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

jodogne-guest pushed a commit to branch master
in repository orthanc.

commit 8bc80999ae67209b8fc78b1f7da5e5adb15b519a
Author: jodogne-guest <s.jodogne at gmail.com>
Date:   Fri Dec 11 08:56:33 2015 +0100

    Imported Upstream version 0.9.6+dfsg
---
 .hg_archival.txt                             |  6 ++---
 CMakeLists.txt                               |  2 +-
 Core/HttpServer/HttpOutput.cpp               |  2 +-
 NEWS                                         | 11 +++++++++
 OrthancServer/FromDcmtkBridge.cpp            | 21 +++++++++++++----
 OrthancServer/Search/HierarchicalMatcher.cpp |  6 ++---
 OrthancServer/ServerToolbox.cpp              | 32 ++++++++++++++++++--------
 OrthancServer/SliceOrdering.cpp              | 13 ++++++++++-
 OrthancServer/main.cpp                       | 34 +++++++++++++++++++++++++---
 Resources/Configuration.json                 |  2 +-
 10 files changed, 102 insertions(+), 27 deletions(-)

diff --git a/.hg_archival.txt b/.hg_archival.txt
index a3a599b..2cc1f3b 100644
--- a/.hg_archival.txt
+++ b/.hg_archival.txt
@@ -1,5 +1,5 @@
 repo: 3959d33612ccaadc0d4d707227fbed09ac35e5fe
-node: 2684ded7c7b3a0176af645476eb9ad56a36e48e4
-branch: Orthanc-0.9.5
+node: b4e8a031b0d86caf89e1a99fb7b86bb94d00c6a8
+branch: Orthanc-0.9.6
 latesttag: null
-latesttagdistance: 1598
+latesttagdistance: 1612
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2058ca..2737e27 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8)
 project(Orthanc)
 
 # Version of the build, should always be "mainline" except in release branches
-set(ORTHANC_VERSION "0.9.5")
+set(ORTHANC_VERSION "0.9.6")
 
 # Version of the database schema. History:
 #   * Orthanc 0.1.0 -> Orthanc 0.3.0 = no versioning
diff --git a/Core/HttpServer/HttpOutput.cpp b/Core/HttpServer/HttpOutput.cpp
index 80f1770..d28ae80 100644
--- a/Core/HttpServer/HttpOutput.cpp
+++ b/Core/HttpServer/HttpOutput.cpp
@@ -463,7 +463,7 @@ namespace Orthanc
       stream_.Send(false, item, length);
     }
 
-    stream_.Send(false, "\r\n", 1);
+    stream_.Send(false, "\r\n", 2);
   }
 
 
diff --git a/NEWS b/NEWS
index 01c7329..b762a16 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,17 @@ Pending changes in the mainline
 ===============================
 
 
+Version 0.9.6 (2015/12/08)
+==========================
+
+* Promiscuous mode (accept unknown SOP class UID) is now turned off by default
+* Fix serialization of DICOM buffers that might contain garbage trailing
+* Fix modality worklists server if some fields are null
+* More tolerant "/series/.../ordered-slices" with broken series
+* Improved logging information if upgrade fails
+* Fix formatting of multipart HTTP answers (bis)
+
+
 Version 0.9.5 (2015/12/02)
 ==========================
 
diff --git a/OrthancServer/FromDcmtkBridge.cpp b/OrthancServer/FromDcmtkBridge.cpp
index 019d59c..581fa7b 100644
--- a/OrthancServer/FromDcmtkBridge.cpp
+++ b/OrthancServer/FromDcmtkBridge.cpp
@@ -1040,9 +1040,12 @@ namespace Orthanc
     ff.removeInvalidGroups();
 
     // Create a memory buffer with the proper size
-    uint32_t s = ff.calcElementLength(xfer, encodingType);
-    buffer.resize(s);
-    DcmOutputBufferStream ob(&buffer[0], s);
+    {
+      const uint32_t estimatedSize = ff.calcElementLength(xfer, encodingType);  // (*)
+      buffer.resize(estimatedSize);
+    }
+
+    DcmOutputBufferStream ob(&buffer[0], buffer.size());
 
     // Fill the memory buffer with the meta-header and the dataset
     ff.transferInit();
@@ -1051,13 +1054,23 @@ namespace Orthanc
                              /*opt_paddingType*/ EPD_withoutPadding);
     ff.transferEnd();
 
-    // Handle errors
     if (c.good())
     {
+      // The DICOM file is successfully written, truncate the target
+      // buffer if its size was overestimated by (*)
+      ob.flush();
+
+      size_t effectiveSize = static_cast<size_t>(ob.tell());
+      if (effectiveSize < buffer.size())
+      {
+        buffer.resize(effectiveSize);
+      }
+
       return true;
     }
     else
     {
+      // Error
       buffer.clear();
       return false;
     }
diff --git a/OrthancServer/Search/HierarchicalMatcher.cpp b/OrthancServer/Search/HierarchicalMatcher.cpp
index 2b3a81e..115c9f0 100644
--- a/OrthancServer/Search/HierarchicalMatcher.cpp
+++ b/OrthancServer/Search/HierarchicalMatcher.cpp
@@ -123,12 +123,12 @@ namespace Orthanc
         std::auto_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
                                         (*element, DicomToJsonFlags_None, encoding));
 
-        if (value->IsBinary() ||
-            value->IsNull())
+        if (value->IsBinary())
         {
           throw OrthancException(ErrorCode_BadRequest);
         }
-        else if (value->GetContent().empty())
+        else if (value->IsNull() ||
+                 value->GetContent().empty())
         {
           // This is an universal matcher
           constraints_[tag] = NULL;
diff --git a/OrthancServer/ServerToolbox.cpp b/OrthancServer/ServerToolbox.cpp
index 201b463..afd7532 100644
--- a/OrthancServer/ServerToolbox.cpp
+++ b/OrthancServer/ServerToolbox.cpp
@@ -322,6 +322,8 @@ namespace Orthanc
             tmp != level ||
             !FindOneChildInstance(instance, database, resource, level))
         {
+          LOG(ERROR) << "Cannot find an instance for " << EnumerationToString(level) 
+                     << " with identifier " << *it;
           throw OrthancException(ErrorCode_InternalError);
         }
 
@@ -329,23 +331,33 @@ namespace Orthanc
         FileInfo attachment;
         if (!database.LookupAttachment(attachment, instance, FileContentType_Dicom))
         {
+          LOG(ERROR) << "Cannot retrieve the DICOM file associated with instance " << database.GetPublicId(instance);
           throw OrthancException(ErrorCode_InternalError);
         }
 
-        // Read and parse the content of the DICOM file
-        StorageAccessor accessor(storageArea);
+        try
+        {
+          // Read and parse the content of the DICOM file
+          StorageAccessor accessor(storageArea);
 
-        std::string content;
-        accessor.Read(content, attachment);
+          std::string content;
+          accessor.Read(content, attachment);
 
-        ParsedDicomFile dicom(content);
+          ParsedDicomFile dicom(content);
 
-        // Update the tags of this resource
-        DicomMap dicomSummary;
-        dicom.Convert(dicomSummary);
+          // Update the tags of this resource
+          DicomMap dicomSummary;
+          dicom.Convert(dicomSummary);
 
-        database.ClearMainDicomTags(resource);
-        Toolbox::SetMainDicomTags(database, resource, level, dicomSummary);
+          database.ClearMainDicomTags(resource);
+          Toolbox::SetMainDicomTags(database, resource, level, dicomSummary);
+        }
+        catch (OrthancException&)
+        {
+          LOG(ERROR) << "Cannot decode the DICOM file with UUID " << attachment.GetUuid()
+                     << " associated with instance " << database.GetPublicId(instance);
+          throw;
+        }
       }
     }
   }
diff --git a/OrthancServer/SliceOrdering.cpp b/OrthancServer/SliceOrdering.cpp
index efeb1e5..0b7266f 100644
--- a/OrthancServer/SliceOrdering.cpp
+++ b/OrthancServer/SliceOrdering.cpp
@@ -320,7 +320,8 @@ namespace Orthanc
       if (instances_[i - 1]->GetIndexInSeries() == instances_[i]->GetIndexInSeries())
       {
         // The current "IndexInSeries" occurs 2 times: Not a proper ordering
-        return false;
+        LOG(WARNING) << "This series contains 2 slices with the same index, trying to display it anyway";
+        break;
       }
     }
 
@@ -398,6 +399,8 @@ namespace Orthanc
 
     result["Dicom"] = tmp;
 
+    Json::Value slicesShort = Json::arrayValue;
+
     tmp.clear();
     for (size_t i = 0; i < GetInstancesCount(); i++)
     {
@@ -406,8 +409,16 @@ namespace Orthanc
       {
         tmp.append(base + "/frames/" + boost::lexical_cast<std::string>(j));
       }
+
+      Json::Value tmp2 = Json::arrayValue;
+      tmp2.append(GetInstanceId(i));
+      tmp2.append(0);
+      tmp2.append(GetFramesCount(i));
+      
+      slicesShort.append(tmp2);
     }
 
     result["Slices"] = tmp;
+    result["SlicesShort"] = slicesShort;
   }
 }
diff --git a/OrthancServer/main.cpp b/OrthancServer/main.cpp
index 3e8ee6b..8c6d613 100644
--- a/OrthancServer/main.cpp
+++ b/OrthancServer/main.cpp
@@ -269,7 +269,7 @@ public:
       }
     }
 
-    return Configuration::GetGlobalBoolParameter(configuration, true);
+    return Configuration::GetGlobalBoolParameter(configuration, false);
   }
 };
 
@@ -835,7 +835,17 @@ static bool UpgradeDatabase(IDatabaseWrapper& database,
 
   LOG(WARNING) << "Upgrading the database from schema version "
                << currentVersion << " to " << ORTHANC_DATABASE_VERSION;
-  database.Upgrade(ORTHANC_DATABASE_VERSION, storageArea);
+
+  try
+  {
+    database.Upgrade(ORTHANC_DATABASE_VERSION, storageArea);
+  }
+  catch (OrthancException&)
+  {
+    LOG(ERROR) << "Unable to run the automated upgrade, please use the replication instructions: "
+               << "https://orthanc.chu.ulg.ac.be/book/users/replication.html";
+    throw;
+  }
     
   // Sanity check
   currentVersion = database.GetDatabaseVersion();
@@ -1099,7 +1109,25 @@ int main(int argc, char* argv[])
    * Launch Orthanc.
    **/
 
-  LOG(WARNING) << "Orthanc version: " << ORTHANC_VERSION;
+  {
+    std::string version(ORTHANC_VERSION);
+
+    if (std::string(ORTHANC_VERSION) == "mainline")
+    {
+      try
+      {
+        boost::filesystem::path exe(Toolbox::GetPathToExecutable());
+        std::time_t creation = boost::filesystem::last_write_time(exe);
+        boost::posix_time::ptime converted(boost::posix_time::from_time_t(creation));
+        version += " (" + boost::posix_time::to_iso_string(converted) + ")";
+      }
+      catch (...)
+      {
+      }
+    }
+
+    LOG(WARNING) << "Orthanc version: " << version;
+  }
 
   int status = 0;
   try
diff --git a/Resources/Configuration.json b/Resources/Configuration.json
index 3f39293..024347f 100644
--- a/Resources/Configuration.json
+++ b/Resources/Configuration.json
@@ -104,7 +104,7 @@
 
   // Whether Orthanc accepts to act as C-Store SCP for unknown storage
   // SOP classes (aka. "promiscuous mode")
-  "UnknownSopClassAccepted"            : true,
+  "UnknownSopClassAccepted"            : false,
 
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/orthanc.git



More information about the debian-med-commit mailing list