changeset 183:d31f216c9462 java-code-model

extracted custom functions/methods
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Jul 2024 14:52:20 +0200
parents 20b004998fc2
children f34f3a149c22
files CodeAnalysis/CustomFunctions.json CodeAnalysis/CustomMethods.json CodeAnalysis/GenerateOrthancSDK.py
diffstat 3 files changed, 98 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CodeAnalysis/CustomFunctions.json	Tue Jul 02 14:52:20 2024 +0200
@@ -0,0 +1,20 @@
+[
+  {
+    "c_function" : "OrthancPluginCreateMemoryBuffer",
+    "args" : [
+      {
+        "name" : "arg0",
+        "sdk_name" : "size",
+        "sdk_type" : "uint32_t"
+      }
+    ],
+    "documentation" : {
+      "args" : {
+        "size" : "Size of the memory buffer to be created"
+      },
+      "return" : "The newly allocated memory buffer",
+      "description" : [ "Create a new memory buffer managed by the Orthanc core" ]
+    },
+    "return_sdk_type" : "OrthancPluginMemoryBuffer *"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CodeAnalysis/CustomMethods.json	Tue Jul 02 14:52:20 2024 +0200
@@ -0,0 +1,73 @@
+{
+  "OrthancPluginFindQuery" : [
+    {
+      "short_name" : "GetFindQueryTagGroup",
+      "implementation" : "GetFindQueryTagGroup",
+      "sdk_function" : "OrthancPluginGetFindQueryTag",
+      "documentation" : {
+        "description" : [ "This function returns the group of one DICOM tag in the given C-Find query." ],
+        "args" : {
+          "index" : "The index of the tag of interest."
+        },
+        "return" : "The value of the group."
+      },
+      "args" : [
+        {
+          "sdk_name" : "index",
+          "sdk_type" : "uint32_t"
+        }
+      ],
+      "return_sdk_type" : "uint16_t"
+    },
+
+    {
+      "short_name" : "GetFindQueryTagElement",
+      "implementation" : "GetFindQueryTagElement",
+      "sdk_function" : "OrthancPluginGetFindQueryTag",
+      "documentation" : {
+        "description" : [ "This function returns the element of one DICOM tag in the given C-Find query." ],
+        "args" : {
+          "index" : "The index of the tag of interest."
+        },
+        "return" : "The value of the element."
+      },
+      "args" : [
+        {
+          "sdk_name" : "index",
+          "sdk_type" : "uint32_t"
+        }
+      ],
+      "return_sdk_type" : "uint16_t"
+    }
+  ],
+
+  "OrthancPluginDicomInstance" : [
+    {
+      "short_name" : "GetInstanceData",
+      "implementation" : "GetInstanceData",
+      "sdk_function" : "OrthancPluginGetInstanceData",
+      "documentation" : {
+        "description" : [ "Get the content of the DICOM instance." ],
+        "return" : "The DICOM data."
+      },
+      "args" : [
+      ],
+      "return_sdk_type" : "OrthancPluginMemoryBuffer *"
+    }
+  ],
+
+  "OrthancPluginImage" : [
+    {
+      "short_name" : "GetImageBuffer",
+      "implementation" : "GetImageBuffer",
+      "sdk_function" : "OrthancPluginGetImageBuffer",
+      "documentation" : {
+        "description" : [ "This function returns a pointer to the memory buffer that contains the pixels of the image." ],
+        "return" : "The pixel data."
+      },
+      "args" : [
+      ],
+      "return_sdk_type" : "OrthancPluginMemoryBuffer *"
+    }
+  ]
+}
--- a/CodeAnalysis/GenerateOrthancSDK.py	Tue Jul 02 14:06:56 2024 +0200
+++ b/CodeAnalysis/GenerateOrthancSDK.py	Tue Jul 02 14:52:20 2024 +0200
@@ -53,105 +53,14 @@
 ## implemented (not autogenerated)
 ##
 
-CUSTOM_FUNCTIONS = [
-    {
-        'c_function' : 'OrthancPluginCreateMemoryBuffer',
-        'args' : [
-            {
-                'name' : 'arg0',
-                'sdk_name' : 'size',
-                'sdk_type' : 'uint32_t',
-            }
-        ],
-        'documentation' : {
-            'args' : {
-                'size' : 'Size of the memory buffer to be created',
-            },
-            'return' : 'The newly allocated memory buffer',
-            'description' : [ 'Create a new memory buffer managed by the Orthanc core' ],
-        },
-        'return_sdk_type' : 'OrthancPluginMemoryBuffer *',
-    }
-]
+TARGET = os.path.realpath(args.target)
 
 
-CUSTOM_METHODS = {
-    'OrthancPluginFindQuery' : [
-        {
-            'short_name' : 'GetFindQueryTagGroup',
-            'implementation' : 'GetFindQueryTagGroup',
-            'sdk_function' : 'OrthancPluginGetFindQueryTag',
-            'documentation' : {
-                'description' : [ 'This function returns the group of one DICOM tag in the given C-Find query.' ],
-                'args' : {
-                    'index' : 'The index of the tag of interest.',
-                },
-                'return' : 'The value of the group.',
-            },
-            'args' : [
-                {
-                    'sdk_name' : 'index',
-                    'sdk_type' : 'uint32_t',
-                }
-            ],
-            'return_sdk_type' : 'uint16_t',
-        },
+with open(os.path.join(ROOT, 'CustomMethods.json'), 'r') as f:
+    CUSTOM_METHODS = json.loads(f.read())
 
-        {
-            'short_name' : 'GetFindQueryTagElement',
-            'implementation' : 'GetFindQueryTagElement',
-            'sdk_function' : 'OrthancPluginGetFindQueryTag',
-            'documentation' : {
-                'description' : [ 'This function returns the element of one DICOM tag in the given C-Find query.' ],
-                'args' : {
-                    'index' : 'The index of the tag of interest.',
-                },
-                'return' : 'The value of the element.',
-            },
-            'args' : [
-                {
-                    'sdk_name' : 'index',
-                    'sdk_type' : 'uint32_t',
-                }
-            ],
-            'return_sdk_type' : 'uint16_t',
-        },
-    ],
-
-    'OrthancPluginDicomInstance' : [
-        {
-            'short_name' : 'GetInstanceData',
-            'implementation' : 'GetInstanceData',
-            'sdk_function' : 'OrthancPluginGetInstanceData',
-            'documentation' : {
-                'description' : [ 'Get the content of the DICOM instance.' ],
-                'return' : 'The DICOM data.',
-            },
-            'args' : [
-            ],
-            'return_sdk_type' : 'OrthancPluginMemoryBuffer *',
-        },
-    ],
-
-    'OrthancPluginImage' : [
-        {
-            'short_name' : 'GetImageBuffer',
-            'implementation' : 'GetImageBuffer',
-            'sdk_function' : 'OrthancPluginGetImageBuffer',
-            'documentation' : {
-                'description' : [ 'This function returns a pointer to the memory buffer that contains the pixels of the image.' ],
-                'return' : 'The pixel data.',
-            },
-            'args' : [
-            ],
-            'return_sdk_type' : 'OrthancPluginMemoryBuffer *',
-        }
-    ],
-}
-
-
-
-TARGET = os.path.realpath(args.target)
+with open(os.path.join(ROOT, 'CustomFunctions.json'), 'r') as f:
+    CUSTOM_FUNCTIONS = json.loads(f.read())
 
 
 partials = {}