2 //-----------------------------------------------------------------------------
14 #include "gdcmDicomDir.h"
15 #include "gdcmDicomDirStudy.h"
16 #include "gdcmDicomDirSerie.h"
17 #include "gdcmDicomDirImage.h"
18 #include "gdcmDirList.h"
20 #include "gdcmDebug.h"
21 #include "gdcmGlobal.h"
23 #include "gdcmSeqEntry.h"
24 #include "gdcmSQItem.h"
25 #include "gdcmValEntry.h"
27 //-----------------------------------------------------------------------------
28 // For full DICOMDIR description, see:
29 // PS 3.3-2003, pages 731-750
30 //-----------------------------------------------------------------------------
33 // Constructor / Destructor
36 * \brief Constructor Parses recursively the directory and creates the DicomDir
37 * or uses an already built DICOMDIR, depending on 'parseDir' value.
38 * @param FileName name
39 * - of the root directory (parseDir = true)
40 * - of the DICOMDIR (parseDir = false)
41 * @param parseDir boolean
42 * - true if user passed an entry point
43 * and wants to explore recursively the directories
44 * - false if user passed an already built DICOMDIR file
46 * @param exception_on_error whether we want to throw an exception or not
48 gdcmDicomDir::gdcmDicomDir(const char *FileName, bool parseDir,
49 bool exception_on_error):
50 gdcmDocument(FileName,exception_on_error,true) // true : enable SeQuences
52 // que l'on ai passe un root directory ou un DICOMDIR
53 // et quelle que soit la valeur de parseDir,
54 // on a lance gdcmDocument
59 startMethodArgDelete= NULL;
60 progressMethodArgDelete=NULL;
61 endMethodArgDelete= NULL;
71 // gdcmDocument already executed
72 // if user passed a root directory, sure we didn't get anything
74 if( GetEntry().begin()==GetEntry().end() )
76 // if parseDir == false, it should be tagged as an error
77 dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry HT empty");
79 if(strlen(FileName)==1 && FileName[0]=='.') { // user passed '.' as Name
80 // we get current directory name
81 char* dummy= new char[1000];
82 getcwd(dummy, (size_t)1000);
83 SetFileName(dummy); // will be converted into a string
84 delete[] dummy; // no longer needed
89 dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : Parse directory"
90 " and create the DicomDir");
95 gdcmDocEntry *e = GetDocEntryByNumber(0x0004, 0x1220); // Directory record sequence
97 dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : NO Directory record sequence (0x0004,0x1220)"
99 // FIXME : what to do when the parsed file IS NOT a DICOMDIR file ?
106 * \ingroup gdcmDicomDir
107 * \brief Constructor : creates an empty gdcmDicomDir
108 * @param exception_on_error whether we want to throw an exception or not
110 gdcmDicomDir::gdcmDicomDir(bool exception_on_error):
111 gdcmDocument(exception_on_error)
114 progressMethod= NULL;
116 startMethodArgDelete= NULL;
117 progressMethodArgDelete=NULL;
118 endMethodArgDelete= NULL;
125 std::string pathBidon = ""; // Sorry, NULL not allowed ...
126 SetElement(pathBidon, GDCM_DICOMDIR_META, NULL); // Set the META elements
133 * \ingroup gdcmDicomDir
134 * \brief Canonical destructor
136 gdcmDicomDir::~gdcmDicomDir()
138 SetStartMethod(NULL);
139 SetProgressMethod(NULL);
145 for(ListDicomDirPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
151 //-----------------------------------------------------------------------------
154 * \ingroup gdcmDicomDir
155 * \brief Canonical Printer
157 void gdcmDicomDir::Print(std::ostream &os)
161 metaElems->SetPrintLevel(printLevel);
162 metaElems->Print(os);
164 for(ListDicomDirPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
166 (*cc)->SetPrintLevel(printLevel);
171 //-----------------------------------------------------------------------------
174 * \ingroup gdcmDicomDir
175 * \brief This predicate, based on hopefully reasonable heuristics,
176 * decides whether or not the current header was properly parsed
177 * and contains the mandatory information for being considered as
178 * a well formed and usable DicomDir.
179 * @return true when gdcmDocument is the one of a reasonable DicomDir,
182 bool gdcmDicomDir::IsReadable(void)
184 if(!gdcmDocument::IsReadable())
188 if(patients.size()<=0)
195 * \ingroup gdcmDicomDir
196 * \brief fills the whole structure, starting from a root Directory
198 void gdcmDicomDir::ParseDirectory(void)
200 CreateDicomDirChainedList(GetFileName());
205 * \ingroup gdcmDicomDir
206 * \brief Set the start method to call when the parsing of the directory starts
207 * @param method Method to call
208 * @param arg Argument to pass to the method
209 * @param argDelete Argument
210 * \warning In python : the arg parameter isn't considered
212 void gdcmDicomDir::SetStartMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
214 if((startArg)&&(startMethodArgDelete))
215 startMethodArgDelete(startArg);
219 startMethodArgDelete=argDelete;
223 * \ingroup gdcmDicomDir
224 * \brief Set the method to delete the argument
225 * The argument is destroyed when the method is changed or when the
227 * @param method Method to call to delete the argument
229 void gdcmDicomDir::SetStartMethodArgDelete(gdcmMethod *method)
231 startMethodArgDelete=method;
235 * \ingroup gdcmDicomDir
236 * \brief Set the progress method to call when the parsing of the directory progress
237 * @param method Method to call
238 * @param arg Argument to pass to the method
239 * @param argDelete Argument
240 * \warning In python : the arg parameter isn't considered
242 void gdcmDicomDir::SetProgressMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
244 if((progressArg)&&(progressMethodArgDelete))
245 progressMethodArgDelete(progressArg);
247 progressMethod=method;
249 progressMethodArgDelete=argDelete;
253 * \ingroup gdcmDicomDir
254 * \brief Set the method to delete the argument
255 * The argument is destroyed when the method is changed or when the
257 * @param method Method to call to delete the argument
259 void gdcmDicomDir::SetProgressMethodArgDelete(gdcmMethod *method)
261 progressMethodArgDelete=method;
265 * \ingroup gdcmDicomDir
266 * \brief Set the end method to call when the parsing of the directory ends
267 * @param method Method to call
268 * @param arg Argument to pass to the method
269 * @param argDelete Argument
270 * \warning In python : the arg parameter isn't considered
272 void gdcmDicomDir::SetEndMethod(gdcmMethod *method, void *arg, gdcmMethod *argDelete)
274 if((endArg)&&(endMethodArgDelete))
275 endMethodArgDelete(endArg);
279 endMethodArgDelete=argDelete;
283 * \ingroup gdcmDicomDir
284 * \brief Set the method to delete the argument
285 * The argument is destroyed when the method is changed or when the class
287 * @param method Method to call to delete the argument
289 void gdcmDicomDir::SetEndMethodArgDelete(gdcmMethod *method)
291 endMethodArgDelete=method;
295 * \ingroup gdcmDicomDir
296 * \brief writes on disc a DICOMDIR
297 * \ warning does NOT add the missing elements in the header :
298 * it's up to the user doing it !
299 * \todo : to be re-written using the DICOMDIR tree-like structure
300 * *not* the chained list
301 * (does NOT exist if the DICOMDIR is user-forged !)
302 * @param fileName file to be written to
303 * @return false only when fail to open
306 bool gdcmDicomDir::Write(std::string fileName)
310 fp1=fopen(fileName.c_str(),"wb");
313 printf("Failed to open(write) File [%s] \n",fileName.c_str());
317 char * filePreamble = new char[128];
318 fwrite(filePreamble,128,1,fp1);
319 fwrite("DICM",4,1,fp1);
320 delete[] filePreamble;
321 UpdateDirectoryRecordSequenceLength();
329 * \brief Writes in a file using the tree-like structure.
330 * @param _fp already open file pointer
333 void gdcmDicomDir::WriteEntries(FILE *_fp)
335 /// \todo (?) tester les echecs en ecriture
336 /// (apres chaque fwrite, dans le WriteEntry)
339 /* TODO : to go on compiling
341 gdcmDicomDirMeta *ptrMeta;
342 ListDicomDirPatient::iterator itPatient;
343 ListDicomDirStudy::iterator itStudy;
344 ListDicomDirSerie::iterator itSerie;
345 ListDicomDirImage::iterator itImage;
348 ptrMeta= GetDicomDirMeta();
349 for(i=ptrMeta->debut();i!=ptrMeta->fin();++i) {
350 WriteEntry(*i,_fp, gdcmExplicitVR);
353 itPatient = GetDicomDirPatients().begin();
354 while ( itPatient != GetDicomDirPatients().end() ) {
355 for(i=(*itPatient)->debut();i!=(*itPatient)->fin();++i) {
356 WriteEntry(*i,_fp, gdcmExplicitVR);
358 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
359 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) {
360 for(i=(*itStudy)->debut();i!=(*itStudy)->fin();++i) {
361 WriteEntry(*i,_fp, gdcmExplicitVR);
363 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
364 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) {
365 for(i=(*itSerie)->debut();i!=(*itSerie)->fin();++i) {
366 WriteEntry(*i,_fp, gdcmExplicitVR);
368 itImage = ((*itSerie)->GetDicomDirImages()).begin();
369 while (itImage != (*itSerie)->GetDicomDirImages().end() ) {
370 for(i=(*itImage)->debut();i!=(*itImage)->fin();++i) {
371 WriteEntry(*i,_fp, gdcmExplicitVR);
384 //-----------------------------------------------------------------------------
388 * \ingroup gdcmDicomDir
389 * \brief create a gdcmDocument-like chained list from a root Directory
390 * @param path entry point of the tree-like structure
392 void gdcmDicomDir::CreateDicomDirChainedList(std::string path)
396 gdcmDirList fileList(path,1); // gets recursively the file list
397 unsigned int count=0;
404 for(gdcmDirList::iterator it=fileList.begin();
408 progress=(float)(count+1)/(float)fileList.size();
409 CallProgressMethod();
413 header=new gdcmHeader(it->c_str());
414 if(header->IsReadable())
415 list.push_back(header); // adds the file header to the chained list
421 // sorts Patient/Study/Serie/
422 std::sort(list.begin(),list.end(),gdcmDicomDir::HeaderLessThan);
424 std::string tmp=fileList.GetDirName();
426 //for each Header of the chained list, add/update the Patient/Study/Serie/Image info
427 SetElements(tmp,list);
433 * \ingroup gdcmDicomDir
434 * \brief adds *the* Meta to a partially created DICOMDIR
437 // FIXME : Heuuuuu ! Il prend les Entries du Document deja parse,
438 // il ne fabrique rien !
440 gdcmDicomDirMeta * gdcmDicomDir::NewMeta(void) {
441 gdcmDicomDirMeta *m = new gdcmDicomDirMeta(&tagHT);
442 for (TagDocEntryHT::iterator cc = tagHT.begin();cc != tagHT.end();++cc) {
443 m->AddDocEntry(cc->second);
450 * \ingroup gdcmDicomDir
451 * \brief adds a new Patient (with the basic elements) to a partially created DICOMDIR
453 gdcmDicomDirPatient * gdcmDicomDir::NewPatient(void) {
454 std::list<gdcmElement> elemList;
455 std::list<gdcmElement>::iterator it;
457 gdcmDictEntry *dictEntry;
460 gdcmSQItem *s = new gdcmSQItem(0);
462 elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
464 // TODO : use FillObject !!!
466 // for all the DicomDirPatient Elements
468 for(it=elemList.begin();it!=elemList.end();++it)
472 dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
473 entry=new gdcmValEntry(dictEntry);
474 entry->SetOffset(0); // just to avoid further missprinting
475 entry->SetValue(it->value);
477 // dealing with value length ...
479 if(dictEntry->GetGroup()==0xfffe)
481 entry->SetLength(entry->GetValue().length());
483 else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
487 else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") )
491 else if(dictEntry->GetVR()=="SQ")
493 entry->SetLength(0xffffffff);
497 entry->SetLength(entry->GetValue().length());
499 s->AddDocEntry(entry);
502 gdcmDicomDirPatient *p = new gdcmDicomDirPatient(s, &tagHT);
503 patients.push_front(p);
509 * \ingroup gdcmDicomDir
510 * \brief adds to the HTable
511 * the gdcmEntries (Dicom Elements) corresponding to the given type
512 * @param path full path file name (only used when type = GDCM_DICOMDIR_IMAGE
513 * @param type gdcmObject type to create (GDCM_DICOMDIR_PATIENT, GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
514 * @param header gdcmHeader of the current file
516 void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header)
518 std::list<gdcmElement> elemList;
519 std::list<gdcmElement>::iterator it;
520 guint16 tmpGr, tmpEl;
521 gdcmDictEntry *dictEntry;
527 case GDCM_DICOMDIR_PATIENT:
528 elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
530 case GDCM_DICOMDIR_STUDY:
531 elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
533 case GDCM_DICOMDIR_SERIE:
534 elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();
536 case GDCM_DICOMDIR_IMAGE:
537 elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
539 case GDCM_DICOMDIR_META:
540 elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirMetaElements();
546 for(it=elemList.begin();it!=elemList.end();++it)
550 dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
551 entry=new gdcmDocEntry(dictEntry);
552 entry->SetOffset(0); // just to avoid further missprinting
555 val=header->GetEntryByNumber(tmpGr,tmpEl);
559 if(val==GDCM_UNFOUND)
561 if((tmpGr==0x0004) &&(tmpEl==0x1130) ) // File-set ID
563 // force to the *end* File Name
566 else if( (tmpGr==0x0004) && (tmpEl==0x1500) ) // Only used for image
568 if(header->GetFileName().substr(0,path.length())!=path)
570 dbg.Verbose(0, "gdcmDicomDir::SetElement : the base path of file name is incorrect");
571 val=header->GetFileName();
574 val=&(header->GetFileName().c_str()[path.length()]);
584 if (header->GetEntryLengthByNumber(tmpGr,tmpEl)== 0)
588 ((gdcmValEntry *)entry)->SetValue(val);
592 if(dictEntry->GetGroup()==0xfffe)
594 entry->SetLength(((gdcmValEntry *)entry)->GetValue().length());
596 else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
600 else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") )
604 else if(dictEntry->GetVR()=="SQ")
606 entry->SetLength(0xffffffff);
610 entry->SetLength(((gdcmValEntry *)entry)->GetValue().length());
613 //AddDocEntry(entry); // both in H Table and in chained list
614 tagHT[entry->GetKey()] = entry; // FIXME : use a SEQUENCE !
618 * \ingroup gdcmDicomDir
619 * \brief CallStartMethod
621 void gdcmDicomDir::CallStartMethod(void)
626 startMethod(startArg);
629 * \ingroup gdcmDicomDir
630 * \brief CallProgressMethod
632 void gdcmDicomDir::CallProgressMethod(void)
635 progressMethod(progressArg);
638 * \ingroup gdcmDicomDir
639 * \brief CallEndMethod
641 void gdcmDicomDir::CallEndMethod(void)
648 //-----------------------------------------------------------------------------
651 * \ingroup gdcmDicomDir
652 * \brief create a 'gdcmDicomDir' from a DICOMDIR gdcmHeader
654 void gdcmDicomDir::CreateDicomDir()
656 // The list is parsed.
657 // When a DicomDir tag ("PATIENT", "STUDY", "SERIE", "IMAGE") is found :
658 // 1 - we save the beginning iterator
659 // 2 - we continue to parse
660 // 3 - we find an other tag
661 // + we create the object for the precedent tag
664 gdcmDicomDirType type=gdcmDicomDir::GDCM_DICOMDIR_META;
666 gdcmDocEntry *e = GetDocEntryByNumber(0x0004, 0x1220); // Directory record sequence
668 dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : NO Directory record sequence (0x0004,0x1220)"
670 // FIXME : what to do when the parsed file IS NOT a DICOMDIR file ?
674 gdcmDicomDirMeta *m = new gdcmDicomDirMeta(&tagHT);
676 gdcmSeqEntry *s = (gdcmSeqEntry *)e; // FIXME : It is allowed ???
677 ListSQItem listItems = s->GetSQItems();
680 for(ListSQItem::iterator i=listItems.begin(); i !=listItems.end();++i)
682 d=(*i)->GetDocEntryByNumber(0x0004, 0x1430); // Directory Record Type
683 std::string v=((gdcmValEntry *)d)->GetValue();
687 AddDicomDirPatientToEnd(*i);
688 //AddObjectToEnd(type,*i);
689 type=gdcmDicomDir::GDCM_DICOMDIR_PATIENT;
694 AddDicomDirStudyToEnd(*i);
695 // AddObjectToEnd(type,*i);
696 type=gdcmDicomDir::GDCM_DICOMDIR_STUDY;
701 AddDicomDirSerieToEnd(*i);
702 // AddObjectToEnd(type,*i);
703 type=gdcmDicomDir::GDCM_DICOMDIR_SERIE;
708 AddDicomDirImageToEnd(*i);
709 // AddObjectToEnd(type,*i);
710 type=gdcmDicomDir::GDCM_DICOMDIR_IMAGE;
714 continue ; // It was 'non PATIENT', 'non STUDY', 'non SERIE', 'non IMAGE' SQItem
718 * \ingroup gdcmDicomDir
719 * \brief AddObjectToEnd
721 * @param begin iterator on the first DocEntry within the chained List
722 * @param end iterator on the last DocEntry within the chained List
727 /*void gdcmDicomDir::AddObjectToEnd(gdcmDicomDirType type,gdcmSQItem *s)
734 case gdcmDicomDir::GDCM_DICOMDIR_META:
737 case gdcmDicomDir::GDCM_DICOMDIR_PATIENT:
738 AddDicomDirPatientToEnd(s);
740 case gdcmDicomDir::GDCM_DICOMDIR_STUDY:
741 AddDicomDirStudyToEnd(s);
743 case gdcmDicomDir::GDCM_DICOMDIR_SERIE:
744 AddDicomDirSerieToEnd(s);
746 case gdcmDicomDir::GDCM_DICOMDIR_IMAGE:
747 AddDicomDirImageToEnd(s);
749 case gdcmDicomDir::GDCM_DICOMDIR_NONE:
750 AddDicomDirImageToEnd(s); //FIXME
758 * \ingroup gdcmDicomDir
759 * \brief Well ... there is only one occurence
761 void gdcmDicomDir::AddDicomDirMeta()
765 metaElems = new gdcmDicomDirMeta(&tagHT);
769 * \ingroup gdcmDicomDir
770 * \brief AddDicomDirPatientToEnd
771 * @param s SQ Item to enqueue to the DicomPatient chained List
773 void gdcmDicomDir::AddDicomDirPatientToEnd(gdcmSQItem *s)
775 patients.push_back(new gdcmDicomDirPatient(s, &tagHT));
779 * \ingroup gdcmDicomDir
780 * \brief AddDicomDirStudyToEnd
781 * @param s SQ Item to enqueue to the DicomDirStudy chained List
783 void gdcmDicomDir::AddDicomDirStudyToEnd(gdcmSQItem *s)
785 if(patients.size()>0)
787 ListDicomDirPatient::iterator itp=patients.end();
789 (*itp)->AddDicomDirStudy(new gdcmDicomDirStudy(s, &tagHT));
793 * \ingroup gdcmDicomDir
794 * \brief AddDicomDirSerieToEnd
795 * @param s SQ Item to enqueue to the DicomDirSerie chained List
797 void gdcmDicomDir::AddDicomDirSerieToEnd(gdcmSQItem *s)
799 if(patients.size()>0)
801 ListDicomDirPatient::iterator itp=patients.end();
804 if((*itp)->GetDicomDirStudies().size()>0)
806 ListDicomDirStudy::iterator itst=(*itp)->GetDicomDirStudies().end();
808 (*itst)->AddDicomDirSerie(new gdcmDicomDirSerie(s, &tagHT));
814 * \ingroup gdcmDicomDir
815 * \brief AddDicomDirImageToEnd
816 * @param s SQ Item to enqueue to the DicomDirImage chained List
818 void gdcmDicomDir::AddDicomDirImageToEnd(gdcmSQItem *s)
820 if(patients.size()>0)
822 ListDicomDirPatient::iterator itp=patients.end();
825 if((*itp)->GetDicomDirStudies().size()>0)
827 ListDicomDirStudy::iterator itst=(*itp)->GetDicomDirStudies().end();
830 if((*itst)->GetDicomDirSeries().size()>0)
832 ListDicomDirSerie::iterator its=(*itst)->GetDicomDirSeries().end();
834 (*its)->AddDicomDirImage(new gdcmDicomDirImage(s, &tagHT));
841 * \ingroup gdcmDicomDir
842 * \brief for each Header of the chained list, add/update the Patient/Study/Serie/Image info
843 * @param path path of the root directory
844 * @param list chained list of Headers
846 void gdcmDicomDir::SetElements(std::string &path, ListHeader &list)
848 std::string patPrevName="", patPrevID="";
849 std::string studPrevInstanceUID="", studPrevID="";
850 std::string serPrevInstanceUID="", serPrevID="";
852 std::string patCurName, patCurID;
853 std::string studCurInstanceUID, studCurID;
854 std::string serCurInstanceUID, serCurID;
856 SetElement(path,GDCM_DICOMDIR_META,NULL);
858 for(ListHeader::iterator it=list.begin();it!=list.end();++it)
860 // get the current file characteristics
861 patCurName= (*it)->GetEntryByNumber(0x0010,0x0010);
862 patCurID= (*it)->GetEntryByNumber(0x0010,0x0011);
863 studCurInstanceUID=(*it)->GetEntryByNumber(0x0020,0x000d);
864 studCurID= (*it)->GetEntryByNumber(0x0020,0x0010);
865 serCurInstanceUID= (*it)->GetEntryByNumber(0x0020,0x000e);
866 serCurID= (*it)->GetEntryByNumber(0x0020,0x0011);
868 if(patCurName!=patPrevName || patCurID!=patPrevID)
869 SetElement(path,GDCM_DICOMDIR_PATIENT,*it);
871 // if new Study Deal with 'STUDY' Elements
872 if(studCurInstanceUID!=studPrevInstanceUID || studCurID!=studPrevID)
873 SetElement(path,GDCM_DICOMDIR_STUDY,*it);
875 // if new Serie Deal with 'SERIE' Elements
876 if(serCurInstanceUID!=serPrevInstanceUID || serCurID!=serPrevID)
877 SetElement(path,GDCM_DICOMDIR_SERIE,*it);
879 // Always Deal with 'IMAGE' Elements
880 SetElement(path,GDCM_DICOMDIR_IMAGE,*it);
882 patPrevName= patCurName;
884 studPrevInstanceUID=studCurInstanceUID;
885 studPrevID= studCurID;
886 serPrevInstanceUID= serCurInstanceUID;
892 * \ingroup gdcmDicomDir
893 * \brief compares two dgcmHeaders
895 bool gdcmDicomDir::HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2)
897 return(*header1<*header2);
901 * \ingroup gdcmDicomDir
902 * \brief Sets the accurate value for the (0x0004,0x1220) element of a DICOMDIR
905 void gdcmDicomDir::UpdateDirectoryRecordSequenceLength() {
907 // FIXME : to go on compiling
909 // to be re written !
912 ListTag::iterator it;
915 for(it=listEntries.begin();it!=listEntries.end();++it) {
916 gr = (*it)->GetGroup();
917 el = (*it)->GetElement();
920 if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") ) {
921 offset += 4; // explicit VR AND OB, OW, SQ : 4 more bytes
923 offset += 2 + 2 + 4 + (*it)->GetLength();
925 offset += 4; // delimiters don't have a value.
928 //bool res=SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps.
929 SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps.
934 //-----------------------------------------------------------------------------