]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDir.cxx
ENH: Pass 2 at cleaning the JPEG mess. Still some work to do, but things are getting...
[gdcm.git] / src / gdcmDicomDir.cxx
index 01fb17ce6fa768436f8cd2f2ba75037f424f6459..7eb67e4af159aed227c28cecbc381c59cf50bde5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/25 11:11:58 $
-  Version:   $Revision: 1.117 $
+  Date:      $Date: 2005/01/29 11:43:05 $
+  Version:   $Revision: 1.122 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -331,11 +331,10 @@ DicomDirPatient *DicomDir::GetFirstPatient()
 DicomDirPatient *DicomDir::GetNextPatient()
 {
    gdcmAssertMacro (ItPatient != Patients.end());
-   {
-      ++ItPatient;
-      if ( ItPatient != Patients.end() )
-         return *ItPatient;
-   }
+
+   ++ItPatient;
+   if ( ItPatient != Patients.end() )
+      return *ItPatient;
    return NULL;
 }
 
@@ -462,18 +461,14 @@ void DicomDir::CreateDicomDirChainedList(std::string const & path)
 
 /**
  * \brief   adds *the* Meta to a partially created DICOMDIR
- */
-  
+ */  
 DicomDirMeta *DicomDir::NewMeta()
 {
    if( MetaElems )
       delete MetaElems;
 
- // friend class hunting : we miss GetLastEntry and GetPreviousEntry
- //                  to be able to remove any direct reference to TagHT
    DocEntry *entry = GetFirstEntry();
    if( entry )
-   //if ( TagHT.begin() != TagHT.end() ) // after Document Parsing
    { 
       MetaElems = new DicomDirMeta(true);
 
@@ -488,16 +483,6 @@ DicomDirMeta *DicomDir::NewMeta()
 
          entry = GetFirstEntry();
       }
-      /*TagDocEntryHT::iterator lastOneButSequence = TagHT.end();
-      lastOneButSequence --;
-      // ALL the 'out of Sequence' Tags belong to Meta Elems
-      // (we skip 0004|1220 [Directory record sequence] )
-      for ( TagDocEntryHT::iterator cc  = TagHT.begin(); 
-                                    cc != lastOneButSequence;
-                                   ++cc)
-      {
-         MetaElems->AddEntry( cc->second );
-      }*/
    }
    else  // after root directory parsing
    {
@@ -740,7 +725,7 @@ void DicomDir::Initialize()
  */
 void DicomDir::CreateDicomDir()
 {
-   // The list is parsed. 
+   // The SeqEntries of "Directory Record Sequence" are parsed. 
    //  When a DicomDir tag ("PATIENT", "STUDY", "SERIE", "IMAGE") is found :
    //  1 - we save the beginning iterator
    //  2 - we continue to parse
@@ -752,7 +737,7 @@ void DicomDir::CreateDicomDir()
    DocEntry *e = GetDocEntry(0x0004, 0x1220);
    if ( !e )
    {
-      gdcmVerboseMacro( "NO Directory record sequence (0x0004,0x1220)");
+      gdcmVerboseMacro( "No Directory Record Sequence (0004,1220) found");
       /// \todo FIXME: what to do when the parsed file IS NOT a DICOMDIR file ? 
       return;         
    }
@@ -760,8 +745,7 @@ void DicomDir::CreateDicomDir()
    SeqEntry *s = dynamic_cast<SeqEntry *>(e);
    if ( !s )
    {
-      gdcmVerboseMacro( "No SeqEntry present");
-      // useless : (0x0004,0x1220) IS a Sequence !
+      gdcmVerboseMacro( "Element (0004,1220) is not a Sequence ?!?");
       return;
    }
 
@@ -831,12 +815,11 @@ void DicomDir::CreateDicomDir()
          // neither an 'IMAGE' SQItem. Skip to next item.
          continue;
       }
+      if( si )
+         MoveSQItem(si,tmpSI);
 
-      //if( si )
-         //MoveSQItem(si,tmpSI);
       tmpSI=s->GetNextSQItem();
    }
-// friend hunting : this one will be difficult to remove !
    ClearEntry();
 }