]> Creatis software - gdcm.git/commitdiff
To speed up the parsing process (avoid accessing HTable when useless):
authorjpr <jpr>
Wed, 22 Mar 2006 13:19:25 +0000 (13:19 +0000)
committerjpr <jpr>
Wed, 22 Mar 2006 13:19:25 +0000 (13:19 +0000)
VR and Key are now stored int the DocEntry
DefaultPubDict is stored as well outsite the Htable.

src/gdcmDictSet.cxx
src/gdcmDictSet.h
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocEntrySet.cxx
src/gdcmGlobal.cxx
src/gdcmGlobal.h

index 63c03594624853c48d638dff83d64a0e4e1783ee..891ab75417d383933dea208e483adf9fdb9af9c1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/28 15:20:33 $
-  Version:   $Revision: 1.73 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.74 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -18,6 +18,7 @@
 
 #include "gdcmDictSet.h"
 #include "gdcmDebug.h"
+#include "gdcmGlobal.h"
 #include <fstream>
 #include <stdlib.h>  // For getenv
 #include <stdio.h>   // For sprintf
@@ -37,6 +38,8 @@ DictSet::DictSet()
    std::string pubDictFile(DictPath);
    pubDictFile += PUB_DICT_FILENAME;
    Dicts[PUB_DICT_NAME] = Dict::New(pubDictFile);
+   // Stored redundantly to avoid at access HTable DictSet every time.
+   Global::DefaultPubDict = Dicts[PUB_DICT_NAME];
 }
 
 /**
index f8f0c147fcc118b9bd2d02324b8d5529f1bea9ac..0638e7b7ccc5229910dce3d945444e0f3e0852fd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.h,v $
   Language:  C++
-  Date:      $Date: 2005/11/28 16:31:23 $
-  Version:   $Revision: 1.52 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.53 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -21,6 +21,7 @@
 
 #include "gdcmRefCounter.h"
 #include "gdcmDict.h"
+#include "gdcmGlobal.h"
 
 #include <map>
 #include <list>
@@ -58,8 +59,9 @@ public:
    Dict *GetDict( DictKey const &DictName );
 
    /// \brief   Returns the default reference DICOM V3 public dictionary.
-   Dict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); }
-
+   //Dict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); }
+   Dict* GetDefaultPubDict() { return Global::DefaultPubDict; } 
+   
    // \ brief   Returns the virtual references DICOM dictionary.
    // \ warning : not end user intended
    // Dict *GetVirtualDict() { return &VirtualEntries; }
index 535e3bc99267a3446588b3c8f9db86085c81ffc2..c076fcc0987ca1ecf780525792eddc2b3488da44 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/02/16 20:06:14 $
-  Version:   $Revision: 1.81 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.82 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -48,6 +48,9 @@ DocEntry::DocEntry(DictEntry *in)
 
    gdcmAssertMacro(DicomDict);
    DicomDict->Register();
+
+   VR = in->GetVR();
+   Key = in->GetKey();
 }
 
 /**
index dc09c90a6bc7ce9b7d1c00ad3bba6974afce5fab..b41337035391d7933307273fd0b5cf29d47f1e18 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2006/02/16 20:06:14 $
-  Version:   $Revision: 1.60 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.61 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -48,13 +48,16 @@ public:
    DictEntry * GetDictEntry() { return DicomDict; } 
 
    /// Returns the Dicom Group number of the current Dicom entry
-   const uint16_t &GetGroup() const   { return DicomDict->GetGroup();  }
+   const uint16_t GetGroup() const   { return Key.GetGroup();  }
+   //const uint16_t &GetGroup() const   { return DicomDict->GetGroup();  }
 
    /// Returns the Dicom Element number of the current Dicom entry
-   const uint16_t &GetElement() const { return DicomDict->GetElement();}
+   const uint16_t GetElement() const { return Key.GetElement();}   
+   //const uint16_t &GetElement() const { return DicomDict->GetElement();}
 
    /// Returns the 'key' of the current Dicom entry
-   TagKey GetKey() const { return DicomDict->GetKey(); }
+   TagKey GetKey() const { return Key; }   
+   //TagKey GetKey() const { return DicomDict->GetKey(); }
 
    /// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
    /// Dictionnary of the current Dicom Header Entry
@@ -63,7 +66,8 @@ public:
    /// \brief Returns the 'Value Representation' (e.g. "PN" : Person Name,
    /// "SL" : Signed Long), found in the Dicom header or in the Dicom
    /// Dictionnary, of the current Dicom entry
-   VRKey const &GetVR() const { return DicomDict->GetVR(); }
+   VRKey const &GetVR() const { return VR; }   
+   //VRKey const &GetVR() const { return DicomDict->GetVR(); }
 
    /// \brief Returns the 'Value Multiplicity' (e.g. "1", "6", "1-n", "3-n"),
    /// found in the Dicom entry or in the Dicom Dictionnary
@@ -83,7 +87,7 @@ public:
    void SetReadLength(uint32_t l) { ReadLength = l; }
    /// \brief Returns the 'read length' of the current Dicom entry
    /// \warning this value is the one stored in the Dicom header but not
-   ///          mandatoryly the one thats's used (in case on SQ, or delimiters,
+   ///          mandatoryly the one thats's used (in case of SQ, or delimiters,
    ///          the usable length is set to zero)
    const uint32_t &GetReadLength() const { return ReadLength; }
 
@@ -98,7 +102,8 @@ public:
    uint32_t GetFullLength();
    virtual uint32_t ComputeFullLength() = 0;
 
-// The following 3 members, for internal use only ! 
+// The following members, for internal use only !
+
    /// \brief   Sets the offset of the Dicom entry
    /// \warning use with caution !
    /// @param   of offset to be set
@@ -107,6 +112,16 @@ public:
    /// Sets to TRUE the ImplicitVr flag of the current Dicom entry
    void SetImplicitVR() { ImplicitVR = true; }
  
+    /// Sets the 'Value Representation' of the current Dicom entry
+   /// @param   vr VR to be set    
+   void SetVR( VRKey const &vr) { VR = vr; } 
+
+    /// Sets the 'Value Representation' of the current Dicom entry
+   /// @param   key TagKey to be set
+   void SetTag( TagKey const &key) { Key = key; } 
+  
+// -----------end of members to be used with caution
+   
    /// \brief Tells us if the current Dicom entry was checked as ImplicitVr
    /// @return true if the current Dicom entry was checked as ImplicitVr
    bool IsImplicitVR() const { return ImplicitVR; }
@@ -131,8 +146,8 @@ protected:
 
    /// \brief pointer to the underlying Dicom dictionary element
    DictEntry *DicomDict;
-   
-   /// \brief Correspond to the real length of the data
+      
+   /// \brief Corresponds to the real length of the data
    /// This length might always be even
    uint32_t Length; 
   
@@ -147,7 +162,14 @@ protected:
    /// Offset from the beginning of file for direct user access
    size_t Offset; 
 
+   /// \brief Value Representation (to avoid accessing Dicom Dict every time!)
+   VRKey VR; // JPRx
+      
+   /// \brief Dicom \ref TagKey. Contains Dicom Group number and Dicom Element number
+   ///        (to avoid accessing Dicom Dict every time !) // JPRx
+   TagKey Key; // JPRx
 private:
+
 };
 } // end namespace gdcm
 //-----------------------------------------------------------------------------
index 18e713d8207fe0e74c59150950899005b4f42e18..7be85dff36dd317cc05cb37a282d7ef5326daf29 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/02/16 20:06:14 $
-  Version:   $Revision: 1.70 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.71 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -442,7 +442,7 @@ SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem)
       gdcmWarningMacro( "Failed to allocate SeqEntry for ("
          <<std::hex << group << "|" << elem <<")" );
       return 0;
-   }
+   }     
    return newEntry;
 }
 
@@ -461,6 +461,8 @@ SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem)
 DictEntry *DocEntrySet::GetDictEntry(uint16_t group,uint16_t elem) 
 {
    DictEntry *found = 0;
+   /// \todo store the DefaultPubDict somwhere, in order not to access the HTable
+   ///       every time !
    Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
    if (!pubDict) 
    {
@@ -478,7 +480,7 @@ DictEntry *DocEntrySet::GetDictEntry(uint16_t group,uint16_t elem)
 /**
  * \brief   Searches [both] the public [and the shadow dictionary (when they
  *          exist)] for the presence of the DictEntry with given
- *          group and element, and create a new virtual DictEntry if necessary
+ *          group and element, and creates a new virtual DictEntry if necessary
  * @param   group  group number of the searched DictEntry
  * @param   elem element number of the searched DictEntry
  * @param   vr V(alue) R(epresentation) to use, if necessary 
index ad98da2c862a37e843e03293cb57b92636705c9d..2bed919593c4f51fc22af85e8e57dec5d61e897d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmGlobal.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/11 10:44:24 $
-  Version:   $Revision: 1.31 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.32 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -58,6 +58,8 @@ TS              *Global::TranSyn   = (TS *)0;
 DictGroupName   *Global::GroupName = (DictGroupName *)0;
 DicomDirElement *Global::ddElem    = (DicomDirElement *)0;
 
+Dict            *Global::DefaultPubDict = (Dict *)0;
+
 //-----------------------------------------------------------------------------
 /**
  * \brief   Global container
index 4a68c6397a5656ba9a6e820222540bdcb558da9a..adffda9c4983bcbaebc3e0c687bcad1f2f975a97 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmGlobal.h,v $
   Language:  C++
-  Date:      $Date: 2005/11/30 10:58:28 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2006/03/22 13:19:25 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -36,6 +36,8 @@ class DicomDirElement;
 class Dict;
 class GDCM_EXPORT Global
 {
+friend class DictSet; // to allow setting DefaultPubDict without 
+                      // providing any body an accesor !
 public:
    Global();
    ~Global();
@@ -65,6 +67,9 @@ private:
    /// \brief Pointer to the hash table containing the Dicom Elements necessary 
    ///        to describe each part of a DICOMDIR 
    static DicomDirElement *ddElem;
+   /// pointer to the Default Public Dictionnary, redundantly store here, 
+   /// in order not to acces the HTable every time!
+   static Dict *DefaultPubDict; 
 };
 } // end namespace gdcm