]> Creatis software - gdcm.git/commitdiff
* Remove the Key information in Entry
authorregrain <regrain>
Wed, 19 Oct 2005 13:17:04 +0000 (13:17 +0000)
committerregrain <regrain>
Wed, 19 Oct 2005 13:17:04 +0000 (13:17 +0000)
   * Create a DicomEntry parent of DictEntry
   * Remap correctly the TagKey
   -- BeNours

13 files changed:
src/CMakeLists.txt
src/gdcmCommon.h
src/gdcmDicomEntry.cxx [new file with mode: 0644]
src/gdcmDicomEntry.h [new file with mode: 0644]
src/gdcmDictEntry.cxx
src/gdcmDictEntry.h
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocEntrySet.h
src/gdcmSQItem.h
src/gdcmSerieHelper.h
src/gdcmTagKey.h [new file with mode: 0644]
src/gdcmVRKey.h

index 84d3df6e89b7229fb7ea4247c5d9e5d9fb14486e..3b1710f743d6f89ad5f46294d7aa678cc9d8bb22 100644 (file)
@@ -33,6 +33,7 @@ SET(libgdcm_la_SOURCES
    gdcmDicomDirVisit.cxx
    gdcmDicomDirSerie.cxx
    gdcmDicomDirStudy.cxx
+   gdcmDicomEntry.cxx
    gdcmDict.cxx
    gdcmDictEntry.cxx
    gdcmDictGroupName.cxx
@@ -44,9 +45,9 @@ SET(libgdcm_la_SOURCES
    gdcmDocument.cxx
    gdcmElementSet.cxx
    gdcmException.cxx
+   gdcmFile.cxx
    gdcmFileHelper.cxx
    gdcmGlobal.cxx
-   gdcmFile.cxx
    gdcmJPEGFragment.cxx
    gdcmJPEGFragmentsInfo.cxx
    gdcmJpeg8.cxx
index 85c63a55508c1146d1e04ae68001cc9cfabcbae2..e7875ede4d3f2f703ad6c0f6bc5aeb585eb69063 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmCommon.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/19 12:01:50 $
-  Version:   $Revision: 1.98 $
+  Date:      $Date: 2005/10/19 13:17:04 $
+  Version:   $Revision: 1.99 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 #include <string>
 
-//-----------------------------------------------------------------------------
-// TagKey definition
-#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
-
 //-----------------------------------------------------------------------------
 #if defined(_WIN32) && defined(BUILD_SHARED_LIBS)
   #ifdef gdcm_EXPORTS
@@ -83,37 +69,6 @@ GDCM_EXPORT extern const std::string GDCM_VRUNKNOWN;
 /// We'll fix the mess up -without any change in the API- as soon as the bench
 /// marks are fully performed.
 
-#if FASTTAGKEY
-typedef union   {
-      uint16_t  tab[2];
-      uint32_t  tagkey;
-    } TagKey;
-/* 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);
-}
-inline bool operator==(TagKey _self, TagKey _val)
-{
-   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];
-}
-#else
-typedef std::string TagKey;
-#endif
 #if defined(_MSC_VER) && (_MSC_VER == 1200)
 // Doing everything within gdcm namespace to avoid polluting 3d party software
 inline std::ostream& operator<<(std::ostream& _O, std::string _val)
diff --git a/src/gdcmDicomEntry.cxx b/src/gdcmDicomEntry.cxx
new file mode 100644 (file)
index 0000000..785b941
--- /dev/null
@@ -0,0 +1,94 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: gdcmDicomEntry.cxx,v $
+  Language:  C++
+  Date:      $Date: 2005/10/19 13:17:05 $
+  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.
+                                                                                
+=========================================================================*/
+
+#include "gdcmDicomEntry.h"
+#include "gdcmDebug.h"
+#include "gdcmUtil.h"
+
+#include <iomanip> // for std::ios::left, ...
+#include <fstream>
+#include <stdio.h> // for sprintf
+
+namespace gdcm 
+{
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \brief   Constructor
+ * @param   group      DICOM-Group Number
+ * @param   elem       DICOM-Element Number
+ * @param   vr         Value Representation
+ * @param   vm         Value Multiplicity 
+ * @param   name       description of the element
+*/
+DicomEntry::DicomEntry(const uint16_t &group,const uint16_t &elt,
+                       const VRKey &vr)
+{
+   Tag.SetGroup(group);
+   Tag.SetElement(elt);
+   VR = vr;
+}
+
+/**
+ * \brief   Destructor
+ */
+DicomEntry::~DicomEntry()
+{
+}
+
+//-----------------------------------------------------------------------------
+// Public
+/**
+ * \brief   concatenates 2 uint16_t (supposed to be a Dicom group number 
+ *                                              and a Dicom element number)
+ * @param  group the Dicom group number used to build the tag
+ * @param  elem the Dicom element number used to build the tag
+ * @return the built tag
+ */
+TagKey DicomEntry::TranslateToKey(uint16_t group, uint16_t elem)
+{
+   // according to 'Purify', TranslateToKey is one of the most
+   // time consuming methods.
+   // Let's try to shorten it !
+   return TagKey(group,elem);
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+/**
+ * \brief   Prints an entry of the Dicom DictionaryEntry
+ * @param   os ostream we want to print in
+ * @param indent Indentation string to be prepended during printing
+ */
+void DicomEntry::Print(std::ostream &os, std::string const & )
+{
+   std::ostringstream s;
+
+   s << GetKey(); 
+   s << " [" << VR  << "] ";
+}
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
diff --git a/src/gdcmDicomEntry.h b/src/gdcmDicomEntry.h
new file mode 100644 (file)
index 0000000..d74dca8
--- /dev/null
@@ -0,0 +1,86 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: gdcmDicomEntry.h,v $
+  Language:  C++
+  Date:      $Date: 2005/10/19 13:17:05 $
+  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 GDCMDICOMENTRY_H
+#define GDCMDICOMENTRY_H
+
+#include "gdcmCommon.h"
+#include "gdcmBase.h"
+#include "gdcmVRKey.h"
+#include "gdcmTagKey.h"
+
+namespace gdcm 
+{
+//-----------------------------------------------------------------------------
+/**
+ * \brief
+ * the DicomEntry in an element contained by the Dict.
+ * It contains :
+ *  - the key referenced by the DICOM norm or the constructor (for private keys)
+ *    i.e. the Group number
+ *         the Element number
+ *  - the VR (Value Representation)
+ *  - the VM (Value Multplicity)
+ *  - the corresponding name in english
+ */
+class GDCM_EXPORT DicomEntry : public Base
+{
+public:
+   DicomEntry(const uint16_t &group,const uint16_t &elt,
+              const VRKey &vr = GDCM_VRUNKNOWN);
+   ~DicomEntry();
+
+// Print
+   void Print(std::ostream &os = std::cout, std::string const &indent = "");
+
+   /// \brief  Returns the Dicom Group Number
+   /// @return the Dicom Group Number
+   const uint16_t &GetGroup() const { return Tag[0]; }
+
+   /// \brief  Returns the Dicom Element Number
+   /// @return the Dicom Element Number
+   const uint16_t &GetElement() const { return Tag[1]; }
+
+   /// \brief  Set the Dicom Value Representation 
+   /// \param vr the Dicom Value Representation
+   virtual void SetVR(VRKey const &vr) { VR = vr; }
+   /// \brief  Returns the Dicom Value Representation 
+   /// @return the Dicom Value Representation
+   const VRKey &GetVR() const { return VR; }
+   /// \brief tells if the V(alue) R(epresentation) is known (?!)
+   /// @return 
+   bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
+
+   const TagKey &GetKey() const { return Tag; }
+
+// Key creation
+   static TagKey TranslateToKey(uint16_t group, uint16_t elem);
+
+private:
+   /// Dicom \ref TagKey. Contains DicomGroup number and DicomElement number
+   TagKey Tag;
+
+   /// \brief Value Representation i.e. some clue about the nature
+   ///        of the data represented e.g. 
+   ///        "FD" short for "Floating Point Double"(see \ref VR)
+   ///        "PN" short for "Person Name"       
+   VRKey VR;
+};
+} // end namespace gdcm
+//-----------------------------------------------------------------------------
+#endif
index ed1052af3d9bd019dfb0f02ab742bd4bc3c34c78..cfe420d81a88496853dc6fe7a6aedf1eaf537607 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:27 $
-  Version:   $Revision: 1.52 $
+  Date:      $Date: 2005/10/19 13:17:04 $
+  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
@@ -40,14 +40,11 @@ namespace gdcm
 DictEntry::DictEntry(uint16_t group, uint16_t elem,
                      VRKey const &vr, 
                      TagName const &vm,
-                     TagName const &name)
+                     TagName const &name):
+   DicomEntry(group,elem,vr)
 {
-   Group   = group;
-   Element = elem;
-   VR      = vr;
    VM      = vm;
    Name    = name;
-   Key     = TranslateToKey(group, elem);
 }
 
 //-----------------------------------------------------------------------------
@@ -61,7 +58,7 @@ void DictEntry::SetVR(VRKey const &vr)
 {
    if ( IsVRUnknown() )
    {
-      VR = vr;
+      DicomEntry::SetVR(vr);
    }
    else 
    {
@@ -86,32 +83,6 @@ void DictEntry::SetVM(TagName const &vm)
    }
 }
 
-/**
- * \brief   concatenates 2 uint16_t (supposed to be a Dicom group number 
- *                                              and a Dicom element number)
- * @param  group the Dicom group number used to build the tag
- * @param  elem the Dicom element number used to build the tag
- * @return the built tag
- */
-TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t elem)
-{
-   // according to 'Purify', TranslateToKey is one of the most
-   // time consuming methods.
-   // Let's try to shorten it !
-   //return Util::Format("%04x|%04x", group, elem); // too much time !
-#if FASTTAGKEY
-   TagKey r;
-   r.tab[0] = group;
-   r.tab[1] = elem;
-   return r;
-#else
-   char res[10];
-   sprintf(res,"%04x|%04x", group, elem);
-   return res;
-#endif
-}
-
 //-----------------------------------------------------------------------------
 // Protected
 
@@ -125,18 +96,13 @@ TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t elem)
  * @param   os ostream we want to print in
  * @param indent Indentation string to be prepended during printing
  */
-void DictEntry::Print(std::ostream &os, std::string const & )
+void DictEntry::Print(std::ostream &os, std::string const &indent )
 {
+   DicomEntry::Print(os,indent);
+
    VRKey vr;
    std::ostringstream s;
 
-   vr = GetVR();
-   if ( IsVRUnknown() )
-      vr="  ";
-
-   s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 
-   s << " [" << vr  << "] ";
-
    if ( PrintLevel >= 1 )
    {
       s.setf(std::ios::left);
index 2b651f2b6dfc41a781c9caaa97e16e8f2777b56c..2be34877348a41cc5102059deda8185d8573c4e0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:27 $
-  Version:   $Revision: 1.37 $
+  Date:      $Date: 2005/10/19 13:17:04 $
+  Version:   $Revision: 1.38 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -19,8 +19,7 @@
 #ifndef GDCMDICTENTRY_H
 #define GDCMDICTENTRY_H
 
-#include "gdcmBase.h"
-#include "gdcmVRKey.h"
+#include "gdcmDicomEntry.h"
 
 namespace gdcm 
 {
@@ -36,7 +35,7 @@ namespace gdcm
  *  - the VM (Value Multplicity)
  *  - the corresponding name in english
  */
-class GDCM_EXPORT DictEntry : public Base
+class GDCM_EXPORT DictEntry : public DicomEntry
 {
 public:
    DictEntry(uint16_t group, 
@@ -49,127 +48,27 @@ public:
    void Print(std::ostream &os = std::cout, std::string const &indent = "");
 
 // Content of DictEntry
-   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_VRUNKNOWN; }
+   virtual void SetVR(VRKey const &vr);
+   virtual void SetVM(TagName const &vm);
+   /// \brief   returns the VM field of the current DictEntry
+   /// @return  The 'Value Multiplicity' field
+   const TagName &GetVM() const { return VM; } 
 
    /// \brief tells if the V(alue) M(ultiplicity) is known (?!)
    /// @return 
    bool IsVMUnknown() const { return VM == GDCM_UNKNOWN; }
 
-   /// \brief  Returns the Dicom Group Number of the current DictEntry
-   /// @return the Dicom Group Number
-   const uint16_t &GetGroup() const { return Group; }
-  
-   /// \brief  Returns the Dicom Element Number of the current DictEntry
-   /// @return the Dicom Element Number
-   const uint16_t &GetElement() const { return Element; }
-   /// \brief  Returns the Dicom Value Representation of the current
-   ///         DictEntry
-   /// @return the Dicom Value Representation
-   const VRKey &GetVR() const { return VR; }
-   /// \brief   sets the key of the current DictEntry
-   /// @param k New key to be set.
-   void SetKey(TagKey const &k)  { Key = k; }
-   /// \brief   returns the VM field of the current DictEntry
-   /// @return  The 'Value Multiplicity' field
-   const TagName &GetVM() const { return VM; } 
-
    /// \brief  Returns the Dicom Name of the current DictEntry
    ///         e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) 
    /// @return the Dicom Name
    const TagName &GetName() const { return Name; } 
  
-   /// \brief  Gets the key of the current DictEntry
-   /// @return the key.
-   const TagKey &GetKey() const { return Key; }
-
-// Key creation
-   static TagKey TranslateToKey(uint16_t group, uint16_t elem);
-
 private:
-   /// \todo FIXME 
-   ///        where are the group and elem used except from building up
-   ///        a TagKey. If the answer is nowhere then there is no need
-   ///        to store the group and elem independently.
-   ///
-   ///        --> EVERYWHERE ! The alternate question would be :
-   ///                         What's TagKey used for ?
-   
-   /// DicomGroup number
-   uint16_t Group;   // e.g. 0x0010
-
-   /// DicomElement number
-   uint16_t Element; // e.g. 0x0103
-
-   /// \brief Value Representation i.e. some clue about the nature
-   ///        of the data represented e.g. 
-   ///        "FD" short for "Floating Point Double"(see \ref VR)
-   ///        "PN" short for "Person Name"       
-   VRKey VR;
-
-   /*
-    *  .
-    *  Formerly 'Group name abbreviations'
-    *  Here is a small dictionary we encountered in "nature":
-    *  - CMD      Command        
-    *  - META     Meta Information 
-    *  - DIR      Directory
-    *  - ID       ???
-    *  - PAT      Patient
-    *  - ACQ      Acquisition
-    *  - REL      Related
-    *  - IMG      Image
-    *  - SDY      Study
-    *  - VIS      Visit 
-    *  - WAV      Waveform
-    *  - PRC      ???
-    *  - DEV      Device
-    *  - NMI      Nuclear Medicine
-    *  - MED      ???
-    *  - BFS      Basic Film Session
-    *  - BFB      Basic Film Box
-    *  - BIB      Basic Image Box
-    *  - BAB
-    *  - IOB
-    *  - PJ
-    *  - PRINTER
-    *  - RT       Radio Therapy
-    *  - DVH   
-    *  - SSET
-    *  - RES      Results
-    *  - CRV      Curve
-    *  - OLY      Overlays
-    *  - PXL      Pixels
-    *  - DL       Delimiters
-    *  .
-    *
-    *  Other usefull abreviations used for Radiographic view associated with
-    *  Patient Position (0018,5100):
-    *  -  AP = Anterior/Posterior 
-    *  -  PA = Posterior/Anterior 
-    *  -  LL = Left Lateral 
-    *  -  RL = Right Lateral 
-    *  - RLD = Right Lateral Decubitus 
-    *  - LLD = Left  Lateral Decubitus 
-    *  - RLO = Right Lateral Oblique 
-    *  - LLO = Left  Lateral Oblique  
-    *  .
-    */
    /// \brief Value Multiplicity (e.g. "1", "1-n", "6")
    TagName VM; 
 
    /// e.g. "Patient's Name"                    
    TagName Name;      
-
-   /// Redundant with (group, elem) but we add it for efficiency purpose.
-   TagKey  Key;
 };
 } // end namespace gdcm
 //-----------------------------------------------------------------------------
index a4011aa731b0fef048e8ec408ef6087f498088b4..2c250b5a1e1c89741037059864fe37ae5bf8f7f9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 19:54:26 $
-  Version:   $Revision: 1.72 $
+  Date:      $Date: 2005/10/19 13:17:04 $
+  Version:   $Revision: 1.73 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -39,7 +39,6 @@ DocEntry::DocEntry(DictEntry *in)
 {
    ImplicitVR = false;
    DicomDict  = in;
-   SetKey( in->GetKey( ) );
    Offset     = 0 ; // To avoid further missprinting
 
    // init some variables
index 2310a70bd3f36eeb7f07341ac264a2cf8f92b3bd..cf12bdfadf5a6396e062931f832e34f5df7d68fb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:28 $
-  Version:   $Revision: 1.51 $
+  Date:      $Date: 2005/10/19 13:17:04 $
+  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
@@ -55,11 +55,8 @@ public:
    /// Returns the Dicom Element number of the current Dicom entry
    const uint16_t &GetElement() const { return DicomDict->GetElement();}
 
-   /// Set the 'key' of the current Dicom entry
-   void  SetKey( TagKey const &key ) { Key = key; }
-
    /// Returns the 'key' of the current Dicom entry
-   TagKey const &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
@@ -148,10 +145,6 @@ protected:
    /// Offset from the beginning of file for direct user access
    size_t Offset; 
 
-   /// \brief Generalized key of this DocEntry (for details on
-   ///        the generalized key refer to \ref TagKey documentation).
-   TagKey Key;
-
 private:
 };
 } // end namespace gdcm
index 99ce356a693b5fb1428c5b267d68466c2c9b64e0..bcf22dd3199ccb8123e66d546d116ac85c998c3d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:28 $
-  Version:   $Revision: 1.58 $
+  Date:      $Date: 2005/10/19 13:17:05 $
+  Version:   $Revision: 1.59 $
                                                                                 
   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 "gdcmBase.h"
 #include "gdcmVRKey.h"
+#include "gdcmTagKey.h"
 
 #include <fstream>
 
@@ -32,8 +33,6 @@ class DataEntry;
 class SeqEntry;
 class DictEntry;
 
-typedef TagKey BaseTagKey;
-
 //-----------------------------------------------------------------------------
 /**
  * \brief
index 586d650cf7a087ee816bfedbc985202a93aaceb6..4dca0cff00baa92473ecab82833edda5afeb3033 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.h,v $
   Language:  C++
-  Date:      $Date: 2005/09/02 07:10:03 $
-  Version:   $Revision: 1.44 $
+  Date:      $Date: 2005/10/19 13:17:05 $
+  Version:   $Revision: 1.45 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -72,12 +72,6 @@ public:
    ///  \brief Accessor on \ref SQDepthLevel.
    void SetDepthLevel(int depth) { SQDepthLevel = depth; }
 
-   // waste time hunting
-   // /  \brief Accessor on \ref BaseTagKey.
-   //void SetBaseTagKey( BaseTagKey const &key ) { BaseTagKeyNested = key; }
-   // /  \brief Accessor on \ref BaseTagKey.
-   //BaseTagKey const &GetBaseTagKey() const { return BaseTagKeyNested; }
-
 protected:
 // Variables that need to be accessed in subclasses
    /// \brief Chained list of Doc Entries
@@ -95,11 +89,6 @@ private:
    ///        (see \ref Print).
    int SQDepthLevel;
 
-   // waste time hunting
-   // / \brief A TagKey of a DocEntry nested in a sequence is prepended
-   // /        with this BaseTagKey.
-   //BaseTagKey BaseTagKeyNested;
-
    /// \brief SQ Item ordinal number 
    int SQItemNumber;
 };
index 312da40cb147aa73993609315604b6257c1f0fb5..693b82a67e105fea5233307260eec792fc063e20 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSerieHelper.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/17 09:52:41 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2005/10/19 13:17:05 $
+  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
@@ -20,6 +20,7 @@
 #define GDCMSERIEHELPER_H
 
 #include "gdcmCommon.h" 
+#include "gdcmTagKey.h" 
 #include "gdcmDebug.h"  // for LEGACY
  
 #include <vector>
diff --git a/src/gdcmTagKey.h b/src/gdcmTagKey.h
new file mode 100644 (file)
index 0000000..01b35d2
--- /dev/null
@@ -0,0 +1,97 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: gdcmTagKey.h,v $
+  Language:  C++
+  Date:      $Date: 2005/10/19 13:17:05 $
+  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 GDCMTAGKEY_H
+#define GDCMTAGKEY_H
+
+#include "gdcmCommon.h"
+
+#include <assert.h>
+#include <iostream>
+#include <iomanip> // for std::ios::left, ...
+
+namespace gdcm 
+{
+//-----------------------------------------------------------------------------
+class TagKey
+{
+public :
+   inline TagKey(const uint16_t &gr, const uint16_t &elt) { tag[0] = gr;tag[1] = elt;}
+   inline TagKey() { tag[0] = tag[1] = 0x0000;}
+
+   friend std::ostream& operator<<(std::ostream& _os, const TagKey &_val);
+
+   inline void SetGroup(const uint16_t &val) { tag[0] = val; }
+   inline const uint16_t &GetGroup(void) { return tag[0]; }
+
+   inline void SetElement(const uint16_t &val) { tag[1] = val; }
+   inline const uint16_t &GetElement(void) { return tag[1]; }
+
+   inline TagKey &operator=(const TagKey &_val)
+   {
+      tag[0] = _val.tag[0];
+      tag[1] = _val.tag[1];
+      return *this;
+   }
+
+   inline const uint16_t &operator[](const unsigned int &_id) const
+   {
+      assert(_id<2);
+      return tag[_id];
+   }
+   inline const uint16_t &operator[](const unsigned int &_id)
+   {
+      assert(_id<2);
+      return tag[_id];
+   }
+
+   inline bool operator==(const TagKey &_val) const
+   {
+      return tag[0] == _val.tag[0] && tag[1] == _val.tag[1];
+   }
+
+   inline bool operator!=(const TagKey &_val) const
+   {
+      return tag[0] != _val.tag[0] || tag[1] != _val.tag[1];
+   }
+
+   inline bool operator<(const TagKey &_val) const
+   {
+      return tag[0] < _val.tag[0] || (tag[0] == _val.tag[0] && tag[1] < _val.tag[1]);
+   }
+
+private :
+   uint16_t tag[2];
+};
+
+//-----------------------------------------------------------------------------
+inline std::ostream& operator<<(std::ostream& _os, const TagKey &_val)
+{
+   _os.setf( std::ios::right);
+   _os << std::hex << std::setw( 4 ) << std::setfill( '0' )
+       << _val.tag[0] << '|' << std::setw( 4 ) << std::setfill( '0' )
+       << _val.tag[1] << std::setfill( ' ' ) << std::dec;
+   return _os;
+}
+
+//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+#endif
index 71449375ae89de57e64d18ab80cb73c63d4c888e..a594abbc7f1ee2287d9246aa8c7cc393a44bd460 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVRKey.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:29 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/10/19 13:17:05 $
+  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
@@ -20,7 +20,6 @@
 #define GDCMVRKEY_H
 
 #include "gdcmCommon.h"
-#include "gdcmDebug.h"
 
 #include <assert.h>