1 /*=========================================================================
4 Module: $RCSfile: exSerieHelper.cxx,v $
6 Date: $Date: 2005/11/14 15:55:17 $
7 Version: $Revision: 1.7 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
18 #include "gdcmSerieHelper.h"
20 #include "gdcmDebug.h"
23 int main(int argc, char *argv[])
32 dirName = GDCM_DATA_ROOT;
36 gdcm::Debug::DebugOn();
39 std::cout << "Dir Name :[" << dirName << "]" << std::endl;
41 s = gdcm::SerieHelper::New();
42 s->SetLoadMode(gdcm::LD_ALL); // Load everything for each File
43 //gdcm::TagKey t(0x0020,0x0013);
44 //s->AddRestriction(t, "340", gdcm::GDCM_LESS); // Keep only files where
45 // restriction is true
46 s->SetDirectory(dirName, true); // true : recursive exploration
48 std::cout << " ---------------------------------------- Finish parsing :["
49 << dirName << "]" << std::endl;
52 std::cout << " ---------------------------------------- Finish printing (1)"
56 // For all the Single SerieUID Files Sets of the gdcm::Serie
57 gdcm::FileList *l = s->GetFirstSingleSerieUIDFileSet();
61 if ( l->size() > 3 ) // Why not ? Just an example, for testing
63 std::cout << "Sort list : " << nbFiles << " long" << std::endl;
64 s->OrderFileList(l); // sort the list
66 l = s->GetNextSingleSerieUIDFileSet();
68 std::cout << " -------------------------------------------- Finish sorting"
70 s->Print(); // Prints all the Single SerieUID File Sets (sorted or not)
71 std::cout << " -------------------------------------------- Finish printing"
75 // Only for the first Coherent File List
76 // ( Why not ? Just an example, for testing )
77 // Display all the file names
80 l = s->GetFirstSingleSerieUIDFileSet();
81 for (std::vector<gdcm::File* >::iterator it = l->begin();
85 fileName = (*it)->GetFileName();
86 std::cout << fileName << std::endl;