]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirObject.cxx
According to Benoit's suggestion, and without any objection from anybody
[gdcm.git] / src / gdcmDicomDirObject.cxx
index fca87916eb972a91d3be5dc0d82fadd087130330..edbd6a855c24b01871ed77c4003d9ac6618b81e3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirObject.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/25 03:35:19 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2005/01/08 15:03:59 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmGlobal.h"
 #include "gdcmDebug.h"
 #include "gdcmValEntry.h"
+#include "gdcmDictSet.h"
+
 namespace gdcm 
 {
 
 //-----------------------------------------------------------------------------
 /**
- * \ingroup DicomDirObject
  * \brief  Constructor 
  *          
- * @param ptagHT pointer to the HTable (DicomDirObject needs it 
- *               to build the DocEntries)
  * @param depth Sequence depth level
  */
   
-DicomDirObject::DicomDirObject(TagDocEntryHT *ptagHT, int depth) 
+DicomDirObject::DicomDirObject(int depth) 
           : SQItem (depth)
 {
-   PtagHT = ptagHT;
 }
 
 
 /**
- * \ingroup DicomDirObject
  * \brief   Canonical destructor.
  */
 DicomDirObject::~DicomDirObject()
@@ -49,19 +46,17 @@ DicomDirObject::~DicomDirObject()
 }
 
 
-
 //-----------------------------------------------------------------------------
 // Public
 
 
 /**
- * \ingroup DicomDirObject
  * \brief   Builds a hash table (multimap) containing 
  *          pointers to all Header Entries (i.e Dicom Element)
  *          related to this 'object'
  * @return
  */ 
-TagDocEntryHT DicomDirObject::GetEntry()
+TagDocEntryHT DicomDirObject::GetEntryHT()
 {
    TagDocEntryHT HT;
    DocEntries = GetDocEntries();   
@@ -78,12 +73,13 @@ TagDocEntryHT DicomDirObject::GetEntry()
 /**
  * \brief   add the 'Object' related Dicom Elements to the listEntries
  *          of a partially created DICOMDIR
+ * @param elemList Element List to add at the right place
  */
-void DicomDirObject::FillObject(ListDicomDirMetaElem const & elemList)
+void DicomDirObject::FillObject(ListDicomDirMetaElem const &elemList)
 {
-  // FillObject rempli le SQItem qui sera accroche au bon endroit
+  // FillObject fills up the SQItem that will be conneected to the right place
 
-   std::list<Element>::const_iterator it;
+   ListDicomDirMetaElem::const_iterator it;
    uint16_t tmpGr,tmpEl;
    DictEntry *dictEntry;
    ValEntry *entry;
@@ -93,34 +89,12 @@ void DicomDirObject::FillObject(ListDicomDirMetaElem const & elemList)
    {
       tmpGr = it->Group;
       tmpEl = it->Elem;
-      dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
+      dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetDictEntry(tmpGr,tmpEl);
       entry = new ValEntry(dictEntry);
       entry->SetOffset(0); // just to avoid further missprinting
       entry->SetValue(it->Value);
 
-      // dealing with value length ...
-  
-      if(dictEntry->GetGroup()==0xfffe) 
-      {
-         entry->SetLength(entry->GetValue().length());
-      }
-      else if( dictEntry->GetVR() == "UL" || dictEntry->GetVR() == "SL" ) 
-      {
-         entry->SetLength(4);
-      } 
-      else if( dictEntry->GetVR() == "US" || dictEntry->GetVR() == "SS" ) 
-      {
-         entry->SetLength(2); 
-      } 
-      else if( dictEntry->GetVR() == "SQ" )
-      {
-         entry->SetLength(0xffffffff);
-      }
-      else
-      {
-         entry->SetLength(entry->GetValue().length()); 
-      }                                
-      AddDocEntry(entry);
+      AddEntry(entry);
    }   
 }   
 } // end namespace gdcm