changeset 3429:954d15f24366

new function in SDK: OrthancPluginGetTagName()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Jun 2019 18:04:02 +0200
parents 6add197274b1
children 297ad330900c
files NEWS Plugins/Engine/OrthancPlugins.cpp Plugins/Engine/OrthancPlugins.h Plugins/Include/orthanc/OrthancCPlugin.h
diffstat 4 files changed, 64 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Jun 17 09:44:45 2019 +0200
+++ b/NEWS	Mon Jun 17 18:04:02 2019 +0200
@@ -15,6 +15,7 @@
 * New functions in the SDK:
   - OrthancPluginHttpClientChunkedBody(): HTTP client for POST/PUT with a chunked body
   - OrthancPluginRegisterMultipartRestCallback(): HTTP server for POST/PUT with multipart body
+  - OrthancPluginGetTagName(): Retrieve the name of a DICOM tag from its group and element
 
 Maintenance
 -----------
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Jun 17 09:44:45 2019 +0200
+++ b/Plugins/Engine/OrthancPlugins.cpp	Mon Jun 17 18:04:02 2019 +0200
@@ -2842,6 +2842,23 @@
   }
 
 
+  void OrthancPlugins::GetTagName(const void* parameters)
+  {
+    const _OrthancPluginGetTagName& p =
+      *reinterpret_cast<const _OrthancPluginGetTagName*>(parameters);
+
+    std::string privateCreator;
+    
+    if (p.privateCreator != NULL)
+    {
+      privateCreator = p.privateCreator;
+    }
+   
+    DicomTag tag(p.group, p.element);
+    *p.result = CopyString(FromDcmtkBridge::GetTagName(tag, privateCreator));
+  }
+
+
   void OrthancPlugins::ApplyCreateImage(_OrthancPluginService service,
                                         const void* parameters)
   {
@@ -3677,6 +3694,10 @@
         return true;
       }
 
+      case _OrthancPluginService_GetTagName:
+        GetTagName(parameters);
+        return true;
+
       default:
         return false;
     }
--- a/Plugins/Engine/OrthancPlugins.h	Mon Jun 17 09:44:45 2019 +0200
+++ b/Plugins/Engine/OrthancPlugins.h	Mon Jun 17 18:04:02 2019 +0200
@@ -203,6 +203,8 @@
     void ComputeHash(_OrthancPluginService service,
                      const void* parameters);
 
+    void GetTagName(const void* parameters);
+
     void SignalChangeInternal(OrthancPluginChangeType changeType,
                               OrthancPluginResourceType resourceType,
                               const char* resource);
--- a/Plugins/Include/orthanc/OrthancCPlugin.h	Mon Jun 17 09:44:45 2019 +0200
+++ b/Plugins/Include/orthanc/OrthancCPlugin.h	Mon Jun 17 18:04:02 2019 +0200
@@ -433,6 +433,7 @@
     _OrthancPluginService_EncodeDicomWebJson = 32,
     _OrthancPluginService_EncodeDicomWebXml = 33,
     _OrthancPluginService_ChunkedHttpClient = 34,   /* New in Orthanc 1.5.7 */
+    _OrthancPluginService_GetTagName = 35,   /* New in Orthanc 1.5.7 */
     
     /* Registration of callbacks */
     _OrthancPluginService_RegisterRestCallback = 1000,
@@ -6968,6 +6969,45 @@
     context->InvokeService(context, _OrthancPluginService_RegisterChunkedRestCallback, &params);
   }
 
+
+
+
+
+  typedef struct
+  {
+    char**       result;
+    uint16_t     group;
+    uint16_t     element;
+    const char*  privateCreator;
+  } _OrthancPluginGetTagName;
+
+  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetTagName(
+    OrthancPluginContext*  context,
+    uint16_t               group,
+    uint16_t               element,
+    const char*            privateCreator /* can be NULL */)
+  {
+    char* result;
+
+    _OrthancPluginGetTagName params;
+    params.result = &result;
+    params.group = group;
+    params.element = element;
+    params.privateCreator = privateCreator;
+
+    if (context->InvokeService(context, _OrthancPluginService_GetTagName, &params) != OrthancPluginErrorCode_Success)
+    {
+      /* Error */
+      return NULL;
+    }
+    else
+    {
+      return result;
+    }
+  }
+
+
+  
 #ifdef  __cplusplus
 }
 #endif