]> Creatis software - gdcm.git/blobdiff - src/gdcmElementSet.cxx
The following methods
[gdcm.git] / src / gdcmElementSet.cxx
index 44044e4f64da07765d8978fea65de7597a1cce73..cf778c42745d9a3faf69fe42030045ee36070c5d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmElementSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/19 15:24:28 $
-  Version:   $Revision: 1.46 $
+  Date:      $Date: 2005/01/20 11:37:37 $
+  Version:   $Revision: 1.47 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -96,6 +96,96 @@ void ElementSet::WriteContent(std::ofstream *fp, FileType filetype)
    } 
 }
 
+
+/**
+ * \brief  retrieves a Dicom Element using (group, element)
+ * @param   group  Group number of the searched Dicom Element 
+ * @param   elem Element number of the searched Dicom Element 
+ * @return  
+ */
+DocEntry *ElementSet::GetDocEntry(uint16_t group, uint16_t elem) 
+{
+   TagKey key = DictEntry::TranslateToKey(group, elem);
+   if ( !TagHT.count(key))
+   {
+      return NULL;
+   }
+   return TagHT.find(key)->second;
+}
+
+/**
+ * \brief  Same as \ref Document::GetDocEntry except it only
+ *         returns a result when the corresponding entry is of type
+ *         ValEntry.
+ * @param   group  Group number of the searched Dicom Element 
+ * @param   elem Element number of the searched Dicom Element  
+ * @return When present, the corresponding ValEntry. 
+ */
+ValEntry *ElementSet::GetValEntry(uint16_t group, uint16_t elem)
+{
+   DocEntry *currentEntry = GetDocEntry(group, elem);
+   if ( !currentEntry )
+   {
+      return 0;
+   }
+   if ( ValEntry *entry = dynamic_cast<ValEntry*>(currentEntry) )
+   {
+      return entry;
+   }
+   gdcmVerboseMacro( "Unfound ValEntry.");
+
+   return 0;
+}
+
+/**
+ * \brief  Same as \ref Document::GetDocEntry except it only
+ *         returns a result when the corresponding entry is of type
+ *         BinEntry.
+ * @param   group  Group number of the searched Dicom Element 
+ * @param   elem Element number of the searched Dicom Element  
+ * @return When present, the corresponding BinEntry. 
+ */
+BinEntry *ElementSet::GetBinEntry(uint16_t group, uint16_t elem)
+{
+   DocEntry *currentEntry = GetDocEntry(group, elem);
+   if ( !currentEntry )
+   {
+      return 0;
+   }
+   if ( BinEntry *entry = dynamic_cast<BinEntry*>(currentEntry) )
+   {
+      return entry;
+   }
+   gdcmVerboseMacro( "Unfound BinEntry.");
+
+   return 0;
+}
+
+/**
+ * \brief  Same as \ref Document::GetDocEntry except it only
+ *         returns a result when the corresponding entry is of type
+ *         SeqEntry.
+ * @param   group  Group number of the searched Dicom Element 
+ * @param   elem Element number of the searched Dicom Element  
+ * @return When present, the corresponding SeqEntry. 
+ */
+SeqEntry *ElementSet::GetSeqEntry(uint16_t group, uint16_t elem)
+{
+   DocEntry *currentEntry = GetDocEntry(group, elem);
+   if ( !currentEntry )
+   {
+      return 0;
+   }
+   if ( SeqEntry *entry = dynamic_cast<SeqEntry*>(currentEntry) )
+   {
+      return entry;
+   }
+   gdcmVerboseMacro( "Unfound SeqEntry.");
+
+   return 0;
+}
+
+
 //-----------------------------------------------------------------------------
 // Protected