changeset 194:0c5da632f34d java-code-model

added description of classes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Jul 2024 18:47:12 +0200
parents 66cd20e970d8
children d7a6e75558ee
files CodeAnalysis/GenerateOrthancSDK.py CodeAnalysis/PythonDocumentation.mustache Resources/Orthanc/Sdk-1.10.0/ClassDocumentation.json Resources/Orthanc/Sdk-1.10.0/ClassDocumentation.json.license Resources/SyncOrthancFolder.py Sources/Autogenerated/orthanc.pyi
diffstat 6 files changed, 79 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/CodeAnalysis/GenerateOrthancSDK.py	Tue Jul 02 18:37:04 2024 +0200
+++ b/CodeAnalysis/GenerateOrthancSDK.py	Tue Jul 02 18:47:12 2024 +0200
@@ -39,6 +39,10 @@
                     default = os.path.join(os.path.dirname(__file__),
                                            '../Resources/Orthanc/Sdk-1.10.0/CodeModel.json'),
                     help = 'Input code model, as generated by the orthanc-java project')
+parser.add_argument('--classes',
+                    default = os.path.join(os.path.dirname(__file__),
+                                           '../Resources/Orthanc/Sdk-1.10.0/ClassDocumentation.json'),
+                    help = 'Input description of classes, as defined in the orthanc-java project')
 parser.add_argument('--target',
                     default = os.path.join(os.path.dirname(__file__),
                                            '../Sources/Autogenerated'),
@@ -81,6 +85,9 @@
 with open(args.model, 'r') as f:
     model = json.loads(f.read())
 
+with open(args.classes, 'r') as f:
+    classes_description = json.loads(f.read())
+
 
 def ToUpperCase(name):
     s = ''
@@ -391,6 +398,7 @@
             custom_methods.append(custom_method)
 
     classes.append({
+        'description' : classes_description[c['name']],
         'class_name' : c['name'],
         'short_name' : GetShortName(c['name']),
         'methods' : methods,
--- a/CodeAnalysis/PythonDocumentation.mustache	Tue Jul 02 18:37:04 2024 +0200
+++ b/CodeAnalysis/PythonDocumentation.mustache	Tue Jul 02 18:47:12 2024 +0200
@@ -52,6 +52,9 @@
 
 {{#classes}}
 class {{short_name}}:
+    """
+    {{description}}
+    """
     ...
 
 {{#methods}}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Orthanc/Sdk-1.10.0/ClassDocumentation.json	Tue Jul 02 18:47:12 2024 +0200
@@ -0,0 +1,15 @@
+{
+  "OrthancPluginDicomInstance" : "DICOM instance managed by the Orthanc core",
+  "OrthancPluginDicomWebNode" : "Node visited by DICOMweb conversion",
+  "OrthancPluginFindAnswers" : "Answers to a DICOM C-FIND query",
+  "OrthancPluginFindMatcher" : "Matcher for DICOM C-FIND query",
+  "OrthancPluginFindQuery" : "DICOM C-FIND query",
+  "OrthancPluginImage" : "2D image managed by the Orthanc core",
+  "OrthancPluginJob" : "Orthanc job",
+  "OrthancPluginPeers" : "Orthanc peer",
+  "OrthancPluginRestOutput" : "Output for a call to the REST API of Orthanc",
+  "OrthancPluginServerChunkedRequestReader" : "Read for a chunked HTTP request",
+  "OrthancPluginStorageArea" : "Storage area plugin",
+  "OrthancPluginWorklistAnswers" : "Answers to a DICOM C-FIND worklist query",
+  "OrthancPluginWorklistQuery" : "DICOM C-FIND worklist query"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Orthanc/Sdk-1.10.0/ClassDocumentation.json.license	Tue Jul 02 18:47:12 2024 +0200
@@ -0,0 +1,2 @@
+# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
+# SPDX-License-Identifier: GPL-3.0-or-later
--- a/Resources/SyncOrthancFolder.py	Tue Jul 02 18:37:04 2024 +0200
+++ b/Resources/SyncOrthancFolder.py	Tue Jul 02 18:47:12 2024 +0200
@@ -78,20 +78,18 @@
 ])
 
 
-commands.append([
-    ORTHANC_JAVA_REPOSITORY,
-    'OrthancJava-%s' % ORTHANC_JAVA_VERSION,
-    'CodeGeneration/CodeModel.json',
-    'Sdk-%s/CodeModel.json' % PLUGIN_SDK_VERSION,
-])
-
-
-commands.append([
-    ORTHANC_JAVA_REPOSITORY,
-    'OrthancJava-%s' % ORTHANC_JAVA_VERSION,
-    'CodeGeneration/CodeModel.json.license',
-    'Sdk-%s/CodeModel.json.license' % PLUGIN_SDK_VERSION,
-])
+for f in [
+        'CodeModel.json',
+        'CodeModel.json.license',
+        'ClassDocumentation.json',
+        'ClassDocumentation.json.license',
+        ]:
+    commands.append([
+        ORTHANC_JAVA_REPOSITORY,
+        'OrthancJava-%s' % ORTHANC_JAVA_VERSION,
+        'CodeGeneration/%s' % f,
+        'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f),
+    ])
 
 
 pool = multiprocessing.Pool(10)  # simultaneous downloads
--- a/Sources/Autogenerated/orthanc.pyi	Tue Jul 02 18:37:04 2024 +0200
+++ b/Sources/Autogenerated/orthanc.pyi	Tue Jul 02 18:47:12 2024 +0200
@@ -2103,6 +2103,9 @@
 
 
 class DicomInstance:
+    """
+    DICOM instance managed by the Orthanc core
+    """
     ...
 
     # This function returns the Application Entity Title (AET) of the DICOM modality from which a DICOM instance originates
@@ -2259,10 +2262,16 @@
         """
         ...
 class DicomWebNode:
+    """
+    Node visited by DICOMweb conversion
+    """
     ...
 
 
 class FindAnswers:
+    """
+    Answers to a DICOM C-FIND query
+    """
     ...
 
     # This function adds one answer (encoded as a DICOM file) to the set of answers corresponding to some C-Find SCP request that is not related to modality worklists
@@ -2282,6 +2291,9 @@
         ...
 
 class FindMatcher:
+    """
+    Matcher for DICOM C-FIND query
+    """
     ...
 
     # This function checks whether one DICOM instance matches C-Find matcher that was previously allocated using OrthancPluginCreateFindMatcher()
@@ -2298,6 +2310,9 @@
         ...
 
 class FindQuery:
+    """
+    DICOM C-FIND query
+    """
     ...
 
     # This function returns the number of tags that are contained in the given C-Find query
@@ -2359,6 +2374,9 @@
         """
         ...
 class Image:
+    """
+    2D image managed by the Orthanc core
+    """
     ...
 
     # This function returns the type of memory layout for the pixels of the given image
@@ -2435,6 +2453,9 @@
         """
         ...
 class Job:
+    """
+    Orthanc job
+    """
     ...
 
     # This function adds the given job to the pending jobs of Orthanc
@@ -2451,6 +2472,9 @@
         ...
 
 class Peers:
+    """
+    Orthanc peer
+    """
     ...
 
     # This function returns the number of Orthanc peers
@@ -2505,6 +2529,9 @@
         ...
 
 class RestOutput:
+    """
+    Output for a call to the REST API of Orthanc
+    """
     ...
 
     # This function answers to a REST request with the content of a memory buffer
@@ -2642,10 +2669,16 @@
         ...
 
 class ServerChunkedRequestReader:
+    """
+    Read for a chunked HTTP request
+    """
     ...
 
 
 class StorageArea:
+    """
+    Storage area plugin
+    """
     ...
 
     # This function creates a new file inside the storage area that is currently used by Orthanc
@@ -2694,6 +2727,9 @@
         ...
 
 class WorklistAnswers:
+    """
+    Answers to a DICOM C-FIND worklist query
+    """
     ...
 
     # This function adds one worklist (encoded as a DICOM file) to the set of answers corresponding to some C-Find SCP request against modality worklists
@@ -2714,6 +2750,9 @@
         ...
 
 class WorklistQuery:
+    """
+    DICOM C-FIND worklist query
+    """
     ...
 
     # This function checks whether one worklist (encoded as a DICOM file) matches the C-Find SCP query against modality worklists