changeset 62:130511d63f68

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Aug 2015 21:24:47 +0200
parents 56fef04eab40 (current diff) dae7a63ff51c (diff)
children 146252a250d1
files CMakeLists.txt
diffstat 12 files changed, 151 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Aug 07 21:19:14 2015 +0200
+++ b/CMakeLists.txt	Fri Aug 07 21:24:47 2015 +0200
@@ -108,6 +108,7 @@
 add_definitions(
   -DORTHANC_ENABLE_MD5=0
   -DORTHANC_ENABLE_BASE64=0
+  -DORTHANC_ENABLE_LOGGING=0
   )
 
 set(CORE_SOURCES
@@ -115,7 +116,7 @@
   ${JSONCPP_SOURCES}
   ${LIBJPEG_SOURCES}
   ${LIBPNG_SOURCES}
-  ${ZLIB}
+  ${ZLIB_SOURCES}
   ${PUGIXML_SOURCES}
 
   ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp
--- a/NEWS	Fri Aug 07 21:19:14 2015 +0200
+++ b/NEWS	Fri Aug 07 21:24:47 2015 +0200
@@ -1,13 +1,19 @@
 Pending changes in the mainline
 ===============================
 
-No official release yet. Still work in progress.
 
+Version 0.1 (2015/08/03)
+========================
+
+* Support of WADO-RS - RetrieveMetadata
 * Support of WADO, in addition to DICOMweb
 * All the APIs are now under the same root
+
+Production
+----------
+
 * Inject version information into Windows binaries
 * Use of Orthanc built-in API for multipart answers (requires Orthanc >= 0.9.1)
-* Support of WADO-RS - RetrieveMetadata
 * Support of Visual Studio 2008
 * Support of FreeBSD
 * Support of OS X
--- a/Orthanc/Core/ImageFormats/ImageAccessor.cpp	Fri Aug 07 21:19:14 2015 +0200
+++ b/Orthanc/Core/ImageFormats/ImageAccessor.cpp	Fri Aug 07 21:24:47 2015 +0200
@@ -33,6 +33,7 @@
 #include "../PrecompiledHeaders.h"
 #include "ImageAccessor.h"
 
+#include "../Logging.h"
 #include "../OrthancException.h"
 #include "../ChunkedBuffer.h"
 
@@ -40,9 +41,6 @@
 #include <cassert>
 #include <boost/lexical_cast.hpp>
 
-#if HAVE_GOOGLE_LOG == 1
-#include <glog/logging.h>
-#endif
 
 
 namespace Orthanc
@@ -108,7 +106,7 @@
   {
     if (readOnly_)
     {
-#if HAVE_GOOGLE_LOG == 1
+#if ORTHANC_ENABLE_LOGGING == 1
       LOG(ERROR) << "Trying to write on a read-only image";
 #endif
 
@@ -136,7 +134,7 @@
   {
     if (readOnly_)
     {
-#if HAVE_GOOGLE_LOG == 1
+#if ORTHANC_ENABLE_LOGGING == 1
       LOG(ERROR) << "Trying to write on a read-only image";
 #endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Orthanc/Core/Logging.h	Fri Aug 07 21:24:47 2015 +0200
@@ -0,0 +1,93 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#if ORTHANC_ENABLE_LOGGING == 1
+
+#if ORTHANC_ENABLE_GOOGLE_LOG == 1
+#  include <stdlib.h>  // This fixes a problem in glog for recent releases of MinGW
+#  include <glog/logging.h>
+#else
+#  include <iostream>
+#  include <boost/thread/mutex.hpp>
+#  define LOG(level)  ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__)
+#  define VLOG(level) ::Orthanc::Logging::InternalLogger("TRACE", __FILE__, __LINE__)
+#endif
+
+
+namespace Orthanc
+{
+  namespace Logging
+  {
+    void Initialize();
+
+    void Finalize();
+
+    void EnableInfoLevel(bool enabled);
+
+    void EnableTraceLevel(bool enabled);
+
+    void SetTargetFolder(const std::string& path);
+
+
+#if ORTHANC_ENABLE_GOOGLE_LOG != 1
+    class InternalLogger
+    {
+    private:
+      boost::mutex::scoped_lock  lock_;
+      std::ostream*              stream_;
+
+    public:
+      InternalLogger(const char* level,
+                     const char* file,
+                     int line);
+
+      ~InternalLogger()
+      {
+#if defined(_WIN32)
+        *stream_ << "\r\n";
+#else
+        *stream_ << "\n";
+#endif
+      }
+
+      std::ostream& operator<< (const std::string& message)
+      {
+        return (*stream_) << message;
+      }
+    };
+#endif
+  }
+}
+
+#endif  // ORTHANC_ENABLE_LOGGING
--- a/Orthanc/Core/PrecompiledHeaders.h	Fri Aug 07 21:19:14 2015 +0200
+++ b/Orthanc/Core/PrecompiledHeaders.h	Fri Aug 07 21:24:47 2015 +0200
@@ -46,7 +46,6 @@
 #include <boost/thread.hpp>
 #include <boost/thread/shared_mutex.hpp>
 
-#include <glog/logging.h>
 #include <json/value.h>
 
 #if ORTHANC_PUGIXML_ENABLED == 1
@@ -54,6 +53,7 @@
 #endif
 
 #include "Enumerations.h"
+#include "Logging.h"
 #include "OrthancException.h"
 #include "Toolbox.h"
 #include "Uuid.h"
--- a/Orthanc/Core/Toolbox.cpp	Fri Aug 07 21:19:14 2015 +0200
+++ b/Orthanc/Core/Toolbox.cpp	Fri Aug 07 21:24:47 2015 +0200
@@ -34,6 +34,7 @@
 #include "Toolbox.h"
 
 #include "OrthancException.h"
+#include "Logging.h"
 
 #include <string>
 #include <stdint.h>
@@ -53,13 +54,9 @@
 #include <boost/regex.hpp> 
 #endif
 
-#if HAVE_GOOGLE_LOG == 1
-#include <glog/logging.h>
-#endif
-
 #if defined(_WIN32)
 #include <windows.h>
-#include <process.h>   // For "_spawnvp()"
+#include <process.h>   // For "_spawnvp()" and "_getpid()"
 #else
 #include <unistd.h>    // For "execvp()"
 #include <sys/wait.h>  // For "waitpid()"
@@ -1135,7 +1132,7 @@
     if (pid == -1)
     {
       // Error in fork()
-#if HAVE_GOOGLE_LOG == 1
+#if ORTHANC_ENABLE_LOGGING == 1
       LOG(ERROR) << "Cannot fork a child process";
 #endif
 
@@ -1158,7 +1155,7 @@
 
     if (status != 0)
     {
-#if HAVE_GOOGLE_LOG == 1
+#if ORTHANC_ENABLE_LOGGING == 1
       LOG(ERROR) << "System command failed with status code " << status;
 #endif
 
@@ -1274,5 +1271,14 @@
     }
   }
 
+
+  int Toolbox::GetProcessId()
+  {
+#if defined(_WIN32)
+    return static_cast<int>(_getpid());
+#else
+    return static_cast<int>(getpid());
+#endif
+  }
 }
 
--- a/Orthanc/Core/Toolbox.h	Fri Aug 07 21:19:14 2015 +0200
+++ b/Orthanc/Core/Toolbox.h	Fri Aug 07 21:24:47 2015 +0200
@@ -170,5 +170,7 @@
 
     bool StartsWith(const std::string& str,
                     const std::string& prefix);
+
+    int GetProcessId();
   }
 }
--- a/Orthanc/Resources/CMake/ZlibConfiguration.cmake	Fri Aug 07 21:19:14 2015 +0200
+++ b/Orthanc/Resources/CMake/ZlibConfiguration.cmake	Fri Aug 07 21:24:47 2015 +0200
@@ -1,9 +1,3 @@
-# This is the minizip distribution to create ZIP files
-set(ZLIB_SOURCES
-  ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c
-  ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c
-  )
-
 if (STATIC_BUILD OR NOT USE_SYSTEM_ZLIB)
   SET(ZLIB_SOURCES_DIR ${CMAKE_BINARY_DIR}/zlib-1.2.7)
   DownloadPackage(
--- a/README	Fri Aug 07 21:19:14 2015 +0200
+++ b/README	Fri Aug 07 21:24:47 2015 +0200
@@ -15,8 +15,9 @@
 
 Currently, a basic support of the following protocols is provided:
 
-* WADO (Web Access to DICOM Persistent Objects)
+* WADO-URI (Web Access to DICOM Persistent Objects), previously known as WADO
   http://medical.nema.org/Dicom/2011/11_18pu.pdf
+  http://medical.nema.org/medical/dicom/current/output/html/part18.html#sect_6.2
 
 * WADO-RS (Web Access to DICOM Objects by RESTful Services)
   http://medical.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5
--- a/Resources/SyncOrthancFolder.py	Fri Aug 07 21:19:14 2015 +0200
+++ b/Resources/SyncOrthancFolder.py	Fri Aug 07 21:24:47 2015 +0200
@@ -26,6 +26,7 @@
     'Core/ImageFormats/ImageBuffer.h',
     'Core/ImageFormats/PngReader.cpp',
     'Core/ImageFormats/PngReader.h',
+    'Core/Logging.h',
     'Core/OrthancException.cpp',
     'Core/OrthancException.h',
     'Core/PrecompiledHeaders.h',
--- a/Status.txt	Fri Aug 07 21:19:14 2015 +0200
+++ b/Status.txt	Fri Aug 07 21:24:47 2015 +0200
@@ -2,6 +2,29 @@
 
 
 
+=======================================
+6.2 WADO-URI (previously known as WADO)
+=======================================
+
+Supported
+---------
+
+* Retrieval of JPEG images ("&requestType=WADO&...")
+* Retrieval of DICOM file ("&requestType=WADO&contentType=application/dicom&...")
+* Retrieval of PNG images ("&requestType=WADO&contentType=image/png&...")
+
+
+Not supported
+-------------
+
+* Retrieval of DICOM SR (structured reports)
+* Retrieval of a region of a DICOM image
+* Manipulation of the image (annotations, windowing, thresholding...)
+* DICOM Response with a change in the transfer syntax
+* Specification of a quality for JPEG images
+
+
+
 ================================
 6.5.1 WADO-RS / RetrieveStudy
 6.5.2 WADO-RS / RetrieveSeries
--- a/UnitTestsSources/UnitTestsMain.cpp	Fri Aug 07 21:19:14 2015 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Fri Aug 07 21:24:47 2015 +0200
@@ -35,17 +35,17 @@
 
   ParseContentType(c, a, "Multipart/Related; TYPE=Application/Dicom; Boundary=heLLO");
   ASSERT_EQ(c, "multipart/related");
-  ASSERT_EQ(2, a.size());
+  ASSERT_EQ(2u, a.size());
   ASSERT_EQ(a["type"], "Application/Dicom");
   ASSERT_EQ(a["boundary"], "heLLO");
 
   ParseContentType(c, a, "");
   ASSERT_TRUE(c.empty());
-  ASSERT_EQ(0, a.size());  
+  ASSERT_EQ(0u, a.size());  
 
   ParseContentType(c, a, "multipart/related");
   ASSERT_EQ(c, "multipart/related");
-  ASSERT_EQ(0, a.size());
+  ASSERT_EQ(0u, a.size());
 }