X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDicomDir.cxx;h=34f7025cf1dace136fe11e7a72a75abd66847923;hb=8670efa6c3fc51c51fe71c2f62af2297a19b07e2;hp=97d1f3dec03d6e7b2a80e8b695b216e62da6c81e;hpb=ce8913daafe02955368fd2f07e777e86824467cc;p=gdcm.git diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 97d1f3de..34f7025c 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/01/25 15:44:23 $ - Version: $Revision: 1.118 $ + Date: $Date: 2005/02/01 10:34:59 $ + Version: $Revision: 1.124 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,6 +16,10 @@ =========================================================================*/ +//----------------------------------------------------------------------------- +// For full DICOMDIR description, see: +// PS 3.3-2003, pages 731-750 +//----------------------------------------------------------------------------- #include "gdcmDicomDir.h" #include "gdcmDicomDirStudy.h" #include "gdcmDicomDirSerie.h" @@ -49,13 +53,8 @@ namespace gdcm { - -//----------------------------------------------------------------------------- -// For full DICOMDIR description, see: -// PS 3.3-2003, pages 731-750 //----------------------------------------------------------------------------- // Constructor / Destructor - /** * \brief Constructor : creates an empty DicomDir */ @@ -153,29 +152,6 @@ DicomDir::~DicomDir() } } -//----------------------------------------------------------------------------- -// Print -/** - * \brief Canonical Printer - * @param os ostream we want to print in - * @param indent Indentation string to be prepended during printing - */ -void DicomDir::Print(std::ostream &os, std::string const & ) -{ - if( MetaElems ) - { - MetaElems->SetPrintLevel(PrintLevel); - MetaElems->Print(os); - } - for(ListDicomDirPatient::iterator cc = Patients.begin(); - cc != Patients.end(); - ++cc) - { - (*cc)->SetPrintLevel(PrintLevel); - (*cc)->Print(os); - } -} - //----------------------------------------------------------------------------- // Public /** @@ -398,7 +374,6 @@ bool DicomDir::WriteDicomDir(std::string const &fileName) //----------------------------------------------------------------------------- // Protected - /** * \brief create a Document-like chained list from a root Directory * @param path entry point of the tree-like structure @@ -461,18 +436,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); @@ -487,16 +458,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 { @@ -672,7 +633,6 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, } } -//----------------------------------------------------------------------------- /** * \brief CallStartMethod */ @@ -686,7 +646,6 @@ void DicomDir::CallStartMethod() } } -//----------------------------------------------------------------------------- /** * \brief CallProgressMethod */ @@ -698,7 +657,6 @@ void DicomDir::CallProgressMethod() } } -//----------------------------------------------------------------------------- /** * \brief CallEndMethod */ @@ -739,7 +697,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 @@ -751,7 +709,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; } @@ -759,8 +717,7 @@ void DicomDir::CreateDicomDir() SeqEntry *s = dynamic_cast(e); if ( !s ) { - gdcmVerboseMacro( "No SeqEntry present"); - // useless : (0x0004,0x1220) IS a Sequence ! + gdcmVerboseMacro( "Element (0004,1220) is not a Sequence ?!?"); return; } @@ -830,12 +787,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(); } @@ -1004,6 +960,28 @@ bool DicomDir::HeaderLessThan(Document *header1, Document *header2) return *header1 < *header2; } -} // end namespace gdcm +//----------------------------------------------------------------------------- +// Print +/** + * \brief Canonical Printer + * @param os ostream we want to print in + * @param indent Indentation string to be prepended during printing + */ +void DicomDir::Print(std::ostream &os, std::string const & ) +{ + if( MetaElems ) + { + MetaElems->SetPrintLevel(PrintLevel); + MetaElems->Print(os); + } + for(ListDicomDirPatient::iterator cc = Patients.begin(); + cc != Patients.end(); + ++cc) + { + (*cc)->SetPrintLevel(PrintLevel); + (*cc)->Print(os); + } +} //----------------------------------------------------------------------------- +} // end namespace gdcm