# HG changeset patch # User Sebastien Jodogne # Date 1550997013 -3600 # Node ID 8ed445e944868cebfefee0a46916e28d47fff7fa # Parent 6ce10c3b1eb78e3b7c487701fc9f53af15067677 Fix issue #126 (Orthanc and DCMDICTPATH) diff -r 6ce10c3b1eb7 -r 8ed445e94486 Core/DicomParsing/FromDcmtkBridge.cpp --- a/Core/DicomParsing/FromDcmtkBridge.cpp Sun Feb 24 08:51:15 2019 +0100 +++ b/Core/DicomParsing/FromDcmtkBridge.cpp Sun Feb 24 09:30:13 2019 +0100 @@ -141,22 +141,6 @@ } #endif } - -#else - static void LoadExternalDictionary(DcmDataDictionary& dictionary, - const std::string& directory, - const std::string& filename) - { - boost::filesystem::path p = directory; - p = p / filename; - - LOG(WARNING) << "Loading the external DICOM dictionary " << p; - - if (!dictionary.loadDictionary(p.string().c_str())) - { - throw OrthancException(ErrorCode_InternalError); - } - } #endif @@ -274,28 +258,37 @@ LOG(INFO) << "The dictionary of private tags has not been loaded"; } -#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) - std::string path = DCMTK_DICTIONARY_DIR; - +#else + std::vector dictionaries; + const char* env = std::getenv(DCM_DICT_ENVIRONMENT_VARIABLE); if (env != NULL) { - path = std::string(env); - } - - LoadExternalDictionary(*locker, path, "dicom.dic"); - - if (loadPrivateDictionary) - { - LoadExternalDictionary(*locker, path, "private.dic"); + // This mimics the behavior of DCMTK: + // https://support.dcmtk.org/docs/file_envvars.html +#if defined(_WIN32) + Toolbox::TokenizeString(dictionaries, std::string(env), ';'); +#else + Toolbox::TokenizeString(dictionaries, std::string(env), ':'); +#endif } else { - LOG(INFO) << "The dictionary of private tags has not been loaded"; + boost::filesystem::path base = DCMTK_DICTIONARY_DIR; + dictionaries.push_back((base / "dicom.dic").string()); + dictionaries.push_back((base / "private.dic").string()); } -#else -#error Support your platform here + for (size_t i = 0; i < dictionaries.size(); i++) + { + LOG(WARNING) << "Loading external DICOM dictionary: \"" << dictionaries[i] << "\""; + + if (!locker->loadDictionary(dictionaries[i].c_str())) + { + throw OrthancException(ErrorCode_InexistentFile); + } + } + #endif } diff -r 6ce10c3b1eb7 -r 8ed445e94486 NEWS --- a/NEWS Sun Feb 24 08:51:15 2019 +0100 +++ b/NEWS Sun Feb 24 09:30:13 2019 +0100 @@ -20,7 +20,9 @@ * Accept SOP classes: BreastProjectionXRayImageStorageForProcessing/Presentation * More tolerance wrt. missing DICOM tags that must be returned by Orthanc C-FIND SCP +* Orthanc now interprets the "DCMDICTPATH" environment variable the same way as DCMTK * New CMake option: "-DMSVC_MULTIPLE_PROCESSES=ON" for parallel build with Visual Studio +* Fix issue #126 (Orthanc and DCMDICTPATH) * Fix issue #131 (C-MOVE failure due to duplicate StudyInstanceUID in the database) * Fix issue #134 (/patient/modify gives 500, should really be 400) * Upgraded dependencies for static builds (notably on Windows):