From: jpr Date: Tue, 18 Jan 2005 07:55:16 +0000 (+0000) Subject: Use new method GetFirstEntry instead of InitTraversal+GetNextEntry X-Git-Tag: Version1.0.bp~273 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=95484666ccfcdb26d6ff1ea57cb1cde7826b7a28;p=gdcm.git Use new method GetFirstEntry instead of InitTraversal+GetNextEntry --- diff --git a/Example/PrintDicomDir.cxx b/Example/PrintDicomDir.cxx index 3303d67b..5e589900 100644 --- a/Example/PrintDicomDir.cxx +++ b/Example/PrintDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: PrintDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/01/17 13:47:22 $ - Version: $Revision: 1.15 $ + Date: $Date: 2005/01/18 07:55:16 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -71,8 +71,7 @@ int main(int argc, char* argv[]) } // Test if the DicomDir contains any Patient - e1->InitTraversal(); - pa = e1->GetNextEntry(); + pa = e1->GetFirstEntry(); if ( pa == 0) { std::cout<<" DicomDir '"<InitTraversal(); - pa = e1->GetNextEntry(); + pa = e1->GetFirstEntry(); while (pa) { std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name @@ -106,13 +104,11 @@ int main(int argc, char* argv[]) << " = PATIENT/STUDY List =======================================" << std::endl<< std::endl; - e1->InitTraversal(); - pa = e1->GetNextEntry(); + pa = e1->GetFirstEntry(); while ( pa ) // on degouline les PATIENT de ce DICOMDIR { std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name - pa->InitTraversal(); - st = pa->GetNextEntry(); + st = pa->GetFirstEntry(); while ( st ) { // on degouline les STUDY de ce patient std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description st = pa->GetNextEntry(); @@ -126,22 +122,19 @@ int main(int argc, char* argv[]) << " = PATIENT/STUDY/SERIE List ==================================" << std::endl<< std::endl; - e1->InitTraversal(); - pa = e1->GetNextEntry(); + pa = e1->GetFirstEntry(); while ( pa ) // on degouline les PATIENT de ce DICOMDIR { // Patient's Name, Patient ID std::cout << "Pat.Name:[" << pa->GetEntry(0x0010, 0x0010) <<"]"; // Patient's Name std::cout << " Pat.ID:["; std::cout << pa->GetEntry(0x0010, 0x0020) << "]" << std::endl; // Patient ID - pa->InitTraversal(); - st = pa->GetNextEntry(); + st = pa->GetFirstEntry(); while ( st ) { // on degouline les STUDY de ce patient std::cout << "--- Stud.descr:[" << st->GetEntry(0x0008, 0x1030) << "]";// Study Description std::cout << " Stud.ID:[" << st->GetEntry(0x0020, 0x0010); // Study ID std::cout << "]" << std::endl; - st->InitTraversal(); - se = st->GetNextEntry(); + se = st->GetFirstEntry(); while ( se ) { // on degouline les SERIES de cette study std::cout << "--- --- Ser.Descr:["<< se->GetEntry(0x0008, 0x103e)<< "]"; // Series Description std::cout << " Ser.nb:[" << se->GetEntry(0x0020, 0x0011); // Series number @@ -160,23 +153,19 @@ int main(int argc, char* argv[]) << " = PATIENT/STUDY/SERIE/IMAGE List ============================" << std::endl<< std::endl; - e1->InitTraversal(); - pa = e1->GetNextEntry(); + pa = e1->GetFirstEntry(); while ( pa ) { // les PATIENT de ce DICOMDIR std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name - pa->InitTraversal(); - st = pa->GetNextEntry(); + st = pa->GetFirstEntry(); while ( st ) { // on degouline les STUDY de ce patient std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description std::cout << " Stud.ID:[" << st->GetEntry(0x0020, 0x0010); // Study ID - st->InitTraversal(); - se = st->GetNextEntry(); + se = st->GetFirstEntry(); while ( se ) { // on degouline les SERIES de cette study std::cout << "--- --- "<< se->GetEntry(0x0008, 0x103e) << std::endl; // Serie Description std::cout << " Ser.nb:[" << se->GetEntry(0x0020, 0x0011); // Series number std::cout << "] Mod.:[" << se->GetEntry(0x0008, 0x0060) << "]"; // Modality - se->InitTraversal(); - im = se->GetNextEntry(); + im = se->GetFirstEntry(); while ( im ) { // on degouline les Images de cette serie std::cout << "--- --- --- "<< im->GetEntry(0x0004, 0x1500) << std::endl; // File name im = se->GetNextEntry(); diff --git a/Example/TestCopyDicom.cxx b/Example/TestCopyDicom.cxx index bc1313cf..e7ced62b 100644 --- a/Example/TestCopyDicom.cxx +++ b/Example/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2005/01/14 11:28:28 $ - Version: $Revision: 1.16 $ + Date: $Date: 2005/01/18 07:55:16 $ + Version: $Revision: 1.17 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -99,8 +99,7 @@ int main(int argc, char* argv[]) // (the user does NOT have to know the way we implemented the Header !) // Waiting for a 'clean' solution, I keep the method ...JPRx - original->GetHeader()->InitTraversal(); - gdcm::DocEntry* d=original->GetHeader()->GetNextEntry(); + gdcm::DocEntry* d=original->GetHeader()->GetFirstEntry(); while(d) { if ( gdcm::BinEntry* b = dynamic_cast(d) ) diff --git a/Example/TestFromScratch.cxx b/Example/TestFromScratch.cxx index e9760b86..6b1ebaa0 100644 --- a/Example/TestFromScratch.cxx +++ b/Example/TestFromScratch.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestFromScratch.cxx,v $ Language: C++ - Date: $Date: 2005/01/14 11:28:28 $ - Version: $Revision: 1.8 $ + Date: $Date: 2005/01/18 07:55:16 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -42,7 +42,6 @@ int main(int argc, char *argv[]) //gdcm::Debug::GetReference().SetDebug(1); std::string filename = argv[1]; - //gdcm::File *f1 = new gdcm::File( "/home/malaterre/Creatis/gdcmData/012345.002.050.dcm" ); gdcm::File *f1 = new gdcm::File( filename ); gdcm::Header *h1 = f1->GetHeader(); @@ -55,8 +54,7 @@ int main(int argc, char *argv[]) gdcm::Header *h2 = new gdcm::Header(); // Copy of the header content - h1->InitTraversal(); - gdcm::DocEntry* d = h1->GetNextEntry(); + gdcm::DocEntry* d = h1->GetFirstEntry(); while(d) { if ( gdcm::ValEntry* v = dynamic_cast(d) ) diff --git a/Example/makeDicomDir.cxx b/Example/makeDicomDir.cxx index 73b7406b..948e24f7 100644 --- a/Example/makeDicomDir.cxx +++ b/Example/makeDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: makeDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/01/17 11:01:55 $ - Version: $Revision: 1.10 $ + Date: $Date: 2005/01/18 07:55:16 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,8 +57,7 @@ int main(int argc, char* argv[]) { dcmdir->SetStartMethod(StartMethod, (void *) NULL); dcmdir->SetEndMethod(EndMethod); - dcmdir->InitTraversal(); - if ( !dcmdir->GetNextEntry() ) + if ( !dcmdir->GetFirstEntry() ) { std::cout << "makeDicomDir: no patient list present. Exiting." << std::endl; diff --git a/Testing/TestCopyDicom.cxx b/Testing/TestCopyDicom.cxx index af7f4d45..77178d2d 100644 --- a/Testing/TestCopyDicom.cxx +++ b/Testing/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2005/01/14 11:28:29 $ - Version: $Revision: 1.29 $ + Date: $Date: 2005/01/18 07:56:21 $ + Version: $Revision: 1.30 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -85,8 +85,7 @@ int CopyDicom(std::string const & filename, //////////////// Step 2: std::cout << "2..."; - originalH->InitTraversal(); - gdcm::DocEntry* d=originalH->GetNextEntry(); + gdcm::DocEntry* d=originalH->GetFirstEntry(); while(d) { if ( gdcm::BinEntry* b = dynamic_cast(d) ) diff --git a/Testing/TestCopyRescaleDicom.cxx b/Testing/TestCopyRescaleDicom.cxx index 975d91c8..e566dda4 100644 --- a/Testing/TestCopyRescaleDicom.cxx +++ b/Testing/TestCopyRescaleDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyRescaleDicom.cxx,v $ Language: C++ - Date: $Date: 2005/01/14 11:28:29 $ - Version: $Revision: 1.5 $ + Date: $Date: 2005/01/18 07:56:21 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,8 +57,7 @@ int CopyRescaleDicom(std::string const & filename, //////////////// Step 2: std::cout << "2..."; // Copy of the header content - originalH->InitTraversal(); - gdcm::DocEntry* d = originalH->GetNextEntry(); + gdcm::DocEntry* d = originalH->GetFirstEntry(); while(d) { if ( gdcm::BinEntry* b = dynamic_cast(d) ) diff --git a/Testing/TestDicomDir.cxx b/Testing/TestDicomDir.cxx index b3d6ad38..7a70e90b 100644 --- a/Testing/TestDicomDir.cxx +++ b/Testing/TestDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/01/17 13:47:23 $ - Version: $Revision: 1.29 $ + Date: $Date: 2005/01/18 07:56:21 $ + Version: $Revision: 1.30 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -70,8 +70,7 @@ int TestDicomDir(int argc, char* argv[]) } // Test if the DicomDir contains any Patient - e1->InitTraversal(); - if( !e1->GetNextEntry() ) + if( !e1->GetFirstEntry() ) { std::cout<<" DicomDir '"<InitTraversal(); - pa = e1->GetNextEntry(); + pa = e1->GetFirstEntry(); while ( pa ) { // we process all the PATIENT of this DICOMDIR std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name - pa->InitTraversal(); - st = pa->GetNextEntry(); + st = pa->GetFirstEntry(); while ( st ) { // we process all the STUDY of this patient std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description std::cout << " Stud.ID:[" << st->GetEntry(0x0020, 0x0010); // Study ID - st->InitTraversal(); - se = st->GetNextEntry(); + se = st->GetFirstEntry(); while ( se ) { // we process all the SERIES of this study std::cout << "--- --- "<< se->GetEntry(0x0008, 0x103e) << std::endl; // Serie Description std::cout << " Ser.nb:[" << se->GetEntry(0x0020, 0x0011); // Series number std::cout << "] Mod.:[" << se->GetEntry(0x0008, 0x0060) << "]"; // Modality - se->InitTraversal(); - im = se->GetNextEntry(); + im = se->GetFirstEntry(); while ( im ) { // we process all the IMAGE of this serie std::cout << "--- --- --- "<< im->GetEntry(0x0004, 0x1500) << std::endl; // File name im = se->GetNextEntry(); diff --git a/Testing/TestDict.cxx b/Testing/TestDict.cxx index c8555686..6d5b4e20 100644 --- a/Testing/TestDict.cxx +++ b/Testing/TestDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDict.cxx,v $ Language: C++ - Date: $Date: 2005/01/17 14:18:48 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/01/18 07:56:21 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -36,8 +36,7 @@ int TestDict(int , char* []) std::cout<<"DictSet content :\n"; - dicts->InitTraversal(); - gdcm::Dict *d = dicts->GetNextEntry(); + gdcm::Dict *d = dicts->GetFirstEntry(); if (!d) { std::cout << "Dictset is empty" << std::endl; @@ -77,8 +76,7 @@ int TestDict(int , char* []) // Print all the DictEntry std::cout<<"#######################################################\n"; - pubDict->InitTraversal(); - entry=pubDict->GetNextEntry(); + entry=pubDict->GetFirstEntry(); while(entry) { entry->Print();