1 /*=========================================================================
4 Module: $RCSfile: exXCoherentFileSet.cxx,v $
6 Date: $Date: 2005/10/25 15:57:20 $
7 Version: $Revision: 1.1 $
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();
38 s = new gdcm::SerieHelper();
39 s->SetLoadMode(gdcm::LD_ALL); // Load everything for each File
40 //s->AddRestriction(tagKey, valueToCheck); // Keep only files where
41 // restriction is true
42 s->SetDirectory(dirName, true); // true : recursive exploration
44 std::cout << " ---------------------------------------- "
45 << "'Single UID' Filesets found in :["
46 << dirName << "]" << std::endl;
49 std::cout << " ------------------------------------- Result after splitting"
54 // For all the Single SerieUID Files Sets of the gdcm::Serie
55 gdcm::FileList *l = s->GetFirstSingleSerieUIDFileSet();
59 if ( l->size() > 3 ) // Why not ? Just an example, for testing
61 std::cout << "Split the 'Single SerieUID' FileSet :["
62 << s->GetCurrentSerieUIDFileSetUID()
63 << "] " << nbFiles << " long" << std::endl;
64 std::cout << "-----------------------------------" << std::endl;
65 gdcm::XCoherentFileSetmap xcm = s->SplitOnOrientation(l);
66 //gdcm::XCoherentFileSetmap xcm = s->SplitOnPosition(l);
68 for (gdcm::XCoherentFileSetmap::iterator i = xcm.begin();
72 std::cout << "Orientation : [" << (*i).first << "]" << std::endl;
74 // Nowadays OrderFileList() causes trouble, since some files
75 // (MIP views) don't have 'Position', now considered as mandatory
76 // Commented out for the moment.
77 //s->OrderFileList((*i).second); // sort the XCoherent Fileset
79 for (std::vector<gdcm::File* >::iterator it = ((*i).second)->begin();
80 it != ((*i).second)->end();
83 fileName = (*it)->GetFileName();
84 std::cout << " " << fileName << std::endl;
86 std::cout << std::endl;
89 l = s->GetNextSingleSerieUIDFileSet();