# HG changeset patch # User Sebastien Jodogne # Date 1366190031 -7200 # Node ID 2cef9c2d414868bb40de460e8f3959ed360b2249 # Parent d1ea72f1c96713e859499cde63fc623a9934c2bf separate path for SQLite index, manual loading of external dictionaries diff -r d1ea72f1c967 -r 2cef9c2d4148 NEWS --- a/NEWS Tue Apr 16 17:33:44 2013 +0200 +++ b/NEWS Wed Apr 17 11:13:51 2013 +0200 @@ -2,6 +2,9 @@ =============================== * Support of RGB images +* Fix of store SCU in release builds +* Possibility to store the SQLite index at another place than the + DICOM instances Version 0.5.0 (2013/01/31) diff -r d1ea72f1c967 -r 2cef9c2d4148 OrthancServer/DicomProtocol/DicomServer.cpp --- a/OrthancServer/DicomProtocol/DicomServer.cpp Tue Apr 16 17:33:44 2013 +0200 +++ b/OrthancServer/DicomProtocol/DicomServer.cpp Wed Apr 17 11:13:51 2013 +0200 @@ -39,9 +39,14 @@ #include "EmbeddedResources.h" #include +#include #include #include +#if defined(__linux) +#include +#endif + namespace Orthanc { @@ -70,17 +75,31 @@ } + static void LoadExternalDictionary(DcmDataDictionary& dictionary, + const std::string& directory, + const std::string& filename) + { + boost::filesystem::path p = directory; + p = p / filename; + + if (!dictionary.loadDictionary(p.string().c_str())) + { + throw OrthancException(ErrorCode_InternalError); + } + } + + void DicomServer::ServerThread(DicomServer* server) { /* Disable "gethostbyaddr" (which results in memory leaks) and use raw IP addresses */ dcmDisableGethostbyaddr.set(OFTrue); -#if DCMTK_USE_EMBEDDED_DICTIONARIES == 1 - LOG(WARNING) << "Loading the embedded dictionaries"; dcmDataDict.clear(); DcmDataDictionary& d = dcmDataDict.wrlock(); +#if DCMTK_USE_EMBEDDED_DICTIONARIES == 1 + LOG(WARNING) << "Loading the embedded dictionaries"; /** * Do not load DICONDE dictionary, it breaks the other tags. The * command "strace storescu 2>&1 |grep dic" shows that DICONDE @@ -90,8 +109,24 @@ LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_DICOM); LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_PRIVATE); + +#elif defined(__linux) + std::string path = "/usr/share/dcmtk"; + + const char* env = std::getenv(DCM_DICT_ENVIRONMENT_VARIABLE); + if (env != NULL) + { + path = std::string(env); + } + + LoadExternalDictionary(d, path, "dicom.dic"); + LoadExternalDictionary(d, path, "private.dic"); + +#else +#error Support your platform here +#endif + dcmDataDict.unlock(); -#endif /* make sure data dictionary is loaded */ if (!dcmDataDict.isDictionaryLoaded()) diff -r d1ea72f1c967 -r 2cef9c2d4148 OrthancServer/ServerContext.cpp --- a/OrthancServer/ServerContext.cpp Tue Apr 16 17:33:44 2013 +0200 +++ b/OrthancServer/ServerContext.cpp Wed Apr 17 11:13:51 2013 +0200 @@ -52,9 +52,10 @@ namespace Orthanc { - ServerContext::ServerContext(const boost::filesystem::path& path) : - storage_(path.string()), - index_(*this, path.string()), + ServerContext::ServerContext(const boost::filesystem::path& storagePath, + const boost::filesystem::path& indexPath) : + storage_(storagePath.string()), + index_(*this, indexPath.string()), accessor_(storage_), provider_(*this), dicomCache_(provider_, DICOM_CACHE_SIZE) diff -r d1ea72f1c967 -r 2cef9c2d4148 OrthancServer/ServerContext.h --- a/OrthancServer/ServerContext.h Tue Apr 16 17:33:44 2013 +0200 +++ b/OrthancServer/ServerContext.h Wed Apr 17 11:13:51 2013 +0200 @@ -71,7 +71,8 @@ MemoryCache dicomCache_; public: - ServerContext(const boost::filesystem::path& path); + ServerContext(const boost::filesystem::path& storagePath, + const boost::filesystem::path& indexPath); ServerIndex& GetIndex() { diff -r d1ea72f1c967 -r 2cef9c2d4148 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Tue Apr 16 17:33:44 2013 +0200 +++ b/OrthancServer/main.cpp Wed Apr 17 11:13:51 2013 +0200 @@ -210,7 +210,12 @@ } boost::filesystem::path storageDirectory = GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); - ServerContext context(storageDirectory); + boost::filesystem::path indexDirectory = GetGlobalStringParameter("IndexDirectory", storageDirectory.string()); + ServerContext context(storageDirectory, indexDirectory); + + LOG(WARNING) << "Storage directory: " << storageDirectory; + LOG(WARNING) << "Index directory: " << indexDirectory; + context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false)); try diff -r d1ea72f1c967 -r 2cef9c2d4148 Resources/Configuration.json --- a/Resources/Configuration.json Tue Apr 16 17:33:44 2013 +0200 +++ b/Resources/Configuration.json Wed Apr 17 11:13:51 2013 +0200 @@ -7,9 +7,15 @@ // displayed in Orthanc Explorer and at the URI "/system". "Name" : "MyOrthanc", - // Path to the directory that holds the database + // Path to the directory that holds the heavyweight files + // (i.e. the raw DICOM instances) "StorageDirectory" : "OrthancStorage", + // Path to the directory that holds the SQLite index (if unset, + // the value of StorageDirectory is used). This index could be + // stored on a RAM-drive or a SSD device for performance reasons. + "IndexDirectory" : "OrthancStorage", + // Enable the transparent compression of the DICOM instances "StorageCompression" : false,