GDCM: gdcmSerieHelper.h Source File

GDCM 3.0.25

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
24namespace 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{
52public:
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 *);
59class Scanner;
60
68 class GDCM_EXPORT SerieHelper
69{
70public:
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
87protected:
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 ImageNumberOrdering( FileList *fileList );
94 bool FileNameOrdering( FileList *fileList );
95
96 using Rule = struct RuleStructure{
97 uint16_t group;
98 uint16_t elem;
99 std::string value;
100 int op;
101 };
102 typedef std::vector<Rule> SerieRestrictions;
103
104 typedef std::map<std::string, FileList *> SingleSerieUIDFileSetmap;
105 SingleSerieUIDFileSetmap SingleSerieUIDFileSetHT;
106 SingleSerieUIDFileSetmap::iterator ItFileSetHt;
107
108private:
109 SerieRestrictions Restrictions;
110 SerieRestrictions Refine;
111
112 bool UseSeriesDetails;
113 bool DirectOrder;
114
115 BOOL_FUNCTION_PFILE_PFILE_POINTER UserLessThanFunction;
116};
117
118// backward compat
119} // end namespace gdcm
120
121
122#endif //GDCMSERIEHELPER_H
gdcm::FileWithName
FileWithName.
Definition gdcmSerieHelper.h:51
gdcm::FileWithName::filename
std::string filename
Definition gdcmSerieHelper.h:54
gdcm::FileWithName::FileWithName
FileWithName(File &f)
Definition gdcmSerieHelper.h:53
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::File::File
File()
gdcm::Scanner
Scanner.
Definition gdcmScanner.h:56
gdcm::SerieHelper::SerieHelper
SerieHelper()
gdcm::SerieHelper::SingleSerieUIDFileSetmap
std::map< std::string, FileList * > SingleSerieUIDFileSetmap
Definition gdcmSerieHelper.h:104
gdcm::SerieHelper::AddRestriction
void AddRestriction(const Tag &tag)
gdcm::SerieHelper::Clear
void Clear()
gdcm::SerieHelper::GetFirstSingleSerieUIDFileSet
FileList * GetFirstSingleSerieUIDFileSet()
gdcm::SerieHelper::ImageNumberOrdering
bool ImageNumberOrdering(FileList *fileList)
gdcm::SerieHelper::OrderFileList
void OrderFileList(FileList *fileSet)
gdcm::SerieHelper::AddFile
bool AddFile(FileWithName &header)
gdcm::SerieHelper::UserOrdering
bool UserOrdering(FileList *fileSet)
gdcm::SerieHelper::AddRestriction
void AddRestriction(uint16_t group, uint16_t elem, std::string const &value, int op)
gdcm::SerieHelper::SerieRestrictions
std::vector< Rule > SerieRestrictions
Definition gdcmSerieHelper.h:102
gdcm::SerieHelper::Rule
struct RuleStructure{ uint16_t group; uint16_t elem; std::string value; int op; } Rule
Definition gdcmSerieHelper.h:96
gdcm::SerieHelper::AddRestriction
void AddRestriction(const std::string &tag)
gdcm::SerieHelper::CreateDefaultUniqueSeriesIdentifier
void CreateDefaultUniqueSeriesIdentifier()
gdcm::SerieHelper::SetDirectory
void SetDirectory(std::string const &dir, bool recursive=false)
gdcm::SerieHelper::~SerieHelper
~SerieHelper()
gdcm::SerieHelper::FileNameOrdering
bool FileNameOrdering(FileList *fileList)
gdcm::SerieHelper::SetLoadMode
void SetLoadMode(int)
Definition gdcmSerieHelper.h:75
gdcm::SerieHelper::CreateUniqueSeriesIdentifier
std::string CreateUniqueSeriesIdentifier(File *inFile)
gdcm::SerieHelper::SetUseSeriesDetails
void SetUseSeriesDetails(bool useSeriesDetails)
gdcm::SerieHelper::AddFileName
void AddFileName(std::string const &filename)
gdcm::SerieHelper::ImagePositionPatientOrdering
bool ImagePositionPatientOrdering(FileList *fileSet)
gdcm::SerieHelper::GetNextSingleSerieUIDFileSet
FileList * GetNextSingleSerieUIDFileSet()
gdcm::SerieHelper::SingleSerieUIDFileSetHT
SingleSerieUIDFileSetmap SingleSerieUIDFileSetHT
Definition gdcmSerieHelper.h:105
gdcm::SerieHelper::ItFileSetHt
SingleSerieUIDFileSetmap::iterator ItFileSetHt
Definition gdcmSerieHelper.h:106
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcmFile.h
gdcmSmartPointer.h
gdcmTag.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::LodModeType
LodModeType
Definition gdcmSerieHelper.h:36
gdcm::LD_NOSEQ
@ LD_NOSEQ
Definition gdcmSerieHelper.h:38
gdcm::LD_NOSHADOW
@ LD_NOSHADOW
Definition gdcmSerieHelper.h:39
gdcm::LD_ALL
@ LD_ALL
Definition gdcmSerieHelper.h:37
gdcm::LD_NOSHADOWSEQ
@ LD_NOSHADOWSEQ
Definition gdcmSerieHelper.h:40
gdcm::BOOL_FUNCTION_PFILE_PFILE_POINTER
bool(* BOOL_FUNCTION_PFILE_PFILE_POINTER)(File *, File *)
Definition gdcmSerieHelper.h:58
gdcm::CompOperators
CompOperators
Definition gdcmSerieHelper.h:27
gdcm::GDCM_EQUAL
@ GDCM_EQUAL
Definition gdcmSerieHelper.h:28
gdcm::GDCM_GREATER
@ GDCM_GREATER
Definition gdcmSerieHelper.h:30
gdcm::GDCM_DIFFERENT
@ GDCM_DIFFERENT
Definition gdcmSerieHelper.h:29
gdcm::GDCM_LESS
@ GDCM_LESS
Definition gdcmSerieHelper.h:32
gdcm::GDCM_GREATEROREQUAL
@ GDCM_GREATEROREQUAL
Definition gdcmSerieHelper.h:31
gdcm::GDCM_LESSOREQUAL
@ GDCM_LESSOREQUAL
Definition gdcmSerieHelper.h:33
gdcm::FileList
std::vector< SmartPointer< FileWithName > > FileList
Definition gdcmSerieHelper.h:57