# HG changeset patch # User Sebastien Jodogne # Date 1716024954 -7200 # Node ID 83b1abee3ece46ef086bd716c3569a27f1e4c7a7 # Parent f9e49dc63817fa82eac9fc94e584d5c2307b7fd3 improved handling of CreatorVersionUID diff -r f9e49dc63817 -r 83b1abee3ece Sources/OrthancExplorer.js --- a/Sources/OrthancExplorer.js Sat May 18 11:24:04 2024 +0200 +++ b/Sources/OrthancExplorer.js Sat May 18 11:35:54 2024 +0200 @@ -26,8 +26,6 @@ const STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT = '1.2.840.10008.5.1.4.1.1.481.3'; const STL_PLUGIN_SOP_CLASS_UID_RAW = '1.2.840.10008.5.1.4.1.1.66'; -const STL_PLUGIN_NEXUS_CREATOR_VERSION_UID = '1.2.826.0.1.3680043.8.498.90514926286349109728701975613711986292'; - function AddStlViewer(target, name, callback) { var li = $('
  • ', { @@ -399,7 +397,7 @@ $.ajax({ url: '/instances/' + instanceId + '/content/0008,9123', success: function(creatorVersionUid) { - if (creatorVersionUid == STL_PLUGIN_NEXUS_CREATOR_VERSION_UID) { + if (creatorVersionUid == '${ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE}') { var b = $('') .attr('id', id) .attr('data-role', 'button') diff -r f9e49dc63817 -r 83b1abee3ece Sources/Plugin.cpp --- a/Sources/Plugin.cpp Sat May 18 11:24:04 2024 +0200 +++ b/Sources/Plugin.cpp Sat May 18 11:35:54 2024 +0200 @@ -60,6 +60,34 @@ static const uint16_t ORTHANC_STL_CREATOR_ELEMENT = 0x0010u; static const uint16_t ORTHANC_STL_NEXUS_ELEMENT = 0x1001u; static const Orthanc::DicomTag DICOM_TAG_CREATOR_VERSION_UID(0x0008, 0x9123); + +/** + * Each version of the STL plugin must provide a different value for + * the CreatorVersionUID (0008,9123) tag. A new UID can be generated + * by typing: + * + * $ python -c 'import pydicom; print(pydicom.uid.generate_uid())' + * + **/ +static const char* const ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE = "1.2.826.0.1.3680043.8.498.90514926286349109728701975613711986292"; + +static const char* const GetCreatorVersionUid(const std::string& version) +{ + if (version == "mainline") + { + return ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE; + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + } +} + +static void FillOrthancExplorerCreatorVersionUid(std::map& dictionary) +{ + dictionary["ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE"] = ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE; +} + #endif @@ -888,28 +916,6 @@ } -static const char* GetCreatorVersionUid(const std::string& version) -{ - /** - * Each version of the STL plugin must provide a different value for - * the CreatorVersionUID (0008,9123) tag. A new UID can be generated - * by typing: - * - * $ python -c 'import pydicom; print(pydicom.uid.generate_uid())' - * - **/ - - if (version == "mainline") - { - return "1.2.826.0.1.3680043.8.498.90514926286349109728701975613711986292"; - } - else - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); - } -} - - void DicomizeNexusModel(OrthancPluginRestOutput* output, const char* url, const OrthancPluginHttpRequest* request) @@ -1083,6 +1089,8 @@ dictionary["HAS_CREATE_DICOM_STL"] = (hasCreateDicomStl ? "true" : "false"); dictionary["SHOW_NIFTI_BUTTON"] = (configuration.GetBooleanValue("EnableNIfTI", false) ? "true" : "false"); dictionary["IS_NEXUS_ENABLED"] = (enableNexus ? "true" : "false"); + FillOrthancExplorerCreatorVersionUid(dictionary); + explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary); OrthancPlugins::ExtendOrthancExplorer(ORTHANC_PLUGIN_NAME, explorer);