]> Creatis software - gdcm.git/commitdiff
* Correctly use the VRKey for all vr variables... instead of TagName
authorregrain <regrain>
Tue, 18 Oct 2005 12:58:23 +0000 (12:58 +0000)
committerregrain <regrain>
Tue, 18 Oct 2005 12:58:23 +0000 (12:58 +0000)
     or std::string
   * Replace the definition of VRKey from std::string to a class
     containing a char[2]. All methods are inline to have no speed low
   * Create the GDCM_VRUNKNOWN = "  " for the VR values
   -- BeNours

24 files changed:
ChangeLog
Example/exReadWriteFile.cxx
Testing/TestVR.cxx
gdcmPython/gdcm.i
src/gdcmCommon.h
src/gdcmDebug.h
src/gdcmDict.cxx
src/gdcmDictEntry.cxx
src/gdcmDictEntry.h
src/gdcmDictSet.cxx
src/gdcmDictSet.h
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocEntrySet.cxx
src/gdcmDocEntrySet.h
src/gdcmDocument.cxx
src/gdcmDocument.h
src/gdcmFile.cxx
src/gdcmFileHelper.cxx
src/gdcmFileHelper.h
src/gdcmGlobal.cxx
src/gdcmSystem.h
src/gdcmVR.h
src/gdcmVRKey.h [new file with mode: 0644]

index b8fb98f3a19c33aebaeb426b68e8158b2e9d4136..95344efeb0fc99227ab42c01cc42d874a142bbeb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Oct 18 10:27:49 2005 by regrain
+   * Correctly use the VRKey for all vr variables... instead of TagName 
+     or std::string
+   * Replace the definition of VRKey from std::string to a class 
+     containing a char[2]. All methods are inline to have no speed low
+   * Create the GDCM_VRUNKNOWN = "  " for the VR values
+   
 Mon Oct 18 10:27:49 2005 by regrain
    * Remove useless constructor of gdcm::Document
    * Remove useless parameter in the constructor of gdcm::ElementSet
index 3666c6eefed4d46d50ab290c85d1efc3eefa03b0..37f5b6e2f94e057fa4b0f7b2464168f7cf1547ac 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exReadWriteFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:44 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/10/18 12:58:24 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -81,7 +81,7 @@ std::cout << " --- WARNING --- WARNING --- WARNING --- WARNING ---" <<std::endl;
 
    gdcm::DataEntry *dataEntry;
    std::string value;
-   std::string vr;   // value representation
+   gdcm::VRKey vr;   // value representation
    std::string vm;   // value multiplicity
    std::string name; // held in the Dicom Dictionary
 
index 36710c63685b81c70ea15c84e227f1b1330b577a..729157a64ebaeb975260d0b7417ece0e6c70594e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestVR.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/02 10:05:26 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/10/18 12:58:25 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 int TestVR(int , char *[])
 {
-   gdcm::VR *tempVrDict=0;
-   std::cout << "------ Test Default VR Dictionary : ----------" << std::endl;
-  // Just to improve test coverage:
-  // tempVrDict = new gdcm::Dict("dummyFileNameThatDoesntExist");
-  // tempVrDict->Print();
-  // std::cout << "----- end Test Default VR Dictionary : -----" << std::endl;
-
-   // Lets delete it.
-   delete tempVrDict;
-
+   int error = 0;
    gdcm::VR *vr = new gdcm::VR();
  
    // There should be 16 entries ...
    vr->Print( std::cout );
 
-   vr->IsVROfStringRepresentable( "PN" );
-   vr->IsVROfStringRepresentable( "FD" );
+   // Valid VR
+   if( !vr->IsValidVR( "PN" ) )
+   {
+      std::cerr << "'PN' is not a valid VR" << std::endl;
+      error++;
+   }
+   if( !vr->IsValidVR( "FD" ) )
+   {
+      std::cerr << "'FD' is not a valid VR" << std::endl;
+      error++;
+   }
+   if( vr->IsValidVR( "" ) )
+   {
+      std::cerr << "'' is a valid VR" << std::endl;
+      error++;
+   }
+   if( vr->IsValidVR( "  " ) )
+   {
+      std::cerr << "'  ' is a valid VR" << std::endl;
+      error++;
+   }
+   if( vr->IsValidVR( gdcm::GDCM_VRUNKNOWN ) )
+   {
+      std::cerr << "'  ' is a valid VR" << std::endl;
+      error++;
+   }
+
+   // String representable
+   if( !vr->IsVROfStringRepresentable( "PN" ) )
+   {
+      std::cerr << "'PN' is not a string representable" << std::endl;
+      error++;
+   }
+   if( vr->IsVROfStringRepresentable( "FD" ) )
+   {
+      std::cerr << "'FD' is a string representable" << std::endl;
+      error++;
+   }
+
+   // Binary representable
+   if( !vr->IsVROfBinaryRepresentable( "FD" ) )
+   {
+      std::cerr << "FD is not a binary representable" << std::endl;
+      error++;
+   }
+   if( vr->IsVROfBinaryRepresentable( "PN" ) )
+   {
+      std::cerr << "'PN' is a binary representable" << std::endl;
+      error++;
+   }
 
-   vr->IsVROfBinaryRepresentable( "FD" );
-   vr->IsVROfBinaryRepresentable( "PN" );
+   // Sequence
+   if( vr->IsVROfSequence( "" ) )
+   {
+      std::cerr << "'' is a sequence" << std::endl;
+      error++;
+   }
+   if( !vr->IsVROfSequence( "SQ" ) )
+   {
+      std::cerr << "'SQ' is not a sequence" << std::endl;
+      error++;
+   }
 
-   vr->IsVROfSequence( "" );
-   vr->IsVROfSequence( "SQ" );
    delete vr;
-   return 0;
+   return error;
 }
index 303719e01dfb51d8798e0e1b91337bd24a546f0e..817e7c6c485f033f1dddb9c9e17ff0349f4acde2 100644 (file)
@@ -216,14 +216,17 @@ typedef unsigned long long uint64_t;
 %ignore GDCM_NOTASCII;
 %ignore GDCM_PIXELDATA;
 %ignore GDCM_LEGACY;
+%ignore GDCM_VRUNKNOWN;
 
-%constant const char *UNKNOWN       = "gdcm::Unknown";
-%constant const char *UNFOUND       = "gdcm::Unfound";
-%constant const char *BINLOADED     = "gdcm::Binary data loaded";
-%constant const char *NOTLOADED     = "gdcm::NotLoaded";
-%constant const char *UNREAD        = "gdcm::UnRead";
-%constant const char *GDCM_NOTASCII = "gdcm::NotAscii";
+%constant const char *UNKNOWN        = "gdcm::Unknown";
+%constant const char *UNFOUND        = "gdcm::Unfound";
+%constant const char *BINLOADED      = "gdcm::Binary data loaded";
+%constant const char *NOTLOADED      = "gdcm::NotLoaded";
+%constant const char *UNREAD         = "gdcm::UnRead";
+%constant const char *GDCM_NOTASCII  = "gdcm::NotAscii";
 %constant const char *GDCM_PIXELDATA = "gdcm::Pixel Data to be loaded";
+%constant const char *VRUNKNOWN      = "  ";
+
 ////////////////////////////////////////////////////////////////////////////
 // Warning: Order matters !
 %include "gdcmCommon.h"
index 27c4e90a3c5aba8f991457b49fdc185ae67cfe6f..b6fdd0bf9ceeb0884637acde04920ece476ac75c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmCommon.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 09:17:08 $
-  Version:   $Revision: 1.94 $
+  Date:      $Date: 2005/10/18 12:58:27 $
+  Version:   $Revision: 1.95 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmConfigure.h"
 #include "gdcmSystem.h"
 
+#define FASTTAGKEY 0
+
+// FIXME: Should rewrite this:
+#if FASTTAGKEY
+   #include <iostream>
+   #include <iomanip>
+#endif
+   #if defined(_MSC_VER) && (_MSC_VER == 1200)
+   /* ostream operator for std::string since VS6 does not provide it*/
+      #include <iostream>
+#endif
+
 //-----------------------------------------------------------------------------
 /// \brief namespace for Grass root DiCoM
 namespace gdcm
@@ -45,6 +57,9 @@ GDCM_EXPORT extern const std::string GDCM_NOTLOADED;
 GDCM_EXPORT extern const std::string GDCM_UNREAD;
 GDCM_EXPORT extern const std::string GDCM_NOTASCII;
 GDCM_EXPORT extern const std::string GDCM_PIXELDATA;
+
+GDCM_EXPORT extern const std::string GDCM_VRUNKNOWN;
+
 /// \brief TagKey is made to hold the standard Dicom Tag 
 ///               (Group number, Element number)
 /// Instead of using the two '16 bits integers' as the Hask Table key, we
@@ -61,25 +76,25 @@ typedef union   {
 /* ostream operator for TagKey */
 inline std::ostream& operator<<(std::ostream& _O, TagKey _val)
 {
-  _O.setf( std::ios::right);
-  return (_O << std::hex << std::setw( 4 ) << std::setfill( '0' )
-     << _val.tab[0] << '|' << std::setw( 4 ) << std::setfill( '0' )
-     << _val.tab[1] << std::setfill( ' ' ) << std::dec);
+   _O.setf( std::ios::right);
+   return (_O << std::hex << std::setw( 4 ) << std::setfill( '0' )
+      << _val.tab[0] << '|' << std::setw( 4 ) << std::setfill( '0' )
+      << _val.tab[1] << std::setfill( ' ' ) << std::dec);
 }
 inline bool operator==(TagKey _self, TagKey _val)
 {
-  return _self.tagkey == _val.tagkey;
+   return _self.tagkey == _val.tagkey;
 }
 inline bool operator<(TagKey _self, TagKey _val)
 {
-  // This expression is a tad faster but PrintFile output
-  // is more difficult to read
-  //return _self.tagkey < _val.tagkey;
-
-  // More usal order of dicom tags:
-  if( _self.tab[0] == _val.tab[0] )
-    return _self.tab[1] < _val.tab[1];
-  return _self.tab[0] < _val.tab[0];
+   // This expression is a tad faster but PrintFile output
+   // is more difficult to read
+   //return _self.tagkey < _val.tagkey;
+
+   // More usal order of dicom tags:
+   if( _self.tab[0] == _val.tab[0] )
+      return _self.tab[1] < _val.tab[1];
+   return _self.tab[0] < _val.tab[0];
 }
 #else
 typedef std::string TagKey;
index c7f7d65f6cda9230b9b20370108f69610129aa77..d3144f6a685cc931b55c9dcf0a72fe059b0aa811 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDebug.h,v $
   Language:  C++
-  Date:      $Date: 2005/09/02 07:10:03 $
-  Version:   $Revision: 1.42 $
+  Date:      $Date: 2005/10/18 12:58:27 $
+  Version:   $Revision: 1.43 $
                                                                                 
   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 "gdcmCommon.h"
 
+#include <iostream>
 #include <sstream>
 #include <fstream>
 #include <assert.h>
index 5744e79040aebb373879a1700c87bd1ee808de1b..321f168a5de35e8a33e553d43d6070853264977d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDict.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/09/02 07:00:04 $
-  Version:   $Revision: 1.79 $
+  Date:      $Date: 2005/10/18 12:58:27 $
+  Version:   $Revision: 1.80 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -279,7 +279,7 @@ void Dict::DoTheLoadingJob(std::ifstream &from)
 {
    uint16_t group;
    uint16_t elem;
-   TagName vr;
+   VRKey vr;
    TagName vm;
    TagName name;
 
@@ -293,7 +293,7 @@ void Dict::DoTheLoadingJob(std::ifstream &from)
       from >> std::ws;  //remove white space
       std::getline(from, name);
  
-      const DictEntry newEntry(group, elem, vr, vm, name);
+      DictEntry newEntry(group, elem, vr, vm, name);
       AddEntry(newEntry);
    }
    from.close();
index 3e88c55f0a4f9728c6c8e7831abe734b7f4e18b3..ed1052af3d9bd019dfb0f02ab742bd4bc3c34c78 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/11 15:20:46 $
-  Version:   $Revision: 1.51 $
+  Date:      $Date: 2005/10/18 12:58:27 $
+  Version:   $Revision: 1.52 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -38,7 +38,7 @@ namespace gdcm
 */
 
 DictEntry::DictEntry(uint16_t group, uint16_t elem,
-                     TagName const &vr, 
+                     VRKey const &vr, 
                      TagName const &vm,
                      TagName const &name)
 {
@@ -57,7 +57,7 @@ DictEntry::DictEntry(uint16_t group, uint16_t elem,
  * \            is unset then overwrite it.
  * @param vr    New V(alue) R(epresentation) to be set.
  */
-void DictEntry::SetVR(TagName const &vr) 
+void DictEntry::SetVR(VRKey const &vr) 
 {
    if ( IsVRUnknown() )
    {
@@ -127,11 +127,11 @@ TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t elem)
  */
 void DictEntry::Print(std::ostream &os, std::string const & )
 {
-   std::string vr;
+   VRKey vr;
    std::ostringstream s;
 
    vr = GetVR();
-   if ( vr==GDCM_UNKNOWN )
+   if ( IsVRUnknown() )
       vr="  ";
 
    s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 
index 11425127fc975c1c73f8a164469f152358891d3b..2b651f2b6dfc41a781c9caaa97e16e8f2777b56c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:49 $
-  Version:   $Revision: 1.36 $
+  Date:      $Date: 2005/10/18 12:58:27 $
+  Version:   $Revision: 1.37 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #define GDCMDICTENTRY_H
 
 #include "gdcmBase.h"
+#include "gdcmVRKey.h"
 
 namespace gdcm 
 {
-
 //-----------------------------------------------------------------------------
 /**
  * \brief
@@ -41,7 +41,7 @@ class GDCM_EXPORT DictEntry : public Base
 public:
    DictEntry(uint16_t group, 
              uint16_t elem,
-             TagName const &vr     = GDCM_UNKNOWN,
+             VRKey const &vr       = GDCM_VRUNKNOWN,
              TagName const &vm     = GDCM_UNKNOWN,
              TagName const &name   = GDCM_UNKNOWN);
 
@@ -49,12 +49,12 @@ public:
    void Print(std::ostream &os = std::cout, std::string const &indent = "");
 
 // Content of DictEntry
-   void SetVR(TagName const &vr);
+   void SetVR(VRKey const &vr);
    void SetVM(TagName const &vm);
 
    /// \brief tells if the V(alue) R(epresentation) is known (?!)
    /// @return 
-   bool IsVRUnknown() const { return VR == GDCM_UNKNOWN; }
+   bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
 
    /// \brief tells if the V(alue) M(ultiplicity) is known (?!)
    /// @return 
@@ -71,7 +71,7 @@ public:
    /// \brief  Returns the Dicom Value Representation of the current
    ///         DictEntry
    /// @return the Dicom Value Representation
-   const TagName &GetVR() const { return VR; }
+   const VRKey &GetVR() const { return VR; }
  
    /// \brief   sets the key of the current DictEntry
    /// @param k New key to be set.
@@ -112,7 +112,7 @@ private:
    ///        of the data represented e.g. 
    ///        "FD" short for "Floating Point Double"(see \ref VR)
    ///        "PN" short for "Person Name"       
-   TagName VR;
+   VRKey VR;
 
    /*
     *  .
index ecef7934c3d3988d3e096d8da821c8af10f22017..ec3301a4c573b873f3d3b15168e2dca32b3e7fe5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/11 20:44:52 $
-  Version:   $Revision: 1.68 $
+  Date:      $Date: 2005/10/18 12:58:27 $
+  Version:   $Revision: 1.69 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -106,9 +106,9 @@ Dict *DictSet::GetDict(DictKey const &dictName)
  */
 DictEntry *DictSet::NewVirtualDictEntry( uint16_t group,
                                          uint16_t elem,
-                                         TagName vr,
-                                         TagName vm,
-                                         TagName name)
+                                         const VRKey &vr,
+                                         const TagName &vm,
+                                         const TagName &name)
 {
    DictEntry *entry;
 
@@ -125,9 +125,9 @@ DictEntry *DictSet::NewVirtualDictEntry( uint16_t group,
    char res[10];
    sprintf(res,"%04x|%04x", group, elem);
    ExtendedTagKey tag = res;
-   tag += "#" + vr + "#" + vm + "#" + name;  
+   tag += "#" + vr.str() + "#" + vm + "#" + name;  
 #endif
-  
+
    ExtendedTagKeyHT::iterator it;
    
    it = VirtualEntries.find(tag);
index 3cc5eca7ed2c192b22f792b25304fa47b89210d3..c05e1b5c7a31d4de53a14029f7d03eb8ed43df5f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.h,v $
   Language:  C++
-  Date:      $Date: 2005/09/02 07:10:03 $
-  Version:   $Revision: 1.45 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.46 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -64,9 +64,9 @@ public:
    // Dict *GetVirtualDict() { return &VirtualEntries; }
 
    DictEntry *NewVirtualDictEntry(uint16_t group, uint16_t elem,
-                                  TagName vr     = GDCM_UNKNOWN,
-                                  TagName vm     = GDCM_UNKNOWN,
-                                  TagName name   = GDCM_UNKNOWN);
+                                  const VRKey &vr     = GDCM_VRUNKNOWN,
+                                  const TagName &vm   = GDCM_UNKNOWN,
+                                  const TagName &name = GDCM_UNKNOWN);
 
    Dict *GetFirstEntry();
    Dict *GetNextEntry();
index 729fe8cccece0a618d5ace6c15bb1f5aa54095e1..8c117fb0a714cd921c2392d95bef24df95d96ea7 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:49 $
-  Version:   $Revision: 1.70 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  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
@@ -97,9 +97,9 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype)
       uint16_t zero = 0;
       uint16_t shortLgr = (uint16_t)lgth;
 
-      if (vr == GDCM_UNKNOWN)
+      if( IsVRUnknown() )
       {
-         // GDCM_UNKNOWN was stored in the Entry VR;
+         // GDCM_VRUNKNOWN was stored in the Entry VR;
          // deal with Entry as if TS were Implicit VR
  
          // FIXME : troubles expected on big endian processors :
@@ -113,8 +113,7 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype)
       }
       else
       {
-         binary_write(*fp, vr);
-         gdcmAssertMacro( vr.size() == 2 );
+         binary_write(*fp, vr.str());
                   
          if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") /*|| (vr == "UN")*/ )
          {
@@ -232,13 +231,14 @@ void DocEntry::Print(std::ostream &os, std::string const & )
    size_t o;
    std::string st;
    TSKey v;
-   std::string d2, vr;
+   std::string d2;
+   VRKey vr;
    std::ostringstream s;
    uint32_t lgth;
 
    o  = GetOffset();
    vr = GetVR();
-   if ( vr==GDCM_UNKNOWN )
+   if ( vr == GDCM_VRUNKNOWN )
       vr="  ";
 
    s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 
index d7fecfc3418fcdc6c53b7007893c346b04cbe9e3..2310a70bd3f36eeb7f07341ac264a2cf8f92b3bd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:49 $
-  Version:   $Revision: 1.50 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  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
@@ -68,7 +68,7 @@ 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
-   std::string const &GetVR() const { return DicomDict->GetVR(); }
+   VRKey const &GetVR() const { return DicomDict->GetVR(); }
 
    /// \brief Returns the 'Value Multiplicity' (e.g. "1", "1-n", "6"),
    /// found in the Dicom entry or in the Dicom Dictionnary
index 8aa7966340a6fc8fb59629814f617f7379f56656..0b4ff26d8456da0553535c17bd24f7cd6a48ce11 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:49 $
-  Version:   $Revision: 1.60 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  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
@@ -125,27 +125,6 @@ int DocEntrySet::GetEntryLength(uint16_t group, uint16_t elem)
    return -1;
 }
 
-/**
- * \brief   Searches within Header Entries (Dicom Elements) parsed with 
- *          the public [and private dictionaries] 
- *          for the element value representation of a given tag..
- *          Obtaining the VR (Value Representation) might be needed by caller
- *          to convert the string typed content to caller's native type 
- *          (think of C++ vs Python). The VR is actually of a higher level
- *          of semantics than just the native C++ type.
- * @param   group  Group number of the searched tag.
- * @param   elem Element number of the searched tag.
- * @return  Corresponding element value representation when it exists,
- *          and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
- */
-std::string DocEntrySet::GetEntryVR(uint16_t group, uint16_t elem)
-{
-   DocEntry *entry = GetDocEntry(group, elem);
-   if ( entry )
-      return entry->GetVR();
-   return GDCM_UNFOUND;
-}
-
 /**
  * \brief  Same as \ref Document::GetDocEntry except it only
  *         returns a result when the corresponding entry is of type
@@ -274,7 +253,7 @@ bool DocEntrySet::SetEntryBinArea(uint8_t *content, int lgth, DataEntry *entry)
  */ 
 DataEntry *DocEntrySet::InsertEntryString(std::string const &value, 
                                              uint16_t group, uint16_t elem,
-                                             TagName const &vr )
+                                             VRKey const &vr )
 {
    DataEntry *dataEntry = 0;
    DocEntry *currentEntry = GetDocEntry( group, elem );
@@ -332,7 +311,7 @@ DataEntry *DocEntrySet::InsertEntryString(std::string const &value,
  */
 DataEntry *DocEntrySet::InsertEntryBinArea(uint8_t *binArea, int lgth, 
                                               uint16_t group, uint16_t elem,
-                                              TagName const &vr )
+                                              VRKey const &vr )
 {
    DataEntry *dataEntry = 0;
    DocEntry *currentEntry = GetDocEntry( group, elem );
@@ -466,7 +445,7 @@ bool DocEntrySet::CheckIfEntryExist(uint16_t group, uint16_t elem )
  * @param   vr    V(alue) R(epresentation) of the new Entry 
  */
 DataEntry *DocEntrySet::NewDataEntry(uint16_t group,uint16_t elem,
-                                   TagName const &vr) 
+                                     VRKey const &vr) 
 {
    DictEntry *dictEntry = GetDictEntry(group, elem, vr);
    gdcmAssertMacro(dictEntry);
@@ -510,7 +489,7 @@ SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem)
  * @param   name   english name
  */
 DictEntry* DocEntrySet::NewVirtualDictEntry( uint16_t group, uint16_t elem,
-                                             TagName const &vr,
+                                             VRKey const &vr,
                                              TagName const &vm,
                                              TagName const &name )
 {
@@ -553,18 +532,18 @@ DictEntry *DocEntrySet::GetDictEntry(uint16_t group,uint16_t elem)
  * @return  Corresponding DictEntry when it exists, NULL otherwise.
  */
 DictEntry *DocEntrySet::GetDictEntry(uint16_t group, uint16_t elem,
-                                     TagName const &vr)
+                                     VRKey const &vr)
 {
    DictEntry *dictEntry = GetDictEntry(group,elem);
    DictEntry *goodEntry = dictEntry;
-   std::string goodVR = vr;
+   VRKey goodVR = vr;
 
    if (elem == 0x0000) goodVR="UL";
 
    if ( goodEntry )
    {
       if ( goodVR != goodEntry->GetVR()
-        && goodVR != GDCM_UNKNOWN )
+        && goodVR != GDCM_VRUNKNOWN )
       {
          goodEntry = NULL;
       }
index 4502a78aff91d1ca7d353d9753f9de7e314ce6c6..99ce356a693b5fb1428c5b267d68466c2c9b64e0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:49 $
-  Version:   $Revision: 1.57 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.58 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -20,6 +20,8 @@
 #define GDCMDOCENTRYSET_H
 
 #include "gdcmBase.h"
+#include "gdcmVRKey.h"
+
 #include <fstream>
 
 namespace gdcm 
@@ -82,7 +84,6 @@ public:
    virtual std::string GetEntryString(uint16_t group, uint16_t elem);
    virtual void *GetEntryBinArea(uint16_t group, uint16_t elem);
    virtual int GetEntryLength(uint16_t group, uint16_t elem);
-   virtual std::string GetEntryVR(uint16_t group, uint16_t elem);
    virtual std::string GetEntryForcedAsciiValue(uint16_t group, uint16_t elem);
 
    /// \brief Gets any type of DocEntry, identified by its (group,elem)
@@ -101,10 +102,10 @@ public:
 
    DataEntry *InsertEntryString(std::string const &value,
                                    uint16_t group, uint16_t elem,
-                                   TagName const &vr = GDCM_UNKNOWN);
+                                   VRKey const &vr = GDCM_VRUNKNOWN);
    DataEntry *InsertEntryBinArea(uint8_t *binArea, int lgth,
                                     uint16_t group, uint16_t elem,
-                                    TagName const &vr = GDCM_UNKNOWN);
+                                    VRKey const &vr = GDCM_VRUNKNOWN);
    SeqEntry *InsertSeqEntry(uint16_t group, uint16_t elem);
    /// tells us if the set contains no entry
    virtual bool IsEmpty() = 0;
@@ -112,12 +113,12 @@ public:
 
 // DocEntry  related utilities 
    DataEntry *NewDataEntry(uint16_t group,uint16_t elem,
-                         TagName const &vr = GDCM_UNKNOWN);
+                         VRKey const &vr = GDCM_VRUNKNOWN);
    SeqEntry *NewSeqEntry(uint16_t group, uint16_t elem);
 
 // DictEntry  related utilities 
    DictEntry *NewVirtualDictEntry(uint16_t group,uint16_t elem,
-                                  TagName const &vr     = GDCM_UNKNOWN,
+                                  VRKey const &vr     = GDCM_VRUNKNOWN,
                                   TagName const &vm     = GDCM_UNKNOWN,
                                   TagName const &name   = GDCM_UNKNOWN );
 
@@ -125,7 +126,7 @@ protected:
 // DictEntry  related utilities
    DictEntry *GetDictEntry(uint16_t group, uint16_t elem);
    DictEntry *GetDictEntry(uint16_t group, uint16_t elem,
-                           TagName const &vr);
+                           VRKey const &vr);
    /// To be able to backtrack (Private Sequence, Implicit VR related pb)
    DocEntry *PreviousDocEntry;
 
index 94de7cae21bbd26f098d29e818042818650268c4..d9d70e0b71db8e31a8c398e1457f86ec12a11bfd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 11:35:31 $
-  Version:   $Revision: 1.293 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.294 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -875,7 +875,7 @@ void Document::SkipBytes(uint32_t nBytes)
 int Document::ComputeGroup0002Length( ) 
 {
    uint16_t gr;
-   std::string vr;
+   VRKey vr;
    
    int groupLength = 0;
    bool found0002 = false;   
@@ -1275,7 +1275,7 @@ void Document::LoadDocEntry(DocEntry *entry, bool forceLoad)
 {
    uint16_t group  = entry->GetGroup();
    uint16_t elem  = entry->GetElement();
-   std::string  vr = entry->GetVR();
+   const VRKey  &vr = entry->GetVR();
    uint32_t length = entry->GetLength();
 
    Fp->seekg((long)entry->GetOffset(), std::ios::beg);
@@ -1337,7 +1337,7 @@ void Document::LoadDocEntry(DocEntry *entry, bool forceLoad)
 void Document::FindDocEntryLength( DocEntry *entry )
    throw ( FormatError )
 {
-   std::string  vr  = entry->GetVR();
+   const VRKey &vr  = entry->GetVR();
    uint16_t length16;       
    
    if ( Filetype == ExplicitVR && !entry->IsImplicitVR() ) 
@@ -1478,10 +1478,10 @@ uint32_t Document::FindDocEntryLengthOBOrOW()
  * \brief     Find the Value Representation of the current Dicom Element.
  * @return    Value Representation of the current Entry
  */
-std::string Document::FindDocEntryVR()
+VRKey Document::FindDocEntryVR()
 {
    if ( Filetype != ExplicitVR )
-      return GDCM_UNKNOWN;
+      return GDCM_VRUNKNOWN;
 
    long positionOnEntry = Fp->tellg();
    // Warning: we believe this is explicit VR (Value Representation) because
@@ -1492,14 +1492,16 @@ std::string Document::FindDocEntryVR()
    // is in explicit VR and try to fix things if it happens not to be
    // the case.
 
-   char vr[3];
-   Fp->read (vr, (size_t)2);
-   vr[2] = 0;
+   VRKey vr;
+   Fp->read(&(vr[0]),(size_t)2);
 
+   gdcmWarningMacro( "--> VR: " << vr )
    if ( !CheckDocEntryVR(vr) )
    {
+      Global::GetVR()->Print(std::cerr);
+      gdcmWarningMacro( "Unknown VR '" << vr << "'" )
       Fp->seekg(positionOnEntry, std::ios::beg);
-      return GDCM_UNKNOWN;
+      return GDCM_VRUNKNOWN;
    }
    return vr;
 }
@@ -1512,12 +1514,9 @@ std::string Document::FindDocEntryVR()
  * @return    false if the VR is incorrect or if the VR isn't referenced
  *            otherwise, it returns true
 */
-bool Document::CheckDocEntryVR(VRKey vr)
+bool Document::CheckDocEntryVR(const VRKey &vr)
 {
-   if ( !Global::GetVR()->IsValidVR(vr) )
-      return false;
-
-   return true; 
+   return Global::GetVR()->IsValidVR(vr);
 }
 
 /**
@@ -1634,7 +1633,7 @@ bool Document::IsDocEntryAnInteger(DocEntry *entry)
 {
    uint16_t elem         = entry->GetElement();
    uint16_t group        = entry->GetGroup();
-   const std::string &vr = entry->GetVR();
+   const VRKey &vr = entry->GetVR();
    uint32_t length       = entry->GetLength();
 
    // When we have some semantics on the element we just read, and if we
@@ -1950,10 +1949,11 @@ DocEntry *Document::ReadNextDocEntry()
    if ( HasDCMPreamble )
       HandleOutOfGroup0002(group, elem);
  
-   std::string vr = FindDocEntryVR();
-   std::string realVR = vr;
+   VRKey vr = FindDocEntryVR();
+   
+   VRKey realVR = vr;
 
-   if ( vr == GDCM_UNKNOWN )
+   if ( vr == GDCM_VRUNKNOWN )
    {
       if ( elem == 0x0000 ) // Group Length
       {
@@ -1974,6 +1974,7 @@ DocEntry *Document::ReadNextDocEntry()
          }
       }
    }
+   gdcmWarningMacro( "Found VR: " << vr << " / Real VR: " << realVR );
 
    DocEntry *newEntry;
    if ( Global::GetVR()->IsVROfSequence(realVR) )
@@ -1984,7 +1985,7 @@ DocEntry *Document::ReadNextDocEntry()
       static_cast<DataEntry *>(newEntry)->SetState(DataEntry::STATE_NOTLOADED);
    }
 
-   if ( vr == GDCM_UNKNOWN )
+   if ( vr == GDCM_VRUNKNOWN )
    {
       if ( Filetype == ExplicitVR )
       {
index dc04ee29da0fa91a6339f98affedf3a852db35cd..764160abd78ea4107850652c5ae9cfa84089a28d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 09:17:08 $
-  Version:   $Revision: 1.124 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.125 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -190,8 +190,8 @@ private:
    void LoadDocEntry         (DocEntry *e, bool forceLoad = false);
    void FindDocEntryLength   (DocEntry *e) throw ( FormatError );
    uint32_t FindDocEntryLengthOBOrOW() throw( FormatUnexpected );
-   std::string FindDocEntryVR();
-   bool CheckDocEntryVR      (VRKey k);
+   VRKey FindDocEntryVR();
+   bool CheckDocEntryVR      (const VRKey &k);
 
    void SkipDocEntry          (DocEntry *entry);
    void SkipToNextDocEntry    (DocEntry *entry);
index 066959abd581f5ad748d46e22e97106aa52259be..fe54402e1fddbfd7358d8603e2c873d0032decce 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:50 $
-  Version:   $Revision: 1.276 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.277 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -219,7 +219,7 @@ bool File::DoTheLoadingJob( )
       DataEntry *oldEntry = dynamic_cast<DataEntry *>(entry);
       if (oldEntry)
       {
-         std::string PixelVR;
+         VRKey PixelVR;
          // 8 bits allocated is a 'O Bytes' , as well as 24 (old ACR-NEMA RGB)
          // more than 8 (i.e 12, 16) is a 'O Words'
          if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 ) 
index bc5fe6636d0a2b254bdada7e2dade822ec55462b..1b454c60de9f0534104818aa9eadddb932910319 100644 (file)
@@ -4,8 +4,8 @@
   Module:    $RCSfile: gdcmFileHelper.cxx,v $
   Language:  C++
 
-  Date:      $Date: 2005/10/18 12:49:55 $
-  Version:   $Revision: 1.61 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.62 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1121,8 +1121,8 @@ DataEntry *FileHelper::CopyDataEntry(uint16_t group, uint16_t elem,
    DocEntry *oldE = FileInternal->GetDocEntry(group, elem);
    DataEntry *newE;
 
-   if ( oldE && vr != GDCM_UNKNOWN ) 
-      if ( oldE->GetVR()!=vr )
+   if ( oldE && vr != GDCM_VRUNKNOWN ) 
+      if ( oldE->GetVR() != vr )
          oldE = NULL;
 
    if ( oldE )
index 1c1d0d8d07b4e60aa5b83d840e1668163ee77a2b..448afcc0446f5048356c19f54a9a5758fea9dee9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFileHelper.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:50 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.24 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -165,7 +165,7 @@ protected:
    void RestoreWriteOfLibido();
 
    DataEntry *CopyDataEntry(uint16_t group, uint16_t elem, 
-                               const TagName &vr = GDCM_UNKNOWN);
+                               const TagName &vr = GDCM_VRUNKNOWN);
    void CheckMandatoryElements();
    void CheckMandatoryEntry(uint16_t group,uint16_t elem,std::string value);
    void SetMandatoryEntry(uint16_t group,uint16_t elem,std::string value);
index c9ccd9d984fb182f8aeaa6ca1f78a058742a3fab..b2864d5d081b94fb66d841f608db800190e5ab63 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmGlobal.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/11 08:24:10 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2005/10/18 12:58:28 $
+  Version:   $Revision: 1.27 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -42,6 +42,9 @@ const std::string GDCM_NOTLOADED = "gdcm::NotLoaded";
 const std::string GDCM_UNREAD    = "gdcm::UnRead";
 const std::string GDCM_NOTASCII  = "gdcm::NotAscii";
 const std::string GDCM_PIXELDATA = "gdcm::Pixel Data to be loaded";
+
+const std::string GDCM_VRUNKNOWN = "  ";
+
 //-----------------------------------------------------------------------------
 DictSet         *Global::Dicts     = (DictSet *)0;
 VR              *Global::ValRes    = (VR *)0;
index dabf98ee8f658793266855ed53574ebe9b97acda..0e13699421a54e9a6bc8cb2624a912285dd7b37a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSystem.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 09:17:08 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/10/18 12:58:29 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -86,17 +86,6 @@ typedef  unsigned int        uint32_t;
 #endif
 
 #include <string>
-#define FASTTAGKEY 0
-
-// FIXME: Should rewrite this:
-#if FASTTAGKEY
-#include <iostream>
-#include <iomanip>
-#endif
-#if defined(_MSC_VER) && (_MSC_VER == 1200)
-/* ostream operator for std::string since VS6 does not provide it*/
-#include <iostream>
-#endif
 
 //-----------------------------------------------------------------------------
 #endif
index 9b74d4869ea605221433720f428ad99eed445f65..f3fca668413ae4f1569a2f28dea52421791ed4de 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVR.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:51 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2005/10/18 12:58:29 $
+  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
@@ -20,6 +20,8 @@
 #define GDCMVR_H
 
 #include "gdcmCommon.h"
+#include "gdcmVRKey.h"
+
 #include <map>
 #include <string>
 #include <iostream>
@@ -28,7 +30,6 @@ namespace gdcm
 {
 
 //-----------------------------------------------------------------------------
-typedef std::string VRKey;
 typedef std::string VRAtr;
 /// Value Representation Hash Table
 typedef std::map<VRKey, VRAtr> VRHT;
diff --git a/src/gdcmVRKey.h b/src/gdcmVRKey.h
new file mode 100644 (file)
index 0000000..7144937
--- /dev/null
@@ -0,0 +1,125 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: gdcmVRKey.h,v $
+  Language:  C++
+  Date:      $Date: 2005/10/18 12:58:29 $
+  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 GDCMVRKEY_H
+#define GDCMVRKEY_H
+
+#include "gdcmCommon.h"
+#include "gdcmDebug.h"
+
+#include <assert.h>
+
+namespace gdcm 
+{
+//-----------------------------------------------------------------------------
+class VRKey
+{
+public :
+   inline VRKey() { key[0] = key[1] = ' ';}
+   inline VRKey(const char *_key) { key[0] = _key[0]; key[1] = _key[1];}
+   inline VRKey(const std::string &_key) { key[0] = _key[0]; key[1] = _key[1];}
+
+   inline std::string str() const { return std::string(key,2); }
+
+   friend std::ostream& operator<<(std::ostream& _os, const VRKey &_val);
+   friend std::istream& operator>>(std::istream& _is, VRKey &_val);
+
+   inline VRKey &operator=(const VRKey &_val)
+   {
+      key[0] = _val.key[0];
+      key[1] = _val.key[1];
+      return *this;
+   }
+   inline VRKey &operator=(const std::string &_val)
+   {
+      key[0] = _val[0];
+      key[1] = _val[1];
+      return *this;
+   }
+   inline VRKey &operator=(const char *_val)
+   {
+      key[0] = _val[0];
+      key[1] = _val[1];
+      return *this;
+   }
+
+   inline const char &operator[](const unsigned int &_id) const
+   {
+      assert(_id<2);
+      return key[_id];
+   }
+   inline char &operator[](const unsigned int &_id)
+   {
+      assert(_id<2);
+      return key[_id];
+   }
+
+   inline bool operator==(const VRKey &_val) const
+   {
+      return key[0] == _val.key[0] && key[1] == _val.key[1];
+   }
+   inline bool operator==(const std::string &_val) const
+   {
+      return key[0] == _val[0] && key[1] == _val[1];
+   }
+   inline bool operator==(const char *_val) const
+   {
+      return key[0] == _val[0] && key[1] == _val[1];
+   }
+
+   inline bool operator!=(const VRKey &_val) const
+   {
+      return key[0] != _val.key[0] || key[1] != _val.key[1];
+   }
+   inline bool operator!=(const std::string &_val) const
+   {
+      return key[0] != _val[0] || key[1] != _val[1];
+   }
+   inline bool operator!=(const char *_val) const
+   {
+      return key[0] != _val[0] || key[1] != _val[1];
+   }
+
+   inline bool operator<(const VRKey &_val) const
+   {
+      return key[0] < _val[0] || (key[0] == _val[0] && key[1] < _val[1]);
+   }
+
+private :
+   char key[2];
+};
+
+//-----------------------------------------------------------------------------
+inline std::ostream& operator<<(std::ostream& _os, const VRKey &_val)
+{
+   _os << _val.key[0] << _val[1];
+   return _os;
+}
+
+inline std::istream& operator>>(std::istream& _is, VRKey &_val)
+{
+   _is >> _val.key[0] >> _val[1];
+   return _is;
+}
+
+//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+#endif