GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmSerieHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMSERIEHELPER_H
15 #define GDCMSERIEHELPER_H
16
17 #include "gdcmTag.h"
18 #include "gdcmSmartPointer.h"
19 #include "gdcmFile.h"
20 #include <vector>
21 #include <string>
22 #include <map>
23
24 namespace gdcm
25 {
26
27 enum CompOperators {
28 GDCM_EQUAL = 0,
29 GDCM_DIFFERENT,
30 GDCM_GREATER,
31 GDCM_GREATEROREQUAL,
32 GDCM_LESS,
33 GDCM_LESSOREQUAL
34 };
35 enum LodModeType
36 {
37 LD_ALL = 0x00000000,
38 LD_NOSEQ = 0x00000001,
39 LD_NOSHADOW = 0x00000002,
40 LD_NOSHADOWSEQ = 0x00000004
41 };
42
43
50 class GDCM_EXPORT FileWithName : public File
51 {
52 public:
53 FileWithName(File &f):File(f),filename(){}
54 std::string filename;
55 };
56
57 typedef std::vector< SmartPointer<FileWithName> > FileList;
58 typedef bool (*BOOL_FUNCTION_PFILE_PFILE_POINTER)(File *, File *);
59 class Scanner;
60
68 class GDCM_EXPORT SerieHelper
69 {
70 public:
71 SerieHelper();
72 ~SerieHelper();
73
74 void Clear();
75 void SetLoadMode (int ) {}
76 void SetDirectory(std::string const &dir, bool recursive=false);
77
78 void AddRestriction(const std::string & tag);
79 void SetUseSeriesDetails( bool useSeriesDetails );
80 void CreateDefaultUniqueSeriesIdentifier();
81 FileList *GetFirstSingleSerieUIDFileSet();
82 FileList *GetNextSingleSerieUIDFileSet();
83 std::string CreateUniqueSeriesIdentifier( File * inFile );
84 void OrderFileList(FileList *fileSet);
85 void AddRestriction(uint16_t group, uint16_t elem, std::string const &value, int op);
86
87 protected:
88 bool UserOrdering(FileList *fileSet);
89 void AddFileName(std::string const &filename);
90 bool AddFile(FileWithName &header);
91 void AddRestriction(const Tag& tag);
92 bool ImagePositionPatientOrdering(FileList *fileSet);
93 bool FileNameOrdering( FileList *fileList );
94
95 typedef struct {
96 uint16_t group;
97 uint16_t elem;
98 std::string value;
99 int op;
100 } Rule;
101 typedef std::vector<Rule> SerieRestrictions;
102
103 typedef std::map<std::string, FileList *> SingleSerieUIDFileSetmap;
104 SingleSerieUIDFileSetmap SingleSerieUIDFileSetHT;
105 SingleSerieUIDFileSetmap::iterator ItFileSetHt;
106
107 private:
108 SerieRestrictions Restrictions;
109 SerieRestrictions Refine;
110
111 bool UseSeriesDetails;
112 bool DirectOrder;
113
114 BOOL_FUNCTION_PFILE_PFILE_POINTER UserLessThanFunction;
115
116 bool m_UseSeriesDetails;
117 };
118
119 // backward compat
120 } // end namespace gdcm
121
122
123 #endif //GDCMSERIEHELPER_H