Mercurial > hg > orthanc-stl
comparison Sources/Plugin.cpp @ 53:83b1abee3ece nexus
improved handling of CreatorVersionUID
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 18 May 2024 11:35:54 +0200 |
parents | f9e49dc63817 |
children | 41e3b79e7f4b |
comparison
equal
deleted
inserted
replaced
52:f9e49dc63817 | 53:83b1abee3ece |
---|---|
58 static const char* const ORTHANC_STL_MANUFACTURER = "ORTHANC^STL"; | 58 static const char* const ORTHANC_STL_MANUFACTURER = "ORTHANC^STL"; |
59 static const uint16_t ORTHANC_STL_PRIVATE_GROUP = 0x4205u; | 59 static const uint16_t ORTHANC_STL_PRIVATE_GROUP = 0x4205u; |
60 static const uint16_t ORTHANC_STL_CREATOR_ELEMENT = 0x0010u; | 60 static const uint16_t ORTHANC_STL_CREATOR_ELEMENT = 0x0010u; |
61 static const uint16_t ORTHANC_STL_NEXUS_ELEMENT = 0x1001u; | 61 static const uint16_t ORTHANC_STL_NEXUS_ELEMENT = 0x1001u; |
62 static const Orthanc::DicomTag DICOM_TAG_CREATOR_VERSION_UID(0x0008, 0x9123); | 62 static const Orthanc::DicomTag DICOM_TAG_CREATOR_VERSION_UID(0x0008, 0x9123); |
63 | |
64 /** | |
65 * Each version of the STL plugin must provide a different value for | |
66 * the CreatorVersionUID (0008,9123) tag. A new UID can be generated | |
67 * by typing: | |
68 * | |
69 * $ python -c 'import pydicom; print(pydicom.uid.generate_uid())' | |
70 * | |
71 **/ | |
72 static const char* const ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE = "1.2.826.0.1.3680043.8.498.90514926286349109728701975613711986292"; | |
73 | |
74 static const char* const GetCreatorVersionUid(const std::string& version) | |
75 { | |
76 if (version == "mainline") | |
77 { | |
78 return ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE; | |
79 } | |
80 else | |
81 { | |
82 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | |
83 } | |
84 } | |
85 | |
86 static void FillOrthancExplorerCreatorVersionUid(std::map<std::string, std::string>& dictionary) | |
87 { | |
88 dictionary["ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE"] = ORTHANC_STL_CREATOR_VERSION_UID_MAINLINE; | |
89 } | |
90 | |
63 #endif | 91 #endif |
64 | 92 |
65 | 93 |
66 // Forward declaration | 94 // Forward declaration |
67 void ReadStaticAsset(std::string& target, | 95 void ReadStaticAsset(std::string& target, |
886 | 914 |
887 OrthancPluginSendHttpStatus(context, output, 206 /* partial content */, part.c_str(), part.size()); | 915 OrthancPluginSendHttpStatus(context, output, 206 /* partial content */, part.c_str(), part.size()); |
888 } | 916 } |
889 | 917 |
890 | 918 |
891 static const char* GetCreatorVersionUid(const std::string& version) | |
892 { | |
893 /** | |
894 * Each version of the STL plugin must provide a different value for | |
895 * the CreatorVersionUID (0008,9123) tag. A new UID can be generated | |
896 * by typing: | |
897 * | |
898 * $ python -c 'import pydicom; print(pydicom.uid.generate_uid())' | |
899 * | |
900 **/ | |
901 | |
902 if (version == "mainline") | |
903 { | |
904 return "1.2.826.0.1.3680043.8.498.90514926286349109728701975613711986292"; | |
905 } | |
906 else | |
907 { | |
908 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | |
909 } | |
910 } | |
911 | |
912 | |
913 void DicomizeNexusModel(OrthancPluginRestOutput* output, | 919 void DicomizeNexusModel(OrthancPluginRestOutput* output, |
914 const char* url, | 920 const char* url, |
915 const OrthancPluginHttpRequest* request) | 921 const OrthancPluginHttpRequest* request) |
916 { | 922 { |
917 static const char* KEY_CONTENT = "Content"; | 923 static const char* KEY_CONTENT = "Content"; |
1081 | 1087 |
1082 std::map<std::string, std::string> dictionary; | 1088 std::map<std::string, std::string> dictionary; |
1083 dictionary["HAS_CREATE_DICOM_STL"] = (hasCreateDicomStl ? "true" : "false"); | 1089 dictionary["HAS_CREATE_DICOM_STL"] = (hasCreateDicomStl ? "true" : "false"); |
1084 dictionary["SHOW_NIFTI_BUTTON"] = (configuration.GetBooleanValue("EnableNIfTI", false) ? "true" : "false"); | 1090 dictionary["SHOW_NIFTI_BUTTON"] = (configuration.GetBooleanValue("EnableNIfTI", false) ? "true" : "false"); |
1085 dictionary["IS_NEXUS_ENABLED"] = (enableNexus ? "true" : "false"); | 1091 dictionary["IS_NEXUS_ENABLED"] = (enableNexus ? "true" : "false"); |
1092 FillOrthancExplorerCreatorVersionUid(dictionary); | |
1093 | |
1086 explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary); | 1094 explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary); |
1087 | 1095 |
1088 OrthancPlugins::ExtendOrthancExplorer(ORTHANC_PLUGIN_NAME, explorer); | 1096 OrthancPlugins::ExtendOrthancExplorer(ORTHANC_PLUGIN_NAME, explorer); |
1089 } | 1097 } |
1090 | 1098 |