]> Creatis software - gdcm.git/blobdiff - src/gdcmDocument.cxx
Fix bug on DicomDir utilities
[gdcm.git] / src / gdcmDocument.cxx
index 12a0a05f9b7bd21bb42c445ab3c1392adba00e16..a454f9b1d985c11bd883f02068ca020834ff1ea0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/18 16:23:52 $
-  Version:   $Revision: 1.197 $
+  Date:      $Date: 2005/01/19 10:30:51 $
+  Version:   $Revision: 1.199 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -409,7 +409,7 @@ bool Document::CloseFile()
       Fp = 0;
    }
 
-   return true; //FIXME how do we detect a non-close ifstream ?
+   return true; //FIXME how do we detect a non-closed ifstream ?
 }
 
 /**
@@ -620,7 +620,6 @@ SeqEntry *Document::ReplaceOrCreate( uint16_t group, uint16_t elem)
          }
       }
    }
-
    // Create a new seqEntry if necessary
    if (!seqEntry)
    {
@@ -634,7 +633,6 @@ SeqEntry *Document::ReplaceOrCreate( uint16_t group, uint16_t elem)
          return NULL;
       }
    }
-
    return seqEntry;
 } 
  
@@ -839,8 +837,8 @@ void *Document::GetEntryBinArea(uint16_t group, uint16_t elem)
 }
 
 /**
- * \brief         Loads (from disk) the element content 
- *                when a string is not suitable
+ * \brief Loads (from disk) the element content 
+ *        when a string is not suitable
  * @param group   group number of the Entry 
  * @param elem  element number of the Entry
  */
@@ -859,8 +857,8 @@ void Document::LoadEntryBinArea(uint16_t group, uint16_t elem)
 }
 
 /**
- * \brief         Loads (from disk) the element content 
- *                when a string is not suitable
+ * \brief Loads (from disk) the element content 
+ *        when a string is not suitable
  * @param elem  Entry whose binArea is going to be loaded
  */
 void Document::LoadEntryBinArea(BinEntry *elem) 
@@ -923,11 +921,7 @@ void Document::LoadEntryBinArea(BinEntry *elem)
 }*/
 
 /**
- * \brief  retrieves a Dicom Element (the first one) using (group, element)
- * \warning (group, element) IS NOT an identifier inside the Dicom Header
- *           if you think it's NOT UNIQUE, check the count number
- *           and use iterators to retrieve ALL the Dicoms Elements within
- *           a given couple (group, element)
+ * \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  
@@ -991,9 +985,34 @@ BinEntry *Document::GetBinEntry(uint16_t group, uint16_t elem)
 }
 
 /**
- * \brief         Loads the element while preserving the current
- *               underlying file position indicator as opposed to
- *                to LoadDocEntry that modifies it.
+ * \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 *Document::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;
+}
+
+
+/**
+ * \brief  Loads the element while preserving the current
+ *         underlying file position indicator as opposed to
+ *        LoadDocEntry that modifies it.
  * @param entry   Header Entry whose value will be loaded. 
  * @return  
  */