1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.cxx,v $
6 Date: $Date: 2005/07/08 10:13:38 $
7 Version: $Revision: 1.145 $
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
125 * \brief Constructor Parses recursively the directory and creates the DicomDir
126 * or uses an already built DICOMDIR, depending on 'parseDir' value.
127 * @param fileName name
128 * - of the root directory (parseDir = true)
129 * - of the DICOMDIR (parseDir = false)
130 * @param parseDir boolean
131 * - true if user passed an entry point
132 * and wants to explore recursively the directories
133 * - false if user passed an already built DICOMDIR file
134 * and wants to use it
136 DicomDir::DicomDir(std::string const &fileName, bool parseDir ):
139 // At this step, Document constructor is already executed,
140 // whatever user passed (either a root directory or a DICOMDIR)
141 // and whatever the value of parseDir was.
142 // (nothing is cheked in Document constructor, to avoid overhead)
145 SetLoadMode (0x00000000); // concerns only dicom files
150 * \brief Canonical destructor
152 DicomDir::~DicomDir()
154 SetStartMethod(NULL);
155 SetProgressMethod(NULL);
165 //-----------------------------------------------------------------------------
169 * \brief Loader. use SetLoadMode(), SetFileName() before !
170 * @return false if file cannot be open or no swap info was found,
171 * or no tag was found.
173 bool DicomDir::Load( )
175 // We should clean out anything that already exists.
176 Initialize(); // sets all private fields to NULL
180 if ( ! this->Document::Load( ) )
183 return DoTheLoadingJob( );
187 * \brief Loader. (DEPRECATED : not to break the API)
188 * @param fileName file to be open for parsing
189 * @return false if file cannot be open or no swap info was found,
190 * or no tag was found.
192 bool DicomDir::Load(std::string const &fileName )
194 // We should clean out anything that already exists.
195 Initialize(); // sets all private fields to NULL
197 SetFileName( fileName );
200 if ( ! this->Document::Load( ) )
203 return DoTheLoadingJob( );
207 * \brief Does the Loading Job (internal use only)
208 * @return false if file cannot be open or no swap info was found,
209 * or no tag was found.
211 bool DicomDir::DoTheLoadingJob( )
213 // We should clean out anything that already exists.
214 Initialize(); // sets all private fields to NULL
218 // Only if user passed a DICOMDIR
219 // ------------------------------
225 if (!Document::Load() )
230 if ( GetFirstEntry() == 0 ) // when user passed a Directory to parse
232 gdcmWarningMacro( "Entry HT empty for file: "<< GetFileName());
235 // Directory record sequence
236 DocEntry *e = GetDocEntry(0x0004, 0x1220);
239 gdcmWarningMacro( "NO 'Directory record sequence' (0x0004,0x1220)"
240 << " in file " << GetFileName());
248 // Only if user passed a root directory
249 // ------------------------------------
250 if ( GetFileName() == "." )
252 // user passed '.' as Name
253 // we get current directory name
255 getcwd(dummy, (size_t)1000);
256 SetFileName( dummy ); // will be converted into a string
259 gdcmWarningMacro( "Parse directory and create the DicomDir : "
267 * \brief This predicate, based on hopefully reasonable heuristics,
268 * decides whether or not the current document was properly parsed
269 * and contains the mandatory information for being considered as
270 * a well formed and usable DicomDir.
271 * @return true when Document is the one of a reasonable DicomDir,
274 bool DicomDir::IsReadable()
276 if ( Filetype == Unknown )
278 gdcmWarningMacro( "Wrong filetype");
283 gdcmWarningMacro( "Meta Elements missing in DicomDir");
286 if ( Patients.size() <= 0 )
288 gdcmWarningMacro( "NO Patient in DicomDir");
296 * \brief adds *the* Meta to a partially created DICOMDIR
298 DicomDirMeta *DicomDir::NewMeta()
303 DocEntry *entry = GetFirstEntry();
306 MetaElems = new DicomDirMeta(true); // true = empty
308 entry = GetFirstEntry();
311 if ( dynamic_cast<SeqEntry *>(entry) )
314 RemoveEntryNoDestroy(entry);
315 MetaElems->AddEntry(entry);
317 entry = GetFirstEntry();
320 else // after root directory parsing
322 MetaElems = new DicomDirMeta(false); // false = not empty
324 MetaElems->SetSQItemNumber(0); // To avoid further missprinting
329 * \brief adds a new Patient (with the basic elements) to a partially created
332 DicomDirPatient *DicomDir::NewPatient()
334 DicomDirPatient *p = new DicomDirPatient();
335 AddPatientToEnd( p );
340 * \brief Remove all Patients
342 void DicomDir::ClearPatient()
344 for(ListDicomDirPatient::iterator cc = Patients.begin();
354 * \brief Get the first entry while visiting the DicomDirPatients
355 * \return The first DicomDirPatient if found, otherwhise NULL
357 DicomDirPatient *DicomDir::GetFirstPatient()
359 ItPatient = Patients.begin();
360 if ( ItPatient != Patients.end() )
366 * \brief Get the next entry while visiting the DicomDirPatients
367 * \note : meaningfull only if GetFirstEntry already called
368 * \return The next DicomDirPatient if found, otherwhise NULL
370 DicomDirPatient *DicomDir::GetNextPatient()
372 gdcmAssertMacro (ItPatient != Patients.end());
375 if ( ItPatient != Patients.end() )
381 * \brief fills the whole structure, starting from a root Directory
383 void DicomDir::ParseDirectory()
385 CreateDicomDirChainedList( GetFileName() );
390 * \brief Set the start method to call when the parsing of the
392 * @param method Method to call
393 * @param arg Argument to pass to the method
394 * @param argDelete Argument
395 * \warning In python : the arg parameter isn't considered
397 void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg,
398 DicomDir::Method *argDelete )
400 if ( StartArg && StartMethodArgDelete )
402 StartMethodArgDelete( StartArg );
405 StartMethod = method;
407 StartMethodArgDelete = argDelete;
412 * \brief Set the progress method to call when the parsing of the
414 * @param method Method to call
415 * @param arg Argument to pass to the method
416 * @param argDelete Argument
417 * \warning In python : the arg parameter isn't considered
419 void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg,
420 DicomDir::Method *argDelete )
422 if ( ProgressArg && ProgressMethodArgDelete )
424 ProgressMethodArgDelete( ProgressArg );
427 ProgressMethod = method;
429 ProgressMethodArgDelete = argDelete;
433 * \brief Set the end method to call when the parsing of the directory ends
434 * @param method Method to call
435 * @param arg Argument to pass to the method
436 * @param argDelete Argument
437 * \warning In python : the arg parameter isn't considered
439 void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg,
440 DicomDir::Method *argDelete )
442 if ( EndArg && EndMethodArgDelete )
444 EndMethodArgDelete( EndArg );
449 EndMethodArgDelete = argDelete;
453 * \brief Set the method to delete the argument
454 * The argument is destroyed when the method is changed or when the
456 * @param method Method to call to delete the argument
458 void DicomDir::SetStartMethodArgDelete( DicomDir::Method *method )
460 StartMethodArgDelete = method;
464 * \brief Set the method to delete the argument
465 * The argument is destroyed when the method is changed or when the
467 * @param method Method to call to delete the argument
469 void DicomDir::SetProgressMethodArgDelete( DicomDir::Method *method )
471 ProgressMethodArgDelete = method;
475 * \brief Set the method to delete the argument
476 * The argument is destroyed when the method is changed or when
477 * the class is destroyed
478 * @param method Method to call to delete the argument
480 void DicomDir::SetEndMethodArgDelete( DicomDir::Method *method )
482 EndMethodArgDelete = method;
486 * \brief writes on disc a DICOMDIR
487 * \ warning does NOT add the missing elements in the header :
488 * it's up to the user doing it !
489 * @param fileName file to be written to
490 * @return false only when fail to open
493 bool DicomDir::WriteDicomDir(std::string const &fileName)
496 uint16_t sq[4] = { 0x0004, 0x1220, 0xffff, 0xffff };
497 uint16_t sqt[4]= { 0xfffe, 0xe0dd, 0xffff, 0xffff };
499 std::ofstream *fp = new std::ofstream(fileName.c_str(),
500 std::ios::out | std::ios::binary);
503 gdcmWarningMacro("Failed to open(write) File: " << fileName.c_str());
507 char filePreamble[128];
508 memset(filePreamble, 0, 128);
509 fp->write(filePreamble, 128);
510 binary_write( *fp, "DICM");
512 DicomDirMeta *ptrMeta = GetMeta();
513 ptrMeta->WriteContent(fp, ExplicitVR);
515 // force writing 0004|1220 [SQ ], that CANNOT exist within DicomDirMeta
518 binary_write(*fp, sq[i]);
521 for(ListDicomDirPatient::iterator cc = Patients.begin();
522 cc != Patients.end();
525 (*cc)->WriteContent( fp, ExplicitVR );
528 // force writing Sequence Delimitation Item
531 binary_write(*fp, sqt[i]); // fffe e0dd ffff ffff
541 * \brief Anonymize a DICOMDIR
545 bool DicomDir::AnonymizeDicomDir()
548 // Something clever to be found to forge the Patient names
549 std::ostringstream s;
551 for(ListDicomDirPatient::iterator cc = Patients.begin();
556 v = (*cc)->GetValEntry(0x0010, 0x0010) ; // Patient's Name
559 v->SetValue(s.str());
562 v = (*cc)->GetValEntry(0x0010, 0x0020) ; // Patient ID
568 v = (*cc)->GetValEntry(0x0010, 0x0030) ; // Patient's BirthDate
579 //-----------------------------------------------------------------------------
582 * \brief create a Document-like chained list from a root Directory
583 * @param path entry point of the tree-like structure
585 void DicomDir::CreateDicomDirChainedList(std::string const &path)
588 DirList dirList(path,1); // gets recursively the file list
589 unsigned int count = 0;
593 DirListType fileList = dirList.GetFilenames();
595 for( DirListType::iterator it = fileList.begin();
596 it != fileList.end();
599 Progress = (float)(count+1)/(float)fileList.size();
600 CallProgressMethod();
607 f->SetLoadMode(LoadMode); // we allow user not to load Sequences...
608 f->Load( it->c_str() );
612 // gdcmWarningMacro( "Failure in new gdcm::File " << it->c_str() );
616 if ( f->IsReadable() )
618 // Add the file to the chained list:
620 gdcmWarningMacro( "Readable " << it->c_str() );
628 // sorts Patient/Study/Serie/
629 std::sort(list.begin(), list.end(), DicomDir::HeaderLessThan );
631 std::string tmp = dirList.GetDirName();
632 //for each File of the chained list, add/update the Patient/Study/Serie/Image info
633 SetElements(tmp, list);
636 for(VectDocument::iterator itDoc=list.begin();
640 delete dynamic_cast<File *>(*itDoc);
645 * \brief CallStartMethod
647 void DicomDir::CallStartMethod()
653 StartMethod( StartArg );
658 * \brief CallProgressMethod
660 void DicomDir::CallProgressMethod()
662 if ( ProgressMethod )
664 ProgressMethod( ProgressArg );
669 * \brief CallEndMethod
671 void DicomDir::CallEndMethod()
680 //-----------------------------------------------------------------------------
683 * \brief Sets all fields to NULL
685 void DicomDir::Initialize()
688 ProgressMethod = NULL;
690 StartMethodArgDelete = NULL;
691 ProgressMethodArgDelete = NULL;
692 EndMethodArgDelete = NULL;
704 * \brief create a 'gdcm::DicomDir' from a DICOMDIR Header
706 void DicomDir::CreateDicomDir()
708 // The SeqEntries of "Directory Record Sequence" are parsed.
709 // When a DicomDir tag ("PATIENT", "STUDY", "SERIE", "IMAGE") is found :
710 // 1 - we save the beginning iterator
711 // 2 - we continue to parse
712 // 3 - we find an other tag
713 // + we create the object for the precedent tag
716 // Directory record sequence
717 DocEntry *e = GetDocEntry(0x0004, 0x1220);
720 gdcmWarningMacro( "No Directory Record Sequence (0004,1220) found");
724 SeqEntry *s = dynamic_cast<SeqEntry *>(e);
727 gdcmWarningMacro( "Element (0004,1220) is not a Sequence ?!?");
737 SQItem *tmpSI=s->GetFirstSQItem();
740 d = tmpSI->GetDocEntry(0x0004, 0x1430); // Directory Record Type
741 if ( ValEntry* valEntry = dynamic_cast<ValEntry *>(d) )
743 v = valEntry->GetValue();
747 gdcmWarningMacro( "(0004,1430) not a ValEntry ?!?");
751 // A decent DICOMDIR has much more images than series,
752 // more series than studies, and so on.
753 // This is the right order to preform the tests
757 si = new DicomDirImage(true);
758 if ( !AddImageToEnd( static_cast<DicomDirImage *>(si)) )
762 gdcmErrorMacro( "Add AddImageToEnd failed");
765 else if ( v == "SERIES" )
767 si = new DicomDirSerie(true);
768 if ( !AddSerieToEnd( static_cast<DicomDirSerie *>(si)) )
772 gdcmErrorMacro( "Add AddSerieToEnd failed");
775 else if ( v == "STUDY " )
777 si = new DicomDirStudy(true);
778 if ( !AddStudyToEnd( static_cast<DicomDirStudy *>(si)) )
782 gdcmErrorMacro( "Add AddStudyToEnd failed");
785 else if ( v == "PATIENT " )
787 si = new DicomDirPatient(true);
788 if ( !AddPatientToEnd( static_cast<DicomDirPatient *>(si)) )
792 gdcmErrorMacro( "Add PatientToEnd failed");
797 // It was neither a 'PATIENT', nor a 'STUDY', nor a 'SERIE',
798 // nor an 'IMAGE' SQItem. Skip to next item.
799 gdcmWarningMacro( " -------------------------------------------"
800 << "a non PATIENT/STUDY/SERIE/IMAGE SQItem was found : "
803 // FIXME : deal with other item types !
804 tmpSI=s->GetNextSQItem(); // To avoid infinite loop
808 MoveSQItem(si,tmpSI);
810 tmpSI=s->GetNextSQItem();
816 * \brief AddPatientToEnd
817 * @param dd SQ Item to enqueue to the DicomPatient chained List
819 bool DicomDir::AddPatientToEnd(DicomDirPatient *dd)
821 Patients.push_back(dd);
826 * \brief AddStudyToEnd
827 * @param dd SQ Item to enqueue to the DicomDirStudy chained List
829 bool DicomDir::AddStudyToEnd(DicomDirStudy *dd)
831 if ( Patients.size() > 0 )
833 ListDicomDirPatient::iterator itp = Patients.end();
835 (*itp)->AddStudy(dd);
842 * \brief AddSerieToEnd
843 * @param dd SQ Item to enqueue to the DicomDirSerie chained List
845 bool DicomDir::AddSerieToEnd(DicomDirSerie *dd)
847 if ( Patients.size() > 0 )
849 ListDicomDirPatient::iterator itp = Patients.end();
852 DicomDirStudy *study = (*itp)->GetLastStudy();
863 * \brief AddImageToEnd
864 * @param dd SQ Item to enqueue to the DicomDirImage chained List
866 bool DicomDir::AddImageToEnd(DicomDirImage *dd)
868 if ( Patients.size() > 0 )
870 ListDicomDirPatient::iterator itp = Patients.end();
873 DicomDirStudy *study = (*itp)->GetLastStudy();
876 DicomDirSerie *serie = study->GetLastSerie();
888 * \brief for each Header of the chained list,
889 * add/update the Patient/Study/Serie/Image info
890 * @param path path of the root directory
891 * @param list chained list of Headers
893 void DicomDir::SetElements(std::string const &path, VectDocument const &list)
898 std::string patPrevName = "", patPrevID = "";
899 std::string studPrevInstanceUID = "", studPrevID = "";
900 std::string serPrevInstanceUID = "", serPrevID = "";
902 std::string patCurName, patCurID;
903 std::string studCurInstanceUID, studCurID;
904 std::string serCurInstanceUID, serCurID;
907 for( VectDocument::const_iterator it = list.begin();
911 // get the current file characteristics
912 patCurName = (*it)->GetEntryValue(0x0010,0x0010);
913 patCurID = (*it)->GetEntryValue(0x0010,0x0011);
914 studCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000d);
915 studCurID = (*it)->GetEntryValue(0x0020,0x0010);
916 serCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000e);
917 serCurID = (*it)->GetEntryValue(0x0020,0x0011);
919 if ( patCurName != patPrevName || patCurID != patPrevID || first )
921 SetElement(path, GDCM_DICOMDIR_PATIENT, *it);
925 // if new Study, deal with 'STUDY' Elements
926 if ( studCurInstanceUID != studPrevInstanceUID || studCurID != studPrevID
929 SetElement(path, GDCM_DICOMDIR_STUDY, *it);
933 // if new Serie, deal with 'SERIE' Elements
934 if ( serCurInstanceUID != serPrevInstanceUID || serCurID != serPrevID
937 SetElement(path, GDCM_DICOMDIR_SERIE, *it);
940 // Always Deal with 'IMAGE' Elements
941 SetElement(path, GDCM_DICOMDIR_IMAGE, *it);
943 patPrevName = patCurName;
944 patPrevID = patCurID;
945 studPrevInstanceUID = studCurInstanceUID;
946 studPrevID = studCurID;
947 serPrevInstanceUID = serCurInstanceUID;
948 serPrevID = serCurID;
954 * \brief adds to the HTable
955 * the Entries (Dicom Elements) corresponding to the given type
956 * @param path full path file name (only used when type = GDCM_DICOMDIR_IMAGE
957 * @param type DicomDirObject type to create (GDCM_DICOMDIR_PATIENT,
958 * GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
959 * @param header Header of the current file
961 void DicomDir::SetElement(std::string const &path, DicomDirType type,
964 ListDicomDirElem elemList;
965 ListDicomDirElem::const_iterator it;
966 uint16_t tmpGr, tmpEl;
967 DictEntry *dictEntry;
974 case GDCM_DICOMDIR_IMAGE:
975 elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
976 si = new DicomDirImage(true);
977 if ( !AddImageToEnd(static_cast<DicomDirImage *>(si)) )
980 gdcmErrorMacro( "Add ImageToEnd failed");
983 case GDCM_DICOMDIR_SERIE:
984 elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
985 si = new DicomDirSerie(true);
986 if ( !AddSerieToEnd(static_cast<DicomDirSerie *>(si)) )
989 gdcmErrorMacro( "Add SerieToEnd failed");
992 case GDCM_DICOMDIR_STUDY:
993 elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
994 si = new DicomDirStudy(true);
995 if ( !AddStudyToEnd(static_cast<DicomDirStudy *>(si)) )
998 gdcmErrorMacro( "Add StudyToEnd failed");
1001 case GDCM_DICOMDIR_PATIENT:
1002 elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
1003 si = new DicomDirPatient(true);
1004 if ( !AddPatientToEnd(static_cast<DicomDirPatient *>(si)) )
1007 gdcmErrorMacro( "Add PatientToEnd failed");
1010 case GDCM_DICOMDIR_META:
1011 elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements();
1012 si = new DicomDirMeta(true);
1016 gdcmErrorMacro( "MetaElements already exist, they will be destroyed");
1018 MetaElems = static_cast<DicomDirMeta *>(si);
1023 // removed all the seems-to-be-useless stuff about Referenced Image Sequence
1024 // to avoid further troubles
1025 // imageElem 0008 1140 "" // Referenced Image Sequence
1026 // imageElem fffe e000 "" // 'no length' item : length to be set to 0xffffffff later
1027 // imageElem 0008 1150 "" // Referenced SOP Class UID : to be set/forged later
1028 // imageElem 0008 1155 "" // Referenced SOP Instance UID : to be set/forged later
1029 // imageElem fffe e00d "" // Item delimitation : length to be set to ZERO later
1031 // FIXME : troubles found when it's a SeqEntry
1033 // for all the relevant elements found in their own spot of the DicomDir.dic
1034 for( it = elemList.begin(); it != elemList.end(); ++it)
1038 dictEntry = GetPubDict()->GetEntry(tmpGr, tmpEl);
1040 entry = new ValEntry( dictEntry ); // Be sure it's never a BinEntry !
1042 entry->SetOffset(0); // just to avoid further missprinting
1046 // NULL when we Build Up (ex nihilo) a DICOMDIR
1047 // or when we add the META elems
1048 val = header->GetEntryValue(tmpGr, tmpEl);
1055 if ( val == GDCM_UNFOUND)
1057 if ( tmpGr == 0x0004 && tmpEl == 0x1130 ) // File-set ID
1059 // force to the *end* File Name
1060 val = Util::GetName( path );
1062 else if ( tmpGr == 0x0004 && tmpEl == 0x1500 ) // Only used for image
1064 if ( header->GetFileName().substr(0, path.length()) != path )
1066 gdcmWarningMacro( "The base path of file name is incorrect");
1067 val = header->GetFileName();
1071 val = &(header->GetFileName().c_str()[path.length()]);
1081 if ( header->GetEntryLength(tmpGr,tmpEl) == 0 )
1085 entry->SetValue( val ); // troubles expected when vr=SQ ...
1087 if ( type == GDCM_DICOMDIR_META ) // fusible : should never print !
1089 gdcmWarningMacro("GDCM_DICOMDIR_META ?!? should never print that");
1091 si->AddEntry(entry);
1096 * \brief Move the content of the source SQItem to the destination SQItem
1097 * Only DocEntry's are moved
1098 * @param dst destination SQItem
1099 * @param src source SQItem
1101 void DicomDir::MoveSQItem(DocEntrySet *dst,DocEntrySet *src)
1105 entry = src->GetFirstEntry();
1108 src->RemoveEntryNoDestroy(entry);
1109 dst->AddEntry(entry);
1110 // we destroyed -> the current iterator is not longer valid
1111 entry = src->GetFirstEntry();
1116 * \brief compares two files
1118 bool DicomDir::HeaderLessThan(Document *header1, Document *header2)
1120 return *header1 < *header2;
1123 //-----------------------------------------------------------------------------
1126 * \brief Canonical Printer
1127 * @param os ostream we want to print in
1128 * @param indent Indentation string to be prepended during printing
1130 void DicomDir::Print(std::ostream &os, std::string const & )
1134 MetaElems->SetPrintLevel(PrintLevel);
1135 MetaElems->Print(os);
1137 for(ListDicomDirPatient::iterator cc = Patients.begin();
1138 cc != Patients.end();
1141 (*cc)->SetPrintLevel(PrintLevel);
1146 //-----------------------------------------------------------------------------
1147 } // end namespace gdcm