]> Creatis software - gdcm.git/commitdiff
ENH: Now the dictionary is compiled into gdcm lib. This is a default behavior, thus...
authormalaterre <malaterre>
Wed, 3 Nov 2004 18:08:55 +0000 (18:08 +0000)
committermalaterre <malaterre>
Wed, 3 Nov 2004 18:08:55 +0000 (18:08 +0000)
CMakeLists.txt
Dicts/CMakeLists.txt
Dicts/gdcmDefaultDict.h.in [deleted file]
src/CMakeLists.txt
src/gdcmDefaultDicts.cxx.in [new file with mode: 0644]
src/gdcmDicomDirElement.cxx
src/gdcmDicomDirElement.h
src/gdcmDict.cxx
src/gdcmTS.cxx
src/gdcmVR.cxx

index e8d8e3513df12b95c46e88747b62ed9faea16c55..fce4b7ade6ea4fc9f6c8d3889267382bc985f437 100644 (file)
@@ -30,8 +30,8 @@ MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
 #-----------------------------------------------------------------------------
 # Build directory on which many applications depend
 SUBDIRS(
-  src
   Dicts
+  src
 )
 #-----------------------------------------------------------------------------
 # Example subdir:
index 708d663090219fdd98d8133235ff5c1b2edfe7b9..2d63e0b48c497f2574e5e03a98c5d4faf0f7d66e 100644 (file)
@@ -13,41 +13,68 @@ INSTALL_FILES(${GDCM_DATA_DIR} FILES
 # Since CONFIGURE_FILE do a 'copy if different'
 # We have to write the file here since is contains 'DICOM_DICTIONARY'
 # Which is a variable afterward...
-#FILE(WRITE "/tmp/output.h.in" "@DICOM_DICTIONARY@" )
-
-# Following code contributing by Andy Cedilnik
-SET(INFILE "dicomV3.dic")
-
-FILE(READ "${INFILE}" ENT)
 
+# Following code contributing by Andy Cedilnik (Kitware)
+FILE(READ "dicomV3.dic" ENT)
 STRING(REGEX REPLACE "\n" ";" ENT "${ENT}")
-SET(DICOM_DICTIONARY
-  "void FillDefault()\n{"
-)
+SET(DICOM_DATA_DICTIONARY "")
 
 FOREACH(line ${ENT})
   STRING(REGEX REPLACE
-#    "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z]+) (.*)([ \(RET\)]*)$"
-   # FIXME ? is not properly used, just luck
     "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z?]+) (.*)$"
-#    "   { \\1, \\2, \"\\3\" , \"\\4\" , \"\\5\", \"\\6\"}," nline "${line}")
-#    "   { \\1, \\2, \"\\3\" , \"\\4\" , \"\\5\"}," nline "${line}")
-    "  AddNewEntry( DictEntry ( 0x\\1, 0x\\2, \"\\3\" , \"\\4\" , \"\\5\"));" nline "${line}")
-  SET(DICOM_DICTIONARY "${DICOM_DICTIONARY}\n${nline}")
+    "   0x\\1, 0x\\2, \"\\3\" , \"\\4\" , \"\\5\", " nline "${line}")
+  SET(DICOM_DATA_DICTIONARY "${DICOM_DATA_DICTIONARY}\n${nline}")
+ENDFOREACH(line)
+
+SET(DICOM_DATA_DICTIONARY "${DICOM_DATA_DICTIONARY} \n 0,0,0,0,0")
+
+FILE(READ "dicomTS.dic" ENT_TS)
+STRING(REGEX REPLACE "\n" ";" ENT_TS "${ENT_TS}")
+SET(DICOM_TS_DICTIONARY "")
+
+FOREACH(line ${ENT_TS})
+  STRING(REGEX REPLACE
+    "^([0-9.]+) +(.*)$"
+    "  ts[\"\\1\"] = \"\\2\"; " nline "${line}")
+  SET(DICOM_TS_DICTIONARY "${DICOM_TS_DICTIONARY}\n${nline}")
+ENDFOREACH(line)
+
+FILE(READ "dicomVR.dic" ENT_VR)
+STRING(REGEX REPLACE ";" "/" ENT_VR "${ENT_VR}") # CMake doesn't like ';'
+STRING(REGEX REPLACE "\n" ";" ENT_VR "${ENT_VR}")
+SET(DICOM_VR_DICTIONARY "")
+
+FOREACH(line ${ENT_VR})
+  STRING(REGEX REPLACE
+    "^([A-Z][A-Z]) (.*)/ +//.*$"
+    "  vr[\"\\1\"] = \"\\2\"; " nline "${line}")
+  SET(DICOM_VR_DICTIONARY "${DICOM_VR_DICTIONARY}\n${nline}")
 ENDFOREACH(line)
 
-SET(DICOM_DICTIONARY "${DICOM_DICTIONARY} \n }")
+FILE(READ "DicomDir.dic" ENT_DIR)
+STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ENT_DIR "${ENT_DIR}")
+STRING(REGEX REPLACE ";" "/" ENT_DIR "${ENT_DIR}") # CMake doesn't like ';'
+STRING(REGEX REPLACE "\n" ";" ENT_DIR "${ENT_DIR}")
+SET(DICOM_DIR_DICTIONARY "")
+
+FOREACH(line ${ENT_DIR})
+  STRING(REGEX REPLACE
+    "^(metaElem|patientElem|studyElem|serieElem|imageElem) *([a-f0-9]+) ([a-f0-9]+) [\"](.*)[\"](.*)$"
+    "  \"\\1\" , 0x\\2 , 0x\\3 , \"\\4\", \\5" nline "${line}")
+  SET(DICOM_DIR_DICTIONARY "${DICOM_DIR_DICTIONARY}\n${nline}")
+ENDFOREACH(line)
+
+SET(DICOM_DIR_DICTIONARY "${DICOM_DIR_DICTIONARY} \n 0,0,0,0")
 
 # See above
-CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/gdcmDefaultDict.h.in" "${GDCM_BINARY_DIR}/gdcmDefaultDict.h")
+CONFIGURE_FILE("${GDCM_SOURCE_DIR}/src/gdcmDefaultDicts.cxx.in" "${GDCM_BINARY_DIR}/src/gdcmDefaultDicts.cxx" IMMEDIATE)
 
-#MESSAGE("${DICOM_DICTIONARY}")
 
-FILE(READ "dicomV3VM2004.dic" ENT)
-STRING(REGEX REPLACE "\n" ";" ENT "${ENT}")
+FILE(READ "dicomV3VM2004.dic" ENT2)
+STRING(REGEX REPLACE "\n" ";" ENT2 "${ENT2}")
 SET(DICOM_DICTIONARY2 "")
 
-FOREACH(line ${ENT})
+FOREACH(line ${ENT2})
   STRING(REGEX REPLACE
 #    "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z]+) (.*)([ \(RET\)]*)$"
     "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([0-9]|[1]-[0-9n]|[2]-[2][n]|[3]-[3][n]) (.*)$"
@@ -56,5 +83,28 @@ FOREACH(line ${ENT})
   SET(DICOM_DICTIONARY2 "${DICOM_DICTIONARY2}\n${nline}")
 ENDFOREACH(line)
 
-#MESSAGE("${DICOM_DICTIONARY2}")
 
+
+#FILE(READ "04_06PU.txt" ENT3)
+FILE(READ "extract.txt" ENT3)
+
+STRING(REGEX REPLACE "\n" ";" ENT3 "${ENT3}")
+SET(DICOM_DICTIONARY3 "")
+
+FOREACH(line ${ENT3})
+  STRING(REGEX REPLACE
+#    "^[(]([0-9a-fA-F]+),([0-9a-fA-F]+)[)] (.*) ([A-ZA-Z]*) ([[0-3][-][1-3n]*|[1-]*[0-9]+]*) ?([RET|Retired]*)$"
+    "^[(]([0-9a-fA-F]+),([0-9a-fA-F]+)[)]  +(.*)  +([A-ZA-Z   [[0-3][-][1-3n]*|[1-]*[0-9]+]]*)([ RET]*)$"
+    "   { \\1 , \\2, \\3, \\4, \\5  }," nline "${line}")
+  STRING(COMPARE NOTEQUAL "${line}" "${nline}" add)
+  IF(add)
+    #SET(DICOM_DICTIONARY3 "${DICOM_DICTIONARY3}\n${nline}")
+    MESSAGE("${nline}")
+  ELSE(add)
+    MESSAGE("WRONG:${nline}")
+  ENDIF(add)
+ENDFOREACH(line)
+
+
+# Txt generation:
+# ~/Software/xpdf-3.00-linux/pdftotext -f 9 -l 81 -raw -nopgbrk 04_06PU.PDF 04_06PU-3.txt
diff --git a/Dicts/gdcmDefaultDict.h.in b/Dicts/gdcmDefaultDict.h.in
deleted file mode 100644 (file)
index 083dee8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@DICOM_DICTIONARY@
index 55ab9e211f9a9871207ecc018124f4e5e3a2ef92..5cfd632fcdcf20216c7de9a6903bf901fcf64579 100644 (file)
@@ -4,7 +4,7 @@ SUBDIRS(jpeg)
 
 # "jpeglib.h" is defined here:
 INCLUDE_DIRECTORIES(
-  ${GDCM_SOURCE_DIR}/
+  ${GDCM_SOURCE_DIR}/src
   ${GDCM_BINARY_DIR}/ #for gdcmConfigure.h
 )
 
@@ -47,6 +47,7 @@ SET(libgdcm_la_SOURCES
    gdcmUtil.cxx
    gdcmValEntry.cxx   
    gdcmVR.cxx
+   ${GDCM_BINARY_DIR}/src/gdcmDefaultDicts.cxx
    )
 
 ADD_LIBRARY(gdcm ${libgdcm_la_SOURCES} )
diff --git a/src/gdcmDefaultDicts.cxx.in b/src/gdcmDefaultDicts.cxx.in
new file mode 100644 (file)
index 0000000..1b54f0b
--- /dev/null
@@ -0,0 +1,114 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: gdcmDefaultDicts.cxx.in,v $
+  Language:  C++
+  Date:      $Date: 2004/11/03 18:08:56 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*/
+
+#ifndef GDCMDEFAULTDICTS_H
+#define GDCMDEFAULTDICTS_H
+
+#include "gdcmDict.h"
+#include "gdcmDictEntry.h"
+#include "gdcmTS.h"
+#include "gdcmVR.h"
+#include "gdcmDicomDirElement.h"
+
+namespace gdcm
+{
+
+typedef struct
+{
+  uint16_t group;
+  uint16_t element;
+  char *vr;
+  char *fourth;
+  char *name;
+} DICT_ENTRY;
+
+static DICT_ENTRY datadir[] = {
+@DICOM_DATA_DICTIONARY@
+};
+
+void FillDefaultDataDict(Dict *d)
+{
+  unsigned int i = 0;
+  DICT_ENTRY n = datadir[i];
+  while( n.name != 0 )
+    {
+    const DictEntry e( n.group, n.element, n.vr, n.fourth, n.name);
+    d->AddNewEntry( e );
+    n = datadir[++i];
+    }
+}
+
+void FillDefaultTSDict(TSHT & ts)
+{
+@DICOM_TS_DICTIONARY@
+}
+
+void FillDefaultVRDict(VRHT & vr)
+{
+@DICOM_VR_DICTIONARY@
+}
+
+typedef struct
+{
+  char *type;
+  unsigned short group;
+  unsigned short element;
+  char *value;
+} ELEMENT;
+
+static ELEMENT dataelement[] = {
+@DICOM_DIR_DICTIONARY@
+};
+
+void FillDefaultDIRDict(DicomDirElement *dde)
+{
+  unsigned int i = 0;
+  ELEMENT e = dataelement[i];
+  Element elem;
+  while( e.type != 0 )
+    {
+    elem.Group = e.group;
+    elem.Elem  = e.element;
+    elem.Value = e.value;
+    if( strcmp(e.type, "metaElem" ) == 0 )
+      {
+      dde->GetDicomDirMetaElements().push_back(elem);
+      }
+    else if( strcmp(e.type, "patientElem" ) == 0 )
+      {
+      dde->GetDicomDirPatientElements().push_back(elem);
+      }
+    else if( strcmp(e.type, "studyElem" ) == 0 )
+      {
+      dde->GetDicomDirStudyElements().push_back(elem);
+      }
+    else if( strcmp(e.type, "serieElem" ) == 0 )
+      {
+      dde->GetDicomDirSerieElements().push_back(elem);
+      }
+    else if( strcmp(e.type, "imageElem" ) == 0 )
+      {
+      dde->GetDicomDirImageElements().push_back(elem);
+      }
+    e = dataelement[++i];
+    }
+}
+
+} //end gdcm namespace
+#endif
+
index aefcd12d74d9f4d9767e933db051c5e29ac8ca72..65c05e51bb310f54670e428f642a84bc30cd3b7f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/12 04:35:44 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2004/11/03 18:08:56 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 #include <fstream>
 #include <iostream>
+
 namespace gdcm 
 {
-
+void FillDefaultDIRDict(DicomDirElement *dde);
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 
@@ -35,57 +36,51 @@ namespace gdcm
  */
 DicomDirElement::DicomDirElement()
 {
-   std::string filename = DictSet::BuildDictPath() + std::string(DICT_ELEM);
+   std::string filename = DictSet::BuildDictPath() + DICT_ELEM;
    std::ifstream from(filename.c_str());
-   dbg.Error(!from, "DicomDirElement::DicomDirElement: can't open dictionary",
-              filename.c_str());
-
-   char buff[1024];
-   std::string type;
-   Element elem;
-
-   while (!from.eof())
+   if(!from)
    {
-      from >> std::ws;
-      from.getline(buff, 1024, ' ');
-      type = buff;
+      dbg.Verbose(2, 
+         "DicomDirElement::DicomDirElement: can't open dictionary", 
+            filename.c_str());
+      FillDefaultDIRDict( this );
+   }
+   else
+   {
+      char buff[1024];
+      std::string type;
+      Element elem;
 
-      if( (type=="metaElem")  || (type=="patientElem") || 
-          (type=="studyElem") || (type=="serieElem")   || 
-          (type=="imageElem") )
+      while (!from.eof())
       {
-         from >> std::hex >> elem.Group >> elem.Elem;
-
-         from >> std::ws;
-         from.getline(buff, 1024, '"');
          from >> std::ws;
-         from.getline(buff, 1024, '"');
-         elem.Value = buff;
+         from.getline(buff, 1024, ' ');
+         type = buff;
 
-         if( type == "metaElem" )
+         if( (type=="metaElem")  || (type=="patientElem") || 
+             (type=="studyElem") || (type=="serieElem")   || 
+             (type=="imageElem") )
          {
-            DicomDirMetaList.push_back(elem);
+            from >> std::hex >> elem.Group >> elem.Elem;
+
+            from >> std::ws;
+            from.getline(buff, 1024, '"');
+            from >> std::ws;
+            from.getline(buff, 1024, '"');
+            elem.Value = buff;
+         
+            AddNewEntry(type, elem);
          }
-         else if( type == "patientElem" )
+         else
          {
-            DicomDirPatientList.push_back(elem);
-         }
-         else if( type == "studyElem" )
-         {
-            DicomDirStudyList.push_back(elem);
-         }
-         else if( type == "serieElem" )
-         {
-            DicomDirSerieList.push_back(elem);
-         }
-         else if( type == "imageElem" )
-         {
-            DicomDirImageList.push_back(elem);
+            dbg.Error("DicomDirElement::DicomDirElement: Error parsing file",
+                      filename.c_str());
+            dbg.Error("Type", type.c_str(), " is not registered as valid" );
          }
+         from.getline(buff, 1024, '\n');
       }
-      from.getline(buff, 1024, '\n');
-   }
    from.close();
+   }
 }
 
 /**
@@ -157,6 +152,35 @@ void DicomDirElement::Print(std::ostream &os)
 //-----------------------------------------------------------------------------
 // Public
 
+bool DicomDirElement::AddNewEntry(std::string const & type, 
+                                  Element const & elem)
+{
+   if( type == "metaElem" )
+   {
+      DicomDirMetaList.push_back(elem);
+   }
+   else if( type == "patientElem" )
+   {
+      DicomDirPatientList.push_back(elem);
+   }
+   else if( type == "studyElem" )
+   {
+      DicomDirStudyList.push_back(elem);
+   }
+   else if( type == "serieElem" )
+   {
+      DicomDirSerieList.push_back(elem);
+   }
+   else if( type == "imageElem" )
+   {
+      DicomDirImageList.push_back(elem);
+   }
+   else
+   {
+     return false;
+   }
+   return true;
+}
 //-----------------------------------------------------------------------------
 // Protected
 
index 9c739802c3bb0d6b9b21703e3154cc3f7b806ae2..07bf7db38276a9201c6aa0d73d856b2ab396128a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.h,v $
   Language:  C++
-  Date:      $Date: 2004/10/25 04:08:20 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2004/11/03 18:08:56 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -102,6 +102,11 @@ public:
    ListDicomDirImageElem const & GetDicomDirImageElements() const
       { return DicomDirImageList; };
 
+   /**
+    * Public method to add an element
+    */
+   bool AddNewEntry(std::string const & type, Element const & elem);
+
 private:
    /// Elements chained list, related to the MetaElements of DICOMDIR
    ListDicomDirMetaElem    DicomDirMetaList;
index 7155f6ef3621aab04c5e1c0919531d24804c5ce1..051d44dee8bde4c8ed186df9554e2ed0cf0bc2d2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDict.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/28 19:53:28 $
-  Version:   $Revision: 1.50 $
+  Date:      $Date: 2004/11/03 18:08:56 $
+  Version:   $Revision: 1.51 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -26,7 +26,7 @@
 
 namespace gdcm 
 {
-
+void FillDefaultDataDict(Dict *d);
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
@@ -42,25 +42,31 @@ Dict::Dict(std::string const & filename)
    TagName name;
 
    std::ifstream from( filename.c_str() );
-   dbg.Error(!from, "Dict::Dict: can't open dictionary",
-                    filename.c_str());
-
-   while (!from.eof())
+   if( !from )
    {
-      from >> std::hex;
-      from >> group;
-      from >> element;
-      from >> vr;
-      from >> fourth;
-      from >> std::ws;  //remove white space
-      std::getline(from, name);
-
-      DictEntry newEntry(group, element, vr, fourth, name);
-      AddNewEntry(newEntry);
+      dbg.Verbose(2,"Dict::Dict: can't open dictionary", filename.c_str());
+      // Using default embeded one:
+      FillDefaultDataDict( this );
    }
-   from.close();
+   else
+   {
+      while (!from.eof())
+      {
+         from >> std::hex;
+         from >> group;
+         from >> element;
+         from >> vr;
+         from >> fourth;
+         from >> std::ws;  //remove white space
+         std::getline(from, name);
+   
+         const DictEntry newEntry(group, element, vr, fourth, name);
+         AddNewEntry(newEntry);
+      }
+      from.close();
 
-   Filename = filename;
+      Filename = filename;
+   }
 }
 
 /**
index 15645c5f4b8b5bde2e61db8ca065c5999b83fe2f..26c672df9f9107b02e145d1c724742415cd56218 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmTS.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/27 01:32:15 $
-  Version:   $Revision: 1.27 $
+  Date:      $Date: 2004/11/03 18:08:56 $
+  Version:   $Revision: 1.28 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 namespace gdcm 
 {
+void FillDefaultTSDict(TSHT & ts);
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 TS::TS() 
 {
    std::string filename = DictSet::BuildDictPath() + DICT_TS;
    std::ifstream from(filename.c_str());
-   dbg.Error(!from, "TS::TS: can't open dictionary", filename.c_str());
-
-   TSKey key;
-   TSAtr name;
-
-   while (!from.eof())
+   if( !from )
    {
-      from >> key;
-      from >> std::ws;
-      std::getline(from, name);
-
-      if(key != "")
+      dbg.Verbose(2, "TS::TS: can't open dictionary", filename.c_str());
+      FillDefaultTSDict( TsMap );
+   }
+   else
+   {
+      TSKey key;
+      TSAtr name;
+   
+      while (!from.eof())
       {
-         TsMap[key] = name;
+         from >> key;
+         from >> std::ws;
+         std::getline(from, name);
+   
+         if(key != "")
+         {
+            TsMap[key] = name;
+         }
       }
+      from.close();
    }
-   from.close();
 }
 
 //-----------------------------------------------------------------------------
index 17c85d4fefce9290b5d3535a24d89e89f9ccc227..02eb2c893f34d1717cd805b9da998417e85e4a8f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVR.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/27 22:31:12 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2004/11/03 18:08:56 $
+  Version:   $Revision: 1.22 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -26,6 +26,7 @@
 
 namespace gdcm 
 {
+void FillDefaultVRDict(VRHT & vr);
 //-----------------------------------------------------------------------------
 /**
  * \brief Constructor
@@ -34,30 +35,36 @@ VR::VR()
 {
    std::string filename = DictSet::BuildDictPath() + DICT_VR;
    std::ifstream from(filename.c_str());
-   dbg.Error(!from, "VR::VR: can't open dictionary", filename.c_str());
-
-   char buff[1024];
-   VRKey key;
-   VRAtr name;
-
-   while (!from.eof()) 
+   if(!from)
    {
-      from >> std::ws;
-      from.getline(buff, 1024, ' ');
-      key = buff;
-      from >> std::ws;
-      from.getline(buff, 1024, ';');
-      name = buff;
-
-      from >> std::ws;
-      from.getline(buff, 1024, '\n');
-
-      if(key != "")
+      dbg.Verbose(2, "VR::VR: can't open dictionary", filename.c_str());
+      FillDefaultVRDict(vr);
+   }
+   else
+   {
+      char buff[1024];
+      VRKey key;
+      VRAtr name;
+   
+      while (!from.eof()) 
       {
-         vr[key] = name;
+         from >> std::ws;
+         from.getline(buff, 1024, ' ');
+         key = buff;
+         from >> std::ws;
+         from.getline(buff, 1024, ';');
+         name = buff;
+   
+         from >> std::ws;
+         from.getline(buff, 1024, '\n');
+   
+         if(key != "")
+         {
+            vr[key] = name;
+         }
       }
+      from.close();
    }
-   from.close();
 }
 
 //-----------------------------------------------------------------------------