2 //-----------------------------------------------------------------------------
3 #include "gdcmDicomDir.h"
4 #include "gdcmPatient.h"
11 gdcmDicomDir::gdcmDicomDir(std::string & FileName,
12 bool exception_on_error):
13 gdcmParser(FileName.c_str(),exception_on_error, true ) {
21 ListTag::iterator i, j;
24 if ( GetListEntry().begin() == GetListEntry().end() ) {
25 cout << "ListEntry vide " << endl;
28 i = GetListEntry().begin();
29 while ( i != GetListEntry().end() ) {
31 // std::cout << std::hex << (*i)->GetGroup() <<
32 // " " << (*i)->GetElement() << endl;
34 std::string v = (*i)->GetValue();
35 if (v == "PATIENT ") {
36 patCur=new gdcmPatient();
37 //cout << "PATIENT" << endl,
39 GetPatients().push_back(patCur);
43 //cout << "STUDY" << endl,
44 studCur=new gdcmStudy();
45 studCur->beginObj = patCur->endObj = i;
46 lPatient::iterator aa = GetPatients().end();
48 (*aa)->GetStudies().push_back(studCur);
50 studCur=new gdcmStudy();
53 //cout << "SERIES" << endl,
54 serCur=new gdcmSerie();
56 serCur->beginObj = studCur->endObj= i;
57 lPatient::iterator aa = GetPatients().end();
59 lStudy::iterator bb = (*aa)->GetStudies().end();
61 (*bb)->GetSeries().push_back(serCur);
65 //cout << "IMAGE" << endl;
66 imaCur=new gdcmImage();
67 imaCur->beginObj = serCur->endObj= i;
69 lPatient::iterator aa = GetPatients().end();
71 lStudy::iterator bb = (*aa)->GetStudies().end();
73 lSerie::iterator cc = (*bb)->GetSeries().end();
75 (*cc)->GetImages().push_back(imaCur);
79 // ce n'est pas sur une nouvelle IMAGE, qu'il faut intervenir
80 // mais lorsqu'on rencontre un 'non IMAGE' apres des 'IMAGE'
81 lImage::iterator dd = (*cc)->GetImages().end();
83 if ( (*cc)->GetImages().begin() != dd ) {
94 gdcmDicomDir::~gdcmDicomDir() {
95 lPatient::iterator cc = GetPatients().begin();
96 while (cc != GetPatients().end() ) {
97 //cout << "delete PATIENT" << endl;