X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestSerieHelper.cxx;h=81de64be068840d1146b5bdcadc461a68fd6ec00;hb=HEAD;hp=02f06f8e9e8e789bc11e6e939f95e0992f4c00a6;hpb=03b9fc60cf713591d7c211db3998b7eb4fa5e36a;p=gdcm.git diff --git a/Testing/TestSerieHelper.cxx b/Testing/TestSerieHelper.cxx index 02f06f8e..81de64be 100644 --- a/Testing/TestSerieHelper.cxx +++ b/Testing/TestSerieHelper.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestSerieHelper.cxx,v $ Language: C++ - Date: $Date: 2005/05/26 18:50:45 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/09/15 15:49:21 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,7 +22,7 @@ int TestSerieHelper(int argc, char *argv[]) { - gdcm::SerieHelper *s; + GDCM_NAME_SPACE::SerieHelper *s; std::string dirName; if (argc > 1) @@ -33,22 +33,26 @@ int TestSerieHelper(int argc, char *argv[]) } //if (argc > 2) - // gdcm::Debug::DebugOn(); + // GDCM_NAME_SPACE::Debug::DebugOn(); - std::cout << "Dir Name :[" << dirName << "]" << std::endl; + + std::cout << "-------------- Dir Name :[" << dirName << "]" << std::endl; - s = new gdcm::SerieHelper(); - s->SetDirectory(dirName, true); // true : recursive exploration - std::cout << " -------------------------------------------Finish parsing :[" + s = GDCM_NAME_SPACE::SerieHelper::New(); + s->SetLoadMode(GDCM_NAME_SPACE::LD_ALL); // Load everything for each File + //s->AddRestriction(tagKey, valueToCheck); // Keep only files where + // restriction is true + s->SetDirectory(dirName, true); // true : recursive exploration + std::cout << " ---------------------------------------- Finish parsing :[" << dirName << "]" << std::endl; s->Print(); - std::cout << " -----------------------------------------Finish printing (1)" + std::cout << " ---------------------------------------- Finish printing (1)" << std::endl; int nbFiles; - // For all the Coherent Files lists of the gdcm::Serie - gdcm::FileList *l = s->GetFirstCoherentFileList(); + // For all the SingleSerieUID filesets of the GDCM_NAME_SPACE::Serie + GDCM_NAME_SPACE::FileList *l = s->GetFirstSingleSerieUIDFileSet(); while (l) { nbFiles = l->size() ; @@ -57,15 +61,33 @@ int TestSerieHelper(int argc, char *argv[]) std::cout << "Sort list : " << nbFiles << " long" << std::endl; s->OrderFileList(l); // sort the list } - l = s->GetNextCoherentFileList(); + l = s->GetNextSingleSerieUIDFileSet(); } - std::cout << " ----------------------------------------------Finish sorting" + std::cout << " -------------------------------------------- Finish sorting" << std::endl; - s->Print(); // Prints all the Coherent Files lists (sorted or not) - std::cout << " ---------------------------------------------Finish printing" + s->Print(); // Prints all the SingleSerieUID filesets (sorted or not) + std::cout << " -------------------------------------------- Finish printing" << std::endl; - delete s; + + // Only for the first SingleSerieUID fileset + // ( Why not ? Just an example, for testing ) + // Display all the file names + + std::string fileName; + l = s->GetFirstSingleSerieUIDFileSet(); + for (std::vector::iterator it = l->begin(); + it != l->end(); + ++it) + { + fileName = (*it)->GetFileName(); + std::cout << fileName << std::endl; + // Remark : vtkGdcmReader users can use this loop to AddFileName(fileName) + // in the right order + } + + + s->Delete(); return 0; }