X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestSerieHelper.cxx;h=77bd81d4d4da819a6150b9d541abc078c4f59567;hb=41559a6f2d66bcd4af4db17a0d9668df37d19f3b;hp=3cb4356827e9aa5fac998fc61cc5aed956b0b056;hpb=96cc99e8e141ceaf026104699c3273ad5fc88a1f;p=gdcm.git diff --git a/Testing/TestSerieHelper.cxx b/Testing/TestSerieHelper.cxx index 3cb43568..77bd81d4 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/02/03 10:00:06 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/11/14 15:56:55 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,8 +20,6 @@ #include "gdcmDebug.h" #include -typedef std::list GdcmFileList; - int TestSerieHelper(int argc, char *argv[]) { gdcm::SerieHelper *s; @@ -37,37 +35,59 @@ int TestSerieHelper(int argc, char *argv[]) //if (argc > 2) // gdcm::Debug::DebugOn(); + std::cout << "Dir Name :[" << dirName << "]" << std::endl; - s = new gdcm::SerieHelper(); - s->SetDirectory(dirName, true); // true : recursive exploration - std::cout << " -------------------------------------------Finish parsing :[" + s = gdcm::SerieHelper::New(); + s->SetLoadMode(gdcm::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 - GdcmFileList *l = s->GetFirstCoherentFileList(); + // For all the SingleSerieUID filesets of the gdcm::Serie + gdcm::FileList *l = s->GetFirstSingleSerieUIDFileSet(); while (l) { nbFiles = l->size() ; if ( l->size() > 3 ) // Why not ? Just an example, for testing { std::cout << "Sort list : " << nbFiles << " long" << std::endl; - s->OrderGdcmFileList(l); // sort the list + 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; }