Mercurial > hg > orthanc
changeset 3302:8ed445e94486
Fix issue #126 (Orthanc and DCMDICTPATH)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 24 Feb 2019 09:30:13 +0100 |
parents | 6ce10c3b1eb7 |
children | a215182a0c2f |
files | Core/DicomParsing/FromDcmtkBridge.cpp NEWS |
diffstat | 2 files changed, 25 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- 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<std::string> 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 }
--- 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):