1 /*=========================================================================
4 Module: $RCSfile: gdcmSerieHelper.h,v $
6 Date: $Date: 2005/02/11 17:01:46 $
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 =========================================================================*/
19 #ifndef GDCMSERIEHELPER_H
20 #define GDCMSERIEHELPER_H
22 #include "gdcmCommon.h"
31 typedef std::vector<File* > GdcmFileList;
33 //-----------------------------------------------------------------------------
36 * - This class should be used for a stack of 2D dicom images.
37 * It allows to explore (recursively or not) a directory and
38 * makes a set of 'Coherent Files' list (coherent : same Serie UID)
39 * It allows to sort any of the Coherent File list on the image postion
41 class GDCM_EXPORT SerieHelper
44 typedef std::map<std::string, GdcmFileList *> CoherentFileListmap;
45 typedef std::vector<File* > GdcmFileVector;
49 void Print(std::ostream &os = std::cout, std::string const &indent = "" );
51 /// \todo should return bool or throw error ?
52 void AddFileName(std::string const &filename);
53 void SetDirectory(std::string const &dir, bool recursive=false);
54 void OrderGdcmFileList(GdcmFileList *coherentGdcmFileList);
56 /// \brief Gets the FIRST *coherent* File List.
57 /// Deprecated; kept not to break the API
58 /// \note Caller must call OrderGdcmFileList first
59 /// @return the (first) *coherent* File List
60 const GdcmFileList &GetGdcmFileList() { return
61 *CoherentGdcmFileListHT.begin()->second; }
63 GdcmFileList *GetFirstCoherentFileList();
64 GdcmFileList *GetNextCoherentFileList();
65 GdcmFileList *GetCoherentFileList(std::string serieUID);
68 bool ImagePositionPatientOrdering(GdcmFileList *coherentGdcmFileList);
69 bool ImageNumberOrdering(GdcmFileList *coherentGdcmFileList);
70 bool FileNameOrdering(GdcmFileList *coherentGdcmFileList);
72 static bool ImageNumberLessThan(File *file1, File *file2);
73 static bool FileNameLessThan(File *file1, File *file2);
74 CoherentFileListmap CoherentGdcmFileListHT;
75 CoherentFileListmap::iterator ItListHt;
78 } // end namespace gdcm
80 //-----------------------------------------------------------------------------