Mercurial > hg > orthanc-python
changeset 175:c012edac593e java-code-model
patching the Orthanc SDK
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Jun 2024 18:10:31 +0200 |
parents | e9be3c9294d4 |
children | 194ba7d6e0f4 |
files | Resources/Orthanc/Sdk-1.10.0/orthanc/OrthancCPlugin.h Resources/SyncOrthancFolder.py |
diffstat | 2 files changed, 60 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/Orthanc/Sdk-1.10.0/orthanc/OrthancCPlugin.h Thu Jun 27 18:02:06 2024 +0200 +++ b/Resources/Orthanc/Sdk-1.10.0/orthanc/OrthancCPlugin.h Thu Jun 27 18:10:31 2024 +0200 @@ -837,7 +837,7 @@ **/ typedef enum { - OrthancPluginDicomToJsonFlags_None = 0, + OrthancPluginDicomToJsonFlags_None = 0, /*!< Default formatting */ OrthancPluginDicomToJsonFlags_IncludeBinary = (1 << 0), /*!< Include the binary tags */ OrthancPluginDicomToJsonFlags_IncludePrivateTags = (1 << 1), /*!< Include the private tags */ OrthancPluginDicomToJsonFlags_IncludeUnknownTags = (1 << 2), /*!< Include the tags unknown by the dictionary */ @@ -858,7 +858,7 @@ **/ typedef enum { - OrthancPluginCreateDicomFlags_None = 0, + OrthancPluginCreateDicomFlags_None = 0, /*!< Default mode */ OrthancPluginCreateDicomFlags_DecodeDataUriScheme = (1 << 0), /*!< Decode fields encoded using data URI scheme */ OrthancPluginCreateDicomFlags_GenerateIdentifiers = (1 << 1), /*!< Automatically generate DICOM identifiers */ @@ -975,32 +975,46 @@ **/ typedef enum { + /** + * Success: The DICOM instance is properly stored in the SCP + **/ OrthancPluginStorageCommitmentFailureReason_Success = 0, - /*!< Success: The DICOM instance is properly stored in the SCP */ - + + /** + * 0110H: A general failure in processing the operation was encountered + **/ OrthancPluginStorageCommitmentFailureReason_ProcessingFailure = 1, - /*!< 0110H: A general failure in processing the operation was encountered */ - + + /** + * 0112H: One or more of the elements in the Referenced SOP + * Instance Sequence was not available + **/ OrthancPluginStorageCommitmentFailureReason_NoSuchObjectInstance = 2, - /*!< 0112H: One or more of the elements in the Referenced SOP - Instance Sequence was not available */ - + + /** + * 0213H: The SCP does not currently have enough resources to + * store the requested SOP Instance(s) + **/ OrthancPluginStorageCommitmentFailureReason_ResourceLimitation = 3, - /*!< 0213H: The SCP does not currently have enough resources to - store the requested SOP Instance(s) */ - + + /** + * 0122H: Storage Commitment has been requested for a SOP Instance + * with a SOP Class that is not supported by the SCP + **/ OrthancPluginStorageCommitmentFailureReason_ReferencedSOPClassNotSupported = 4, - /*!< 0122H: Storage Commitment has been requested for a SOP - Instance with a SOP Class that is not supported by the SCP */ - + + /** + * 0119H: The SOP Class of an element in the Referenced SOP + * Instance Sequence did not correspond to the SOP class + * registered for this SOP Instance at the SCP + **/ OrthancPluginStorageCommitmentFailureReason_ClassInstanceConflict = 5, - /*!< 0119H: The SOP Class of an element in the Referenced SOP - Instance Sequence did not correspond to the SOP class registered - for this SOP Instance at the SCP */ - + + /** + * 0131H: The Transaction UID of the Storage Commitment Request is + * already in use + **/ OrthancPluginStorageCommitmentFailureReason_DuplicateTransactionUID = 6 - /*!< 0131H: The Transaction UID of the Storage Commitment Request - is already in use */ } OrthancPluginStorageCommitmentFailureReason; @@ -1829,15 +1843,16 @@ * @see OrthancPluginCheckVersion * @ingroup Callbacks **/ - ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersionAdvanced( + ORTHANC_PLUGIN_INLINE int32_t OrthancPluginCheckVersionAdvanced( OrthancPluginContext* context, - int expectedMajor, - int expectedMinor, - int expectedRevision) - { - int major, minor, revision; - - if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) || + int32_t expectedMajor, + int32_t expectedMinor, + int32_t expectedRevision) + { + int32_t major, minor, revision; + + if (sizeof(int) != sizeof(int32_t) || /* Ensure binary compatibility with Orthanc SDK <= 1.12.1 */ + sizeof(int32_t) != sizeof(OrthancPluginErrorCode) || sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) || sizeof(int32_t) != sizeof(_OrthancPluginService) || sizeof(int32_t) != sizeof(_OrthancPluginProperty) || @@ -1935,7 +1950,7 @@ * @see OrthancPluginCheckVersionAdvanced * @ingroup Callbacks **/ - ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion( + ORTHANC_PLUGIN_INLINE int32_t OrthancPluginCheckVersion( OrthancPluginContext* context) { return OrthancPluginCheckVersionAdvanced( @@ -3077,7 +3092,7 @@ * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error. * @ingroup DicomInstance **/ - ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata( + ORTHANC_PLUGIN_INLINE int32_t OrthancPluginHasInstanceMetadata( OrthancPluginContext* context, const OrthancPluginDicomInstance* instance, const char* metadata) @@ -3856,13 +3871,13 @@ OrthancPluginContext* context, OrthancPluginRestOutput* output, uint16_t status, - const char* body, + const void* body, uint32_t bodySize) { _OrthancPluginSendHttpStatus params; params.output = output; params.status = status; - params.body = body; + params.body = reinterpret_cast<const char*>(body); params.bodySize = bodySize; context->InvokeService(context, _OrthancPluginService_SendHttpStatus, ¶ms); } @@ -6760,7 +6775,7 @@ { char** resultId; OrthancPluginJob *job; - int priority; + int32_t priority; } _OrthancPluginSubmitJob; /** @@ -6779,7 +6794,7 @@ ORTHANC_PLUGIN_INLINE char *OrthancPluginSubmitJob( OrthancPluginContext *context, OrthancPluginJob *job, - int priority) + int32_t priority) { char* resultId = NULL;
--- a/Resources/SyncOrthancFolder.py Thu Jun 27 18:02:06 2024 +0200 +++ b/Resources/SyncOrthancFolder.py Thu Jun 27 18:10:31 2024 +0200 @@ -8,6 +8,7 @@ import multiprocessing import os import stat +import subprocess import urllib.request TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') @@ -76,3 +77,12 @@ pool = multiprocessing.Pool(10) # simultaneous downloads pool.map(Download, commands) + +# Patch the SDK, if need be +patch = os.path.join(os.path.abspath(os.path.dirname(__file__)), + 'OrthancCPlugin-%s.patch' % PLUGIN_SDK_VERSION) +if os.path.exists(patch): + subprocess.check_call([ 'patch', '-p0', '-i', patch ], + cwd = os.path.join(os.path.dirname(__file__), + 'Orthanc', + 'Sdk-%s' % PLUGIN_SDK_VERSION, 'orthanc'))