# HG changeset patch # User Alain Mazy # Date 1699907624 -3600 # Node ID 1bda8ea224de468b58b70eec71b5dea2a5eb50f5 # Parent 1aea0a224e90acb83dc9a4b61d6eb2f7cbfac060 sync orthanc folder diff -r 1aea0a224e90 -r 1bda8ea224de .hgignore --- a/.hgignore Mon Aug 14 10:28:24 2023 +0200 +++ b/.hgignore Mon Nov 13 21:33:44 2023 +0100 @@ -7,3 +7,4 @@ OHIF/Viewers-*.tar.gz OHIF/dist i/ +.vscode/ \ No newline at end of file diff -r 1aea0a224e90 -r 1bda8ea224de CMakeLists.txt --- a/CMakeLists.txt Mon Aug 14 10:28:24 2023 +0200 +++ b/CMakeLists.txt Mon Nov 13 21:33:44 2023 +0100 @@ -196,6 +196,8 @@ VERSION ${ORTHANC_OHIF_VERSION} SOVERSION ${ORTHANC_OHIF_VERSION}) +DefineSourceBasenameForTarget(OrthancOHIF) + install( TARGETS OrthancOHIF RUNTIME DESTINATION lib # Destination for Windows diff -r 1aea0a224e90 -r 1bda8ea224de Resources/Orthanc/CMake/Compiler.cmake --- a/Resources/Orthanc/CMake/Compiler.cmake Mon Aug 14 10:28:24 2023 +0200 +++ b/Resources/Orthanc/CMake/Compiler.cmake Mon Nov 13 21:33:44 2023 +0100 @@ -263,3 +263,24 @@ # preceding batches. https://cmake.org/Bug/view.php?id=14874 set(CMAKE_CXX_ARCHIVE_APPEND " q ") endif() + + +# This function defines macro "__ORTHANC_FILE__" as a replacement to +# macro "__FILE__", as the latter leaks the full path of the source +# files in the binaries +# https://stackoverflow.com/questions/8487986/file-macro-shows-full-path +# https://twitter.com/wget42/status/1676877802375634944?s=20 +function(DefineSourceBasenameForTarget targetname) + # Microsoft Visual Studio is extremely slow if using + # "set_property()", we only enable this feature for gcc and clang + if (CMAKE_COMPILER_IS_GNUCXX OR + CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + get_target_property(source_files "${targetname}" SOURCES) + foreach(sourcefile ${source_files}) + get_filename_component(basename "${sourcefile}" NAME) + set_property( + SOURCE "${sourcefile}" APPEND + PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"") + endforeach() + endif() +endfunction() diff -r 1aea0a224e90 -r 1bda8ea224de Resources/Orthanc/CMake/DownloadOrthancFramework.cmake --- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Mon Aug 14 10:28:24 2023 +0200 +++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Mon Nov 13 21:33:44 2023 +0100 @@ -153,9 +153,11 @@ elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.2") set(ORTHANC_FRAMEWORK_MD5 "ede3de356493a8868545f8cb4b8bc8b5") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.3") - set(ORTHANC_FRAMEWORK_MD5 "5c1b11009d782f248739919db6bf7f7a") + set(ORTHANC_FRAMEWORK_MD5 "f941c0f5771db7616e7b7961026a60e2") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.0") set(ORTHANC_FRAMEWORK_MD5 "d32a0cde03b6eb603d8dd2b33d38bf1b") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.1") + set(ORTHANC_FRAMEWORK_MD5 "8a435140efc8ff4a01d8242f092f21de") # Below this point are development snapshots that were used to # release some plugin, before an official release of the Orthanc @@ -179,6 +181,9 @@ elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "b2e08d83e21d") # WSI 1.1 (framework pre-1.10.0), to remove "-std=c++11" set(ORTHANC_FRAMEWORK_MD5 "2eaa073cbb4b44ffba199ad93393b2b1") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "daf4807631c5") + # DICOMweb 1.15 (framework pre-1.12.2) + set(ORTHANC_FRAMEWORK_MD5 "c644aff2817306b3207c98c92e43f35f") endif() endif() endif() @@ -266,7 +271,7 @@ else() message("Forking the Orthanc source repository using Mercurial") execute_process( - COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://hg.orthanc-server.com/orthanc/" + COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://orthanc.uclouvain.be/hg/orthanc/" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE Failure ) diff -r 1aea0a224e90 -r 1bda8ea224de Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Aug 14 10:28:24 2023 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Nov 13 21:33:44 2023 +0100 @@ -79,6 +79,10 @@ } } + void ResetGlobalContext() + { + globalContext_ = NULL; + } bool HasGlobalContext() { @@ -1670,15 +1674,16 @@ return true; } +#ifdef _MSC_VER +#define ORTHANC_SCANF sscanf_s +#else +#define ORTHANC_SCANF sscanf +#endif + // Parse the version - int aa, bb, cc; - if ( -#ifdef _MSC_VER - sscanf_s -#else - sscanf -#endif - (version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 || + int aa, bb, cc = 0; + if ((ORTHANC_SCANF(version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 && + ORTHANC_SCANF(version, "%4d.%4d", &aa, &bb) != 2) || aa < 0 || bb < 0 || cc < 0) @@ -3752,6 +3757,27 @@ #endif +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 1) + DicomInstance* DicomInstance::Load(const std::string& instanceId, + OrthancPluginLoadDicomInstanceMode mode) + { + OrthancPluginDicomInstance* instance = OrthancPluginLoadDicomInstance( + GetGlobalContext(), instanceId.c_str(), mode); + + if (instance == NULL) + { + ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); + } + else + { + boost::movelib::unique_ptr result(new DicomInstance(instance)); + result->toFree_ = true; + return result.release(); + } + } +#endif + + #if HAS_ORTHANC_PLUGIN_WEBDAV == 1 static std::vector WebDavConvertPath(uint32_t pathSize, const char* const* pathItems) diff -r 1aea0a224e90 -r 1bda8ea224de Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Mon Aug 14 10:28:24 2023 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Mon Nov 13 21:33:44 2023 +0100 @@ -137,6 +137,8 @@ void SetGlobalContext(OrthancPluginContext* context); + void ResetGlobalContext(); + bool HasGlobalContext(); OrthancPluginContext* GetGlobalContext(); @@ -1264,6 +1266,11 @@ ~DicomInstance(); + const OrthancPluginDicomInstance* GetObject() const + { + return instance_; + } + std::string GetRemoteAet() const; const void* GetBuffer() const @@ -1318,6 +1325,11 @@ size_t size, const std::string& transferSyntax); #endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 1) + static DicomInstance* Load(const std::string& instanceId, + OrthancPluginLoadDicomInstanceMode mode); +#endif }; // helper method to convert Http headers from the plugin SDK to a std::map diff -r 1aea0a224e90 -r 1bda8ea224de Resources/SyncOrthancFolder.py --- a/Resources/SyncOrthancFolder.py Mon Aug 14 10:28:24 2023 +0200 +++ b/Resources/SyncOrthancFolder.py Mon Nov 13 21:33:44 2023 +0100 @@ -32,7 +32,7 @@ TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') PLUGIN_SDK_VERSION = '1.0.0' -REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file' +REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file' FILES = [ ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'),