changeset 142:1272fbee1ef9 dev

toolbox moved to the main Orthanc project
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 24 Jun 2016 22:35:04 +0200
parents 022cb1de0db0
children 4ff789abc494
files Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Orthanc/Sdk-mainline/orthanc/OrthancCPlugin.h Plugin/WadoUri.cpp Resources/SyncOrthancFolder.py
diffstat 5 files changed, 47 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Fri Jun 24 22:25:14 2016 +0200
+++ b/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Fri Jun 24 22:35:04 2016 +0200
@@ -561,7 +561,7 @@
   }
 
 
-  void Image::Clear()
+  void OrthancImage::Clear()
   {
     if (image_ != NULL)
     {
@@ -571,7 +571,7 @@
   }
 
 
-  void Image::CheckImageAvailable()
+  void OrthancImage::CheckImageAvailable()
   {
     if (image_ == NULL)
     {
@@ -581,7 +581,7 @@
   }
 
 
-  Image::Image(OrthancPluginContext*  context) :
+  OrthancImage::OrthancImage(OrthancPluginContext*  context) :
     context_(context),
     image_(NULL)
   {
@@ -592,8 +592,8 @@
   }
 
 
-  Image::Image(OrthancPluginContext*  context,
-               OrthancPluginImage*    image) :
+  OrthancImage::OrthancImage(OrthancPluginContext*  context,
+                             OrthancPluginImage*    image) :
     context_(context),
     image_(image)
   {
@@ -604,10 +604,10 @@
   }
   
 
-  Image::Image(OrthancPluginContext*     context,
-               OrthancPluginPixelFormat  format,
-               uint32_t                  width,
-               uint32_t                  height) :
+  OrthancImage::OrthancImage(OrthancPluginContext*     context,
+                             OrthancPluginPixelFormat  format,
+                             uint32_t                  width,
+                             uint32_t                  height) :
     context_(context)
   {
     if (context == NULL)
@@ -621,8 +621,8 @@
   }
 
 
-  void Image::UncompressPngImage(const void* data,
-                                 size_t size)
+  void OrthancImage::UncompressPngImage(const void* data,
+                                        size_t size)
   {
     Clear();
     image_ = OrthancPluginUncompressImage(context_, data, size, OrthancPluginImageFormat_Png);
@@ -634,8 +634,8 @@
   }
 
 
-  void Image::UncompressJpegImage(const void* data,
-                                  size_t size)
+  void OrthancImage::UncompressJpegImage(const void* data,
+                                         size_t size)
   {
     Clear();
     image_ = OrthancPluginUncompressImage(context_, data, size, OrthancPluginImageFormat_Jpeg);
@@ -647,9 +647,9 @@
   }
 
 
-  void Image::DecodeDicomImage(const void* data,
-                               size_t size,
-                               unsigned int frame)
+  void OrthancImage::DecodeDicomImage(const void* data,
+                                      size_t size,
+                                      unsigned int frame)
   {
     Clear();
     image_ = OrthancPluginDecodeDicomImage(context_, data, size, frame);
@@ -661,42 +661,42 @@
   }
 
 
-  OrthancPluginPixelFormat Image::GetPixelFormat()
+  OrthancPluginPixelFormat OrthancImage::GetPixelFormat()
   {
     CheckImageAvailable();
     return OrthancPluginGetImagePixelFormat(context_, image_);
   }
 
 
-  unsigned int Image::GetWidth()
+  unsigned int OrthancImage::GetWidth()
   {
     CheckImageAvailable();
     return OrthancPluginGetImageWidth(context_, image_);
   }
 
 
-  unsigned int Image::GetHeight()
+  unsigned int OrthancImage::GetHeight()
   {
     CheckImageAvailable();
     return OrthancPluginGetImageHeight(context_, image_);
   }
 
 
-  unsigned int Image::GetPitch()
+  unsigned int OrthancImage::GetPitch()
   {
     CheckImageAvailable();
     return OrthancPluginGetImagePitch(context_, image_);
   }
 
     
-  const void* Image::GetBuffer()
+  const void* OrthancImage::GetBuffer()
   {
     CheckImageAvailable();
     return OrthancPluginGetImageBuffer(context_, image_);
   }
 
 
-  void Image::CompressPngImage(MemoryBuffer& target)
+  void OrthancImage::CompressPngImage(MemoryBuffer& target)
   {
     CheckImageAvailable();
     
@@ -708,8 +708,8 @@
   }
 
 
-  void Image::CompressJpegImage(MemoryBuffer& target,
-                                uint8_t quality)
+  void OrthancImage::CompressJpegImage(MemoryBuffer& target,
+                                       uint8_t quality)
   {
     CheckImageAvailable();
     
@@ -721,7 +721,7 @@
   }
 
 
-  void Image::AnswerPngImage(OrthancPluginRestOutput* output)
+  void OrthancImage::AnswerPngImage(OrthancPluginRestOutput* output)
   {
     CheckImageAvailable();
     OrthancPluginCompressAndAnswerPngImage(context_, output, GetPixelFormat(),
@@ -729,8 +729,8 @@
   }
 
 
-  void Image::AnswerJpegImage(OrthancPluginRestOutput* output,
-                              uint8_t quality)
+  void OrthancImage::AnswerJpegImage(OrthancPluginRestOutput* output,
+                                     uint8_t quality)
   {
     CheckImageAvailable();
     OrthancPluginCompressAndAnswerJpegImage(context_, output, GetPixelFormat(),
--- a/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Fri Jun 24 22:25:14 2016 +0200
+++ b/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Fri Jun 24 22:35:04 2016 +0200
@@ -227,7 +227,7 @@
                         float defaultValue) const;
   };
 
-  class Image
+  class OrthancImage
   {
   private:
     OrthancPluginContext*  context_;
@@ -238,17 +238,17 @@
     void CheckImageAvailable();
 
   public:
-    Image(OrthancPluginContext*  context);
+    OrthancImage(OrthancPluginContext*  context);
 
-    Image(OrthancPluginContext*  context,
-          OrthancPluginImage*    image);
+    OrthancImage(OrthancPluginContext*  context,
+                 OrthancPluginImage*    image);
 
-    Image(OrthancPluginContext*     context,
-          OrthancPluginPixelFormat  format,
-          uint32_t                  width,
-          uint32_t                  height);
+    OrthancImage(OrthancPluginContext*     context,
+                 OrthancPluginPixelFormat  format,
+                 uint32_t                  width,
+                 uint32_t                  height);
 
-    ~Image()
+    ~OrthancImage()
     {
       Clear();
     }
--- a/Orthanc/Sdk-mainline/orthanc/OrthancCPlugin.h	Fri Jun 24 22:25:14 2016 +0200
+++ b/Orthanc/Sdk-mainline/orthanc/OrthancCPlugin.h	Fri Jun 24 22:35:04 2016 +0200
@@ -1569,6 +1569,7 @@
    * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
    * @param uri The URI in the built-in Orthanc API.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiGetAfterPlugins
    * @ingroup Orthanc
    **/
@@ -1598,6 +1599,7 @@
    * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
    * @param uri The URI in the built-in Orthanc API.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiGet
    * @ingroup Orthanc
    **/
@@ -1634,6 +1636,7 @@
    * @param body The body of the POST request.
    * @param bodySize The size of the body.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiPostAfterPlugins
    * @ingroup Orthanc
    **/
@@ -1668,6 +1671,7 @@
    * @param body The body of the POST request.
    * @param bodySize The size of the body.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiPost
    * @ingroup Orthanc
    **/
@@ -1696,6 +1700,7 @@
    * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
    * @param uri The URI to delete in the built-in Orthanc API.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiDeleteAfterPlugins
    * @ingroup Orthanc
    **/
@@ -1718,6 +1723,7 @@
    * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
    * @param uri The URI to delete in the built-in Orthanc API.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiDelete
    * @ingroup Orthanc
    **/
@@ -1742,6 +1748,7 @@
    * @param body The body of the PUT request.
    * @param bodySize The size of the body.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiPutAfterPlugins
    * @ingroup Orthanc
    **/
@@ -1777,6 +1784,7 @@
    * @param body The body of the PUT request.
    * @param bodySize The size of the body.
    * @return 0 if success, or the error code if failure.
+   * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
    * @see OrthancPluginRestApiPut
    * @ingroup Orthanc
    **/
--- a/Plugin/WadoUri.cpp	Fri Jun 24 22:25:14 2016 +0200
+++ b/Plugin/WadoUri.cpp	Fri Jun 24 22:35:04 2016 +0200
@@ -217,7 +217,7 @@
     throw OrthancPlugins::PluginException(OrthancPluginErrorCode_Plugin);
   }
   
-  OrthancPlugins::Image image(context);
+  OrthancPlugins::OrthancImage image(context);
   image.UncompressPngImage(png.GetData(), png.GetSize());
   image.AnswerJpegImage(output, 90 /* quality */);
 }
--- a/Resources/SyncOrthancFolder.py	Fri Jun 24 22:25:14 2016 +0200
+++ b/Resources/SyncOrthancFolder.py	Fri Jun 24 22:35:04 2016 +0200
@@ -28,6 +28,8 @@
     'Core/WebServiceParameters.cpp',
     'Core/WebServiceParameters.h',
     'Plugins/Samples/Common/ExportedSymbols.list',
+    'Plugins/Samples/Common/OrthancPluginCppWrapper.h',
+    'Plugins/Samples/Common/OrthancPluginCppWrapper.cpp',
     'Plugins/Samples/Common/VersionScript.map',
     'Resources/CMake/BoostConfiguration.cmake',
     'Resources/CMake/Compiler.cmake',