changeset 8:62adabb8c122

Provide "--version" in command-line tools
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Oct 2016 16:53:54 +0200
parents bc3ca410b765
children 021482366dac
files Applications/ApplicationToolbox.cpp Applications/ApplicationToolbox.h Applications/CMakeLists.txt Applications/DicomToTiff.cpp Applications/Dicomizer.cpp NEWS Resources/CMake/Version.cmake TODO ViewerPlugin/CMakeLists.txt ViewerPlugin/Plugin.cpp
diffstat 10 files changed, 46 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/ApplicationToolbox.cpp	Wed Oct 26 15:42:52 2016 +0200
+++ b/Applications/ApplicationToolbox.cpp	Wed Oct 26 16:53:54 2016 +0200
@@ -176,5 +176,19 @@
         throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
       }
     }
+
+
+    void PrintVersion(const char* path)
+    {
+      std::cout
+        << path << " " << ORTHANC_WSI_VERSION << std::endl
+        << "Copyright (C) 2012-2016 Sebastien Jodogne, "
+        << "Medical Physics Department, University Hospital of Liege (Belgium)" << std::endl
+        << "Licensing AGPL: GNU AGPL version 3 or later <http://gnu.org/licenses/gpl.html>." << std::endl
+        << "This is free software: you are free to change and redistribute it." << std::endl
+        << "There is NO WARRANTY, to the extent permitted by law." << std::endl
+        << std::endl
+        << "Written by Sebastien Jodogne <s.jodogne@gmail.com>" << std::endl;
+    }
   }
 }
--- a/Applications/ApplicationToolbox.h	Wed Oct 26 15:42:52 2016 +0200
+++ b/Applications/ApplicationToolbox.h	Wed Oct 26 16:53:54 2016 +0200
@@ -40,5 +40,7 @@
                     uint8_t& green,
                     uint8_t& blue,
                     const std::string& color);
+
+    void PrintVersion(const char* path);
   }
 }
--- a/Applications/CMakeLists.txt	Wed Oct 26 15:42:52 2016 +0200
+++ b/Applications/CMakeLists.txt	Wed Oct 26 16:53:54 2016 +0200
@@ -66,6 +66,8 @@
 include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake)
 include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake)
 
+# Include components specific to WSI
+include(${ORTHANC_WSI_DIR}/Resources/CMake/Version.cmake)
 include(${ORTHANC_WSI_DIR}/Resources/CMake/BoostExtendedConfiguration.cmake)
 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake)
 include(${ORTHANC_WSI_DIR}/Resources/CMake/LibTiffConfiguration.cmake)
--- a/Applications/DicomToTiff.cpp	Wed Oct 26 15:42:52 2016 +0200
+++ b/Applications/DicomToTiff.cpp	Wed Oct 26 16:53:54 2016 +0200
@@ -40,6 +40,7 @@
   boost::program_options::options_description generic("Generic options");
   generic.add_options()
     ("help", "Display this help and exit")
+    ("version", "Output version information and exit")
     ("verbose", "Be verbose in logs")
     ;
 
@@ -90,7 +91,8 @@
   }
 
   if (!error &&
-      options.count("help") == 0)
+      options.count("help") == 0 &&
+      options.count("version") == 0)
   {
     if (options.count("input") != 1)
     {
@@ -125,6 +127,12 @@
     return false;
   }
 
+  if (options.count("version")) 
+  { 
+    OrthancWSI::ApplicationToolbox::PrintVersion(argv[0]);
+    return false;
+  }
+
   if (options.count("verbose"))
   {
     Orthanc::Logging::EnableInfoLevel(true);
--- a/Applications/Dicomizer.cpp	Wed Oct 26 15:42:52 2016 +0200
+++ b/Applications/Dicomizer.cpp	Wed Oct 26 16:53:54 2016 +0200
@@ -453,6 +453,7 @@
   boost::program_options::options_description generic("Generic options");
   generic.add_options()
     ("help", "Display this help and exit")
+    ("version", "Output version information and exit")
     ("verbose", "Be verbose in logs")
     ("threads", boost::program_options::value<int>()->default_value(parameters.GetThreadsCount()), 
      "Number of processing threads to be used")
@@ -562,6 +563,7 @@
 
   if (!error &&
       options.count("help") == 0 &&
+      options.count("version") == 0 &&
       options.count("input") != 1)
   {
     LOG(ERROR) << "No input file was specified";
@@ -588,6 +590,12 @@
     return false;
   }
 
+  if (options.count("version")) 
+  { 
+    OrthancWSI::ApplicationToolbox::PrintVersion(argv[0]);
+    return false;
+  }
+
   if (options.count("verbose"))
   {
     Orthanc::Logging::EnableInfoLevel(true);
--- a/NEWS	Wed Oct 26 15:42:52 2016 +0200
+++ b/NEWS	Wed Oct 26 16:53:54 2016 +0200
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* Docker images are available
+* Provide "--version" in command-line tools
 * Fix freeze if the target Orthanc is not accepting images
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CMake/Version.cmake	Wed Oct 26 16:53:54 2016 +0200
@@ -0,0 +1,5 @@
+set(ORTHANC_WSI_VERSION "mainline")
+
+add_definitions(
+  -DORTHANC_WSI_VERSION="${ORTHANC_WSI_VERSION}"
+  )
--- a/TODO	Wed Oct 26 15:42:52 2016 +0200
+++ b/TODO	Wed Oct 26 16:53:54 2016 +0200
@@ -7,7 +7,6 @@
 -------
 
 * Support sparse tiling (both in encoder and decoder)
-* Add version in command-line tools
 
 
 -------------
@@ -25,9 +24,8 @@
 
 * Provide precompiled Windows binaries
 * Build under Apple OS X
-* Build under Microsoft Visual Studio
+* Build using Microsoft Visual Studio
 * DebianMed
-* Docker
 
 
 -----------
--- a/ViewerPlugin/CMakeLists.txt	Wed Oct 26 15:42:52 2016 +0200
+++ b/ViewerPlugin/CMakeLists.txt	Wed Oct 26 16:53:54 2016 +0200
@@ -1,8 +1,6 @@
 cmake_minimum_required(VERSION 2.8)
 project(OrthancWSIPlugin)
 
-set(ORTHANC_WSI_VERSION "mainline")
-
 
 #####################################################################
 ## Parameters of the build
@@ -53,6 +51,8 @@
 include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake)
 include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake)
 
+# Include components specific to WSI
+include(${ORTHANC_WSI_DIR}/Resources/CMake/Version.cmake)
 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake)
 
 add_definitions(
@@ -191,8 +191,6 @@
   )
 
 message("Setting the version of the library to ${ORTHANC_WSI_VERSION}")
-add_definitions(-DORTHANC_WSI_VERSION="${ORTHANC_WSI_VERSION}")
-
 set_target_properties(OrthancWSI PROPERTIES 
   VERSION ${ORTHANC_WSI_VERSION} 
   SOVERSION ${ORTHANC_WSI_VERSION})
--- a/ViewerPlugin/Plugin.cpp	Wed Oct 26 15:42:52 2016 +0200
+++ b/ViewerPlugin/Plugin.cpp	Wed Oct 26 16:53:54 2016 +0200
@@ -352,7 +352,7 @@
     sprintf(info, "The whole-slide imaging plugin will use at most %d threads to transcode the tiles", threads);
     OrthancPluginLogWarning(context_, info);
 
-    OrthancPluginSetDescription(context, "Plugin to serve whole-slide microscopic images from Orthanc.");
+    OrthancPluginSetDescription(context, "Provides a Web viewer of whole-slide microscopic images within Orthanc.");
 
     orthanc_.reset(new OrthancWSI::PluginOrthancConnection(context));
     cache_.reset(new OrthancWSI::DicomPyramidCache(*orthanc_));