Mercurial > hg > orthanc-python
diff CodeAnalysis/ParseOrthancSDK.py @ 65:4da5ce3468b4
new wrapped functions: CreateImageFromBuffer(), DicomInstance.GetInstanceData() and Image.GetImageBuffer()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jun 2021 12:47:18 +0200 |
parents | 091fb1903bfc |
children | 6fc445793796 |
line wrap: on
line diff
--- a/CodeAnalysis/ParseOrthancSDK.py Fri Jun 11 09:03:43 2021 +0200 +++ b/CodeAnalysis/ParseOrthancSDK.py Fri Jun 11 12:47:18 2021 +0200 @@ -35,11 +35,11 @@ ## implemented (not autogenerated) ## -CUSTOM_FUNCTIONS = { +CUSTOM_FUNCTIONS = set([ 'OrthancPluginCreateDicom', + 'OrthancPluginCreateImageAccessor', # Replaced by "orthanc.CreateImageFromBuffer()" 'OrthancPluginFreeMemoryBuffer', 'OrthancPluginFreeString', - 'OrthancPluginGetFindQueryTag', 'OrthancPluginRegisterFindCallback', 'OrthancPluginRegisterIncomingHttpRequestFilter', # Implemented through v2 'OrthancPluginRegisterIncomingHttpRequestFilter2', @@ -49,8 +49,7 @@ 'OrthancPluginRegisterRestCallback', # Implemented using OrthancPlugins::RegisterRestCallback 'OrthancPluginRegisterRestCallbackNoLock', # Implemented using OrthancPlugins::RegisterRestCallback 'OrthancPluginRegisterWorklistCallback', - 'OrthancPluginWorklistAddAnswer', -} +]) CUSTOM_METHODS = [ { @@ -71,8 +70,23 @@ 'implementation' : 'WorklistAddAnswer', 'sdk_function' : 'OrthancPluginWorklistAddAnswer', }, + { + 'class_name' : 'OrthancPluginDicomInstance', + 'method_name' : 'GetInstanceData', + 'implementation' : 'GetInstanceData', + 'sdk_function' : 'OrthancPluginGetInstanceData', + }, + { + 'class_name' : 'OrthancPluginImage', + 'method_name' : 'GetImageBuffer', + 'implementation' : 'GetImageBuffer', + 'sdk_function' : 'OrthancPluginGetImageBuffer', + }, ] +for method in CUSTOM_METHODS: + CUSTOM_FUNCTIONS.add(method['sdk_function']) + ## ## Parse the command-line arguments @@ -393,7 +407,11 @@ countAllFunctions += 1 args = args[1:] - if not IsSupportedTargetType(node.result_type): + if node.spelling in CUSTOM_FUNCTIONS: + print('Ignoring custom function that is manually implemented: %s()' % node.spelling) + countSupportedFunctions += 1 + + elif not IsSupportedTargetType(node.result_type): print('*** UNSUPPORTED OUTPUT: %s' % node.spelling) elif (len(args) == 1 and @@ -457,10 +475,6 @@ classes[className]['methods'].append(method) countSupportedFunctions += 1 - elif node.spelling in CUSTOM_FUNCTIONS: - print('Ignoring custom function that is manually implemented: %s()' % node.spelling) - countSupportedFunctions += 1 - else: print('*** UNSUPPORTED INPUT: %s' % node.spelling)