1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.cxx,v $
6 Date: $Date: 2005/07/07 16:37:40 $
7 Version: $Revision: 1.144 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 //-----------------------------------------------------------------------------
20 // For full DICOMDIR description, see:
21 // PS 3.3-2003, pages 731-750
22 //-----------------------------------------------------------------------------
23 #include "gdcmDicomDir.h"
24 #include "gdcmDicomDirStudy.h"
25 #include "gdcmDicomDirSerie.h"
26 #include "gdcmDicomDirImage.h"
27 #include "gdcmDicomDirPatient.h"
28 #include "gdcmDicomDirMeta.h"
29 #include "gdcmDicomDirElement.h"
30 #include "gdcmDirList.h"
32 #include "gdcmDebug.h"
33 #include "gdcmGlobal.h"
35 #include "gdcmSeqEntry.h"
36 #include "gdcmSQItem.h"
37 #include "gdcmValEntry.h"
42 #include <sys/types.h>
45 # define getcwd _getcwd
48 #if defined(_MSC_VER) || defined(__BORLANDC__)
53 // ----------------------------------------------------------------------------
54 // Note for future developpers
55 // ----------------------------------------------------------------------------
57 // Dicom PS 3.3 describes the relationship between Directory Records, as follow
58 // (see also PS 4.3, 2004, page 50 for Entity-Relationship model)
60 // Directory Record Type Directory Record Types which may be included
61 // in the next lower-level directory Entity
63 // (Root directory Entity) PATIENT, TOPIC, PRIVATE
65 // PATIENT STUDY, PRIVATE
67 // STUDY SERIES, VISIT, RESULTS, STUDY COMPONENT, PRIVATE
69 // SERIES IMAGE, OVERLAYS, MODALITY LUT, VOI LUT,
70 // CURVE, STORED PRINT, RT DOSE, RT STRUCTURE SET
71 // RT PLAN, RT TREAT RECORD, PRESENTATION, WAVEFORM,
72 // SR DOCUMENT, KEY OBJECT DOC, SPECTROSCOPY,
73 // RAW DATA, REGISTRATION, FIDUCIAL, PRIVATE,
96 // ----------------------
97 // The current gdcm version only deals with :
99 // (Root directory Entity) PATIENT
105 // DicomDir::CreateDicomDir will have to be completed
106 // Treelike structure management will have to be upgraded
107 // ----------------------------------------------------------------------------
111 //-----------------------------------------------------------------------------
112 // Constructor / Destructor
114 * \brief Constructor : creates an empty DicomDir
119 Initialize(); // sets all private fields to NULL
124 * \brief Constructor Parses recursively the directory and creates the DicomDir
125 * or uses an already built DICOMDIR, depending on 'parseDir' value.
126 * @param fileName name
127 * - of the root directory (parseDir = true)
128 * - of the DICOMDIR (parseDir = false)
129 * @param parseDir boolean
130 * - true if user passed an entry point
131 * and wants to explore recursively the directories
132 * - false if user passed an already built DICOMDIR file
133 * and wants to use it
135 DicomDir::DicomDir(std::string const &fileName, bool parseDir ):
138 // At this step, Document constructor is already executed,
139 // whatever user passed (either a root directory or a DICOMDIR)
140 // and whatever the value of parseDir was.
141 // (nothing is cheked in Document constructor, to avoid overhead)
144 SetLoadMode (0x00000000); // concerns only dicom files
149 * \brief Canonical destructor
151 DicomDir::~DicomDir()
153 SetStartMethod(NULL);
154 SetProgressMethod(NULL);
164 //-----------------------------------------------------------------------------
168 * \brief Loader. use SetLoadMode(), SetFileName() before !
169 * @return false if file cannot be open or no swap info was found,
170 * or no tag was found.
172 bool DicomDir::Load( )
174 // We should clean out anything that already exists.
175 Initialize(); // sets all private fields to NULL
179 if ( ! this->Document::Load( ) )
182 return DoTheLoadingJob( );
186 * \brief Loader. (DEPRECATED : not to break the API)
187 * @param fileName file to be open for parsing
188 * @return false if file cannot be open or no swap info was found,
189 * or no tag was found.
191 bool DicomDir::Load(std::string const &fileName )
193 // We should clean out anything that already exists.
194 Initialize(); // sets all private fields to NULL
196 SetFileName( fileName );
199 if ( ! this->Document::Load( ) )
202 return DoTheLoadingJob( );
206 * \brief Does the Loading Job (internal use only)
207 * @return false if file cannot be open or no swap info was found,
208 * or no tag was found.
210 bool DicomDir::DoTheLoadingJob( )
212 // We should clean out anything that already exists.
213 Initialize(); // sets all private fields to NULL
217 // Only if user passed a DICOMDIR
218 // ------------------------------
224 if (!Document::Load() )
229 if ( GetFirstEntry() == 0 ) // when user passed a Directory to parse
231 gdcmWarningMacro( "Entry HT empty for file: "<< GetFileName());
234 // Directory record sequence
235 DocEntry *e = GetDocEntry(0x0004, 0x1220);
238 gdcmWarningMacro( "NO 'Directory record sequence' (0x0004,0x1220)"
239 << " in file " << GetFileName());
247 // Only if user passed a root directory
248 // ------------------------------------
249 if ( GetFileName() == "." )
251 // user passed '.' as Name
252 // we get current directory name
254 getcwd(dummy, (size_t)1000);
255 SetFileName( dummy ); // will be converted into a string
258 gdcmWarningMacro( "Parse directory and create the DicomDir : "
266 * \brief This predicate, based on hopefully reasonable heuristics,
267 * decides whether or not the current document was properly parsed
268 * and contains the mandatory information for being considered as
269 * a well formed and usable DicomDir.
270 * @return true when Document is the one of a reasonable DicomDir,
273 bool DicomDir::IsReadable()
275 if ( Filetype == Unknown )
277 gdcmWarningMacro( "Wrong filetype");
282 gdcmWarningMacro( "Meta Elements missing in DicomDir");
285 if ( Patients.size() <= 0 )
287 gdcmWarningMacro( "NO Patient in DicomDir");
295 * \brief adds *the* Meta to a partially created DICOMDIR
297 DicomDirMeta *DicomDir::NewMeta()
302 DocEntry *entry = GetFirstEntry();
305 MetaElems = new DicomDirMeta(true); // true = empty
307 entry = GetFirstEntry();
310 if ( dynamic_cast<SeqEntry *>(entry) )
313 RemoveEntryNoDestroy(entry);
314 MetaElems->AddEntry(entry);
316 entry = GetFirstEntry();
319 else // after root directory parsing
321 MetaElems = new DicomDirMeta(false); // false = not empty
323 MetaElems->SetSQItemNumber(0); // To avoid further missprinting
328 * \brief adds a new Patient (with the basic elements) to a partially created
331 DicomDirPatient *DicomDir::NewPatient()
333 DicomDirPatient *p = new DicomDirPatient();
334 AddPatientToEnd( p );
339 * \brief Remove all Patients
341 void DicomDir::ClearPatient()
343 for(ListDicomDirPatient::iterator cc = Patients.begin();
353 * \brief Get the first entry while visiting the DicomDirPatients
354 * \return The first DicomDirPatient if found, otherwhise NULL
356 DicomDirPatient *DicomDir::GetFirstPatient()
358 ItPatient = Patients.begin();
359 if ( ItPatient != Patients.end() )
365 * \brief Get the next entry while visiting the DicomDirPatients
366 * \note : meaningfull only if GetFirstEntry already called
367 * \return The next DicomDirPatient if found, otherwhise NULL
369 DicomDirPatient *DicomDir::GetNextPatient()
371 gdcmAssertMacro (ItPatient != Patients.end());
374 if ( ItPatient != Patients.end() )
380 * \brief fills the whole structure, starting from a root Directory
382 void DicomDir::ParseDirectory()
384 CreateDicomDirChainedList( GetFileName() );
389 * \brief Set the start method to call when the parsing of the
391 * @param method Method to call
392 * @param arg Argument to pass to the method
393 * @param argDelete Argument
394 * \warning In python : the arg parameter isn't considered
396 void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg,
397 DicomDir::Method *argDelete )
399 if ( StartArg && StartMethodArgDelete )
401 StartMethodArgDelete( StartArg );
404 StartMethod = method;
406 StartMethodArgDelete = argDelete;
411 * \brief Set the progress method to call when the parsing of the
413 * @param method Method to call
414 * @param arg Argument to pass to the method
415 * @param argDelete Argument
416 * \warning In python : the arg parameter isn't considered
418 void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg,
419 DicomDir::Method *argDelete )
421 if ( ProgressArg && ProgressMethodArgDelete )
423 ProgressMethodArgDelete( ProgressArg );
426 ProgressMethod = method;
428 ProgressMethodArgDelete = argDelete;
432 * \brief Set the end method to call when the parsing of the directory ends
433 * @param method Method to call
434 * @param arg Argument to pass to the method
435 * @param argDelete Argument
436 * \warning In python : the arg parameter isn't considered
438 void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg,
439 DicomDir::Method *argDelete )
441 if ( EndArg && EndMethodArgDelete )
443 EndMethodArgDelete( EndArg );
448 EndMethodArgDelete = argDelete;
452 * \brief Set the method to delete the argument
453 * The argument is destroyed when the method is changed or when the
455 * @param method Method to call to delete the argument
457 void DicomDir::SetStartMethodArgDelete( DicomDir::Method *method )
459 StartMethodArgDelete = method;
463 * \brief Set the method to delete the argument
464 * The argument is destroyed when the method is changed or when the
466 * @param method Method to call to delete the argument
468 void DicomDir::SetProgressMethodArgDelete( DicomDir::Method *method )
470 ProgressMethodArgDelete = method;
474 * \brief Set the method to delete the argument
475 * The argument is destroyed when the method is changed or when
476 * the class is destroyed
477 * @param method Method to call to delete the argument
479 void DicomDir::SetEndMethodArgDelete( DicomDir::Method *method )
481 EndMethodArgDelete = method;
485 * \brief writes on disc a DICOMDIR
486 * \ warning does NOT add the missing elements in the header :
487 * it's up to the user doing it !
488 * @param fileName file to be written to
489 * @return false only when fail to open
492 bool DicomDir::WriteDicomDir(std::string const &fileName)
495 uint16_t sq[4] = { 0x0004, 0x1220, 0xffff, 0xffff };
496 uint16_t sqt[4]= { 0xfffe, 0xe0dd, 0xffff, 0xffff };
498 std::ofstream *fp = new std::ofstream(fileName.c_str(),
499 std::ios::out | std::ios::binary);
502 gdcmWarningMacro("Failed to open(write) File: " << fileName.c_str());
506 char filePreamble[128];
507 memset(filePreamble, 0, 128);
508 fp->write(filePreamble, 128);
509 binary_write( *fp, "DICM");
511 DicomDirMeta *ptrMeta = GetMeta();
512 ptrMeta->WriteContent(fp, ExplicitVR);
514 // force writing 0004|1220 [SQ ], that CANNOT exist within DicomDirMeta
517 binary_write(*fp, sq[i]);
520 for(ListDicomDirPatient::iterator cc = Patients.begin();
521 cc != Patients.end();
524 (*cc)->WriteContent( fp, ExplicitVR );
527 // force writing Sequence Delimitation Item
530 binary_write(*fp, sqt[i]); // fffe e0dd ffff ffff
540 * \brief Anonymize a DICOMDIR
544 bool DicomDir::AnonymizeDicomDir()
547 // Something clever to be found to forge the Patient names
548 std::ostringstream s;
550 for(ListDicomDirPatient::iterator cc = Patients.begin();
555 v = (*cc)->GetValEntry(0x0010, 0x0010) ; // Patient's Name
558 v->SetValue(s.str());
561 v = (*cc)->GetValEntry(0x0010, 0x0020) ; // Patient ID
567 v = (*cc)->GetValEntry(0x0010, 0x0030) ; // Patient's BirthDate
578 //-----------------------------------------------------------------------------
581 * \brief create a Document-like chained list from a root Directory
582 * @param path entry point of the tree-like structure
584 void DicomDir::CreateDicomDirChainedList(std::string const &path)
587 DirList dirList(path,1); // gets recursively the file list
588 unsigned int count = 0;
592 DirListType fileList = dirList.GetFilenames();
594 for( DirListType::iterator it = fileList.begin();
595 it != fileList.end();
598 Progress = (float)(count+1)/(float)fileList.size();
599 CallProgressMethod();
606 f->SetLoadMode(LoadMode); // we allow user not to load Sequences...
607 f->Load( it->c_str() );
611 // gdcmWarningMacro( "Failure in new gdcm::File " << it->c_str() );
615 if ( f->IsReadable() )
617 // Add the file to the chained list:
619 gdcmWarningMacro( "Readable " << it->c_str() );
627 // sorts Patient/Study/Serie/
628 std::sort(list.begin(), list.end(), DicomDir::HeaderLessThan );
630 std::string tmp = dirList.GetDirName();
631 //for each File of the chained list, add/update the Patient/Study/Serie/Image info
632 SetElements(tmp, list);
635 for(VectDocument::iterator itDoc=list.begin();
639 delete dynamic_cast<File *>(*itDoc);
644 * \brief CallStartMethod
646 void DicomDir::CallStartMethod()
652 StartMethod( StartArg );
657 * \brief CallProgressMethod
659 void DicomDir::CallProgressMethod()
661 if ( ProgressMethod )
663 ProgressMethod( ProgressArg );
668 * \brief CallEndMethod
670 void DicomDir::CallEndMethod()
679 //-----------------------------------------------------------------------------
682 * \brief Sets all fields to NULL
684 void DicomDir::Initialize()
687 ProgressMethod = NULL;
689 StartMethodArgDelete = NULL;
690 ProgressMethodArgDelete = NULL;
691 EndMethodArgDelete = NULL;
703 * \brief create a 'gdcm::DicomDir' from a DICOMDIR Header
705 void DicomDir::CreateDicomDir()
707 // The SeqEntries of "Directory Record Sequence" are parsed.
708 // When a DicomDir tag ("PATIENT", "STUDY", "SERIE", "IMAGE") is found :
709 // 1 - we save the beginning iterator
710 // 2 - we continue to parse
711 // 3 - we find an other tag
712 // + we create the object for the precedent tag
715 // Directory record sequence
716 DocEntry *e = GetDocEntry(0x0004, 0x1220);
719 gdcmWarningMacro( "No Directory Record Sequence (0004,1220) found");
723 SeqEntry *s = dynamic_cast<SeqEntry *>(e);
726 gdcmWarningMacro( "Element (0004,1220) is not a Sequence ?!?");
736 SQItem *tmpSI=s->GetFirstSQItem();
739 d = tmpSI->GetDocEntry(0x0004, 0x1430); // Directory Record Type
740 if ( ValEntry* valEntry = dynamic_cast<ValEntry *>(d) )
742 v = valEntry->GetValue();
746 gdcmWarningMacro( "(0004,1430) not a ValEntry ?!?");
750 // A decent DICOMDIR has much more images than series,
751 // more series than studies, and so on.
752 // This is the right order to preform the tests
756 si = new DicomDirImage(true);
757 if ( !AddImageToEnd( static_cast<DicomDirImage *>(si)) )
761 gdcmErrorMacro( "Add AddImageToEnd failed");
764 else if ( v == "SERIES" )
766 si = new DicomDirSerie(true);
767 if ( !AddSerieToEnd( static_cast<DicomDirSerie *>(si)) )
771 gdcmErrorMacro( "Add AddSerieToEnd failed");
774 else if ( v == "STUDY " )
776 si = new DicomDirStudy(true);
777 if ( !AddStudyToEnd( static_cast<DicomDirStudy *>(si)) )
781 gdcmErrorMacro( "Add AddStudyToEnd failed");
784 else if ( v == "PATIENT " )
786 si = new DicomDirPatient(true);
787 if ( !AddPatientToEnd( static_cast<DicomDirPatient *>(si)) )
791 gdcmErrorMacro( "Add PatientToEnd failed");
796 // It was neither a 'PATIENT', nor a 'STUDY', nor a 'SERIE',
797 // nor an 'IMAGE' SQItem. Skip to next item.
798 gdcmWarningMacro( " -------------------------------------------"
799 << "a non PATIENT/STUDY/SERIE/IMAGE SQItem was found : "
802 // FIXME : deal with other item types !
803 tmpSI=s->GetNextSQItem(); // To avoid infinite loop
807 MoveSQItem(si,tmpSI);
809 tmpSI=s->GetNextSQItem();
815 * \brief AddPatientToEnd
816 * @param dd SQ Item to enqueue to the DicomPatient chained List
818 bool DicomDir::AddPatientToEnd(DicomDirPatient *dd)
820 Patients.push_back(dd);
825 * \brief AddStudyToEnd
826 * @param dd SQ Item to enqueue to the DicomDirStudy chained List
828 bool DicomDir::AddStudyToEnd(DicomDirStudy *dd)
830 if ( Patients.size() > 0 )
832 ListDicomDirPatient::iterator itp = Patients.end();
834 (*itp)->AddStudy(dd);
841 * \brief AddSerieToEnd
842 * @param dd SQ Item to enqueue to the DicomDirSerie chained List
844 bool DicomDir::AddSerieToEnd(DicomDirSerie *dd)
846 if ( Patients.size() > 0 )
848 ListDicomDirPatient::iterator itp = Patients.end();
851 DicomDirStudy *study = (*itp)->GetLastStudy();
862 * \brief AddImageToEnd
863 * @param dd SQ Item to enqueue to the DicomDirImage chained List
865 bool DicomDir::AddImageToEnd(DicomDirImage *dd)
867 if ( Patients.size() > 0 )
869 ListDicomDirPatient::iterator itp = Patients.end();
872 DicomDirStudy *study = (*itp)->GetLastStudy();
875 DicomDirSerie *serie = study->GetLastSerie();
887 * \brief for each Header of the chained list,
888 * add/update the Patient/Study/Serie/Image info
889 * @param path path of the root directory
890 * @param list chained list of Headers
892 void DicomDir::SetElements(std::string const &path, VectDocument const &list)
897 std::string patPrevName = "", patPrevID = "";
898 std::string studPrevInstanceUID = "", studPrevID = "";
899 std::string serPrevInstanceUID = "", serPrevID = "";
901 std::string patCurName, patCurID;
902 std::string studCurInstanceUID, studCurID;
903 std::string serCurInstanceUID, serCurID;
906 for( VectDocument::const_iterator it = list.begin();
910 // get the current file characteristics
911 patCurName = (*it)->GetEntryValue(0x0010,0x0010);
912 patCurID = (*it)->GetEntryValue(0x0010,0x0011);
913 studCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000d);
914 studCurID = (*it)->GetEntryValue(0x0020,0x0010);
915 serCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000e);
916 serCurID = (*it)->GetEntryValue(0x0020,0x0011);
918 if ( patCurName != patPrevName || patCurID != patPrevID || first )
920 SetElement(path, GDCM_DICOMDIR_PATIENT, *it);
924 // if new Study, deal with 'STUDY' Elements
925 if ( studCurInstanceUID != studPrevInstanceUID || studCurID != studPrevID
928 SetElement(path, GDCM_DICOMDIR_STUDY, *it);
932 // if new Serie, deal with 'SERIE' Elements
933 if ( serCurInstanceUID != serPrevInstanceUID || serCurID != serPrevID
936 SetElement(path, GDCM_DICOMDIR_SERIE, *it);
939 // Always Deal with 'IMAGE' Elements
940 SetElement(path, GDCM_DICOMDIR_IMAGE, *it);
942 patPrevName = patCurName;
943 patPrevID = patCurID;
944 studPrevInstanceUID = studCurInstanceUID;
945 studPrevID = studCurID;
946 serPrevInstanceUID = serCurInstanceUID;
947 serPrevID = serCurID;
953 * \brief adds to the HTable
954 * the Entries (Dicom Elements) corresponding to the given type
955 * @param path full path file name (only used when type = GDCM_DICOMDIR_IMAGE
956 * @param type DicomDirObject type to create (GDCM_DICOMDIR_PATIENT,
957 * GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
958 * @param header Header of the current file
960 void DicomDir::SetElement(std::string const &path, DicomDirType type,
963 ListDicomDirElem elemList;
964 ListDicomDirElem::const_iterator it;
965 uint16_t tmpGr, tmpEl;
966 DictEntry *dictEntry;
973 case GDCM_DICOMDIR_IMAGE:
974 elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
975 si = new DicomDirImage(true);
976 if ( !AddImageToEnd(static_cast<DicomDirImage *>(si)) )
979 gdcmErrorMacro( "Add ImageToEnd failed");
982 case GDCM_DICOMDIR_SERIE:
983 elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
984 si = new DicomDirSerie(true);
985 if ( !AddSerieToEnd(static_cast<DicomDirSerie *>(si)) )
988 gdcmErrorMacro( "Add SerieToEnd failed");
991 case GDCM_DICOMDIR_STUDY:
992 elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
993 si = new DicomDirStudy(true);
994 if ( !AddStudyToEnd(static_cast<DicomDirStudy *>(si)) )
997 gdcmErrorMacro( "Add StudyToEnd failed");
1000 case GDCM_DICOMDIR_PATIENT:
1001 elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
1002 si = new DicomDirPatient(true);
1003 if ( !AddPatientToEnd(static_cast<DicomDirPatient *>(si)) )
1006 gdcmErrorMacro( "Add PatientToEnd failed");
1009 case GDCM_DICOMDIR_META:
1010 elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements();
1011 si = new DicomDirMeta(true);
1015 gdcmErrorMacro( "MetaElements already exist, they will be destroyed");
1017 MetaElems = static_cast<DicomDirMeta *>(si);
1022 // removed all the seems-to-be-useless stuff about Referenced Image Sequence
1023 // to avoid further troubles
1024 // imageElem 0008 1140 "" // Referenced Image Sequence
1025 // imageElem fffe e000 "" // 'no length' item : length to be set to 0xffffffff later
1026 // imageElem 0008 1150 "" // Referenced SOP Class UID : to be set/forged later
1027 // imageElem 0008 1155 "" // Referenced SOP Instance UID : to be set/forged later
1028 // imageElem fffe e00d "" // Item delimitation : length to be set to ZERO later
1030 // FIXME : troubles found when it's a SeqEntry
1032 // for all the relevant elements found in their own spot of the DicomDir.dic
1033 for( it = elemList.begin(); it != elemList.end(); ++it)
1037 dictEntry = GetPubDict()->GetEntry(tmpGr, tmpEl);
1039 entry = new ValEntry( dictEntry ); // Be sure it's never a BinEntry !
1041 entry->SetOffset(0); // just to avoid further missprinting
1045 // NULL when we Build Up (ex nihilo) a DICOMDIR
1046 // or when we add the META elems
1047 val = header->GetEntryValue(tmpGr, tmpEl);
1054 if ( val == GDCM_UNFOUND)
1056 if ( tmpGr == 0x0004 && tmpEl == 0x1130 ) // File-set ID
1058 // force to the *end* File Name
1059 val = Util::GetName( path );
1061 else if ( tmpGr == 0x0004 && tmpEl == 0x1500 ) // Only used for image
1063 if ( header->GetFileName().substr(0, path.length()) != path )
1065 gdcmWarningMacro( "The base path of file name is incorrect");
1066 val = header->GetFileName();
1070 val = &(header->GetFileName().c_str()[path.length()]);
1080 if ( header->GetEntryLength(tmpGr,tmpEl) == 0 )
1084 entry->SetValue( val ); // troubles expected when vr=SQ ...
1086 if ( type == GDCM_DICOMDIR_META ) // fusible : should never print !
1088 gdcmWarningMacro("GDCM_DICOMDIR_META ?!? should never print that");
1090 si->AddEntry(entry);
1095 * \brief Move the content of the source SQItem to the destination SQItem
1096 * Only DocEntry's are moved
1097 * @param dst destination SQItem
1098 * @param src source SQItem
1100 void DicomDir::MoveSQItem(DocEntrySet *dst,DocEntrySet *src)
1104 entry = src->GetFirstEntry();
1107 src->RemoveEntryNoDestroy(entry);
1108 dst->AddEntry(entry);
1109 // we destroyed -> the current iterator is not longer valid
1110 entry = src->GetFirstEntry();
1115 * \brief compares two files
1117 bool DicomDir::HeaderLessThan(Document *header1, Document *header2)
1119 return *header1 < *header2;
1122 //-----------------------------------------------------------------------------
1125 * \brief Canonical Printer
1126 * @param os ostream we want to print in
1127 * @param indent Indentation string to be prepended during printing
1129 void DicomDir::Print(std::ostream &os, std::string const & )
1133 MetaElems->SetPrintLevel(PrintLevel);
1134 MetaElems->Print(os);
1136 for(ListDicomDirPatient::iterator cc = Patients.begin();
1137 cc != Patients.end();
1140 (*cc)->SetPrintLevel(PrintLevel);
1145 //-----------------------------------------------------------------------------
1146 } // end namespace gdcm