fw4spl
Dictionary.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "fwDcmtkTools/Dictionary.hpp"
8 
9 #include <fwCore/spyLog.hpp>
10 
11 #include <fwRuntime/operations.hpp>
12 
13 #include <boost/filesystem/operations.hpp>
14 #include <boost/filesystem/path.hpp>
15 
16 #include <dcmtk/config/osconfig.h>
17 #include <dcmtk/dcmdata/dcdict.h>
18 #include <dcmtk/dcmnet/diutil.h>
19 
20 namespace fwDcmtkTools
21 {
22 
23 //------------------------------------------------------------------------------
24 
26 {
27  // Make sure data dictionary is loaded
28  if (!dcmDataDict.isDictionaryLoaded())
29  {
30  const auto dicoPath = ::fwRuntime::getLibraryResourceFilePath("fwDcmtkTools-" FWDCMTKTOOLS_VER "/dicom.dic");
31  bool loaded = dcmDataDict.wrlock().loadDictionary(dicoPath.string().c_str());
32  dcmDataDict.unlock();
33  SLM_ERROR_IF("Unable to load DICOM dictionary !", loaded);
34  SLM_ASSERT("Unable to load DICOM dictionary !", loaded);
35  SLM_TRACE("DICOM dictionary loaded !");
36  }
37 }
38 
39 } //fwDcmtkTools
static FWDCMTKTOOLS_API void loadDictionary()
Load the DICOM dictionary.
Definition: Dictionary.cpp:25
fwDcmtkTools contains general tools to handle DCMTK library
Definition: Dictionary.hpp:16
#define SLM_ERROR_IF(message, cond)
Definition: spyLog.hpp:276
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
#define SLM_TRACE(message)
Definition: spyLog.hpp:228
This file defines SpyLog macros. These macros are used to log messages to a file or to the console du...