gdcmSerieHelper.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMSERIEHELPER_H
#define GDCMSERIEHELPER_H
#include "gdcmTag.h"
#include "gdcmSmartPointer.h"
#include "gdcmFile.h"
#include <vector>
#include <string>
#include <map>
namespace gdcm
{
enum CompOperators {
GDCM_EQUAL = 0,
GDCM_DIFFERENT,
GDCM_GREATER,
GDCM_GREATEROREQUAL,
GDCM_LESS,
GDCM_LESSOREQUAL
};
enum LodModeType
{
LD_ALL = 0x00000000,
LD_NOSEQ = 0x00000001,
LD_NOSHADOW = 0x00000002,
LD_NOSHADOWSEQ = 0x00000004
};
class GDCM_EXPORT FileWithName : public File
{
public:
FileWithName(File &f):File(f),filename(){}
std::string filename;
};
typedef std::vector< SmartPointer<FileWithName> > FileList;
typedef bool (*BOOL_FUNCTION_PFILE_PFILE_POINTER)(File *, File *);
class Scanner;
class GDCM_EXPORT SerieHelper
{
public:
SerieHelper();
~SerieHelper();
void Clear();
void SetLoadMode (int ) {}
void SetDirectory(std::string const &dir, bool recursive=false);
void AddRestriction(const std::string & tag);
void SetUseSeriesDetails( bool useSeriesDetails );
void CreateDefaultUniqueSeriesIdentifier();
FileList *GetFirstSingleSerieUIDFileSet();
FileList *GetNextSingleSerieUIDFileSet();
std::string CreateUniqueSeriesIdentifier( File * inFile );
void OrderFileList(FileList *fileSet);
void AddRestriction(uint16_t group, uint16_t elem, std::string const &value, int op);
protected:
bool UserOrdering(FileList *fileSet);
void AddFileName(std::string const &filename);
bool AddFile(FileWithName &header);
void AddRestriction(const Tag& tag);
bool ImagePositionPatientOrdering(FileList *fileSet);
bool ImageNumberOrdering( FileList *fileList );
bool FileNameOrdering( FileList *fileList );
using Rule = struct RuleStructure{
uint16_t group;
uint16_t elem;
std::string value;
int op;
};
typedef std::vector<Rule> SerieRestrictions;
typedef std::map<std::string, FileList *> SingleSerieUIDFileSetmap;
SingleSerieUIDFileSetmap SingleSerieUIDFileSetHT;
SingleSerieUIDFileSetmap::iterator ItFileSetHt;
private:
SerieRestrictions Restrictions;
SerieRestrictions Refine;
bool UseSeriesDetails;
bool DirectOrder;
BOOL_FUNCTION_PFILE_PFILE_POINTER UserLessThanFunction;
};
// backward compat
} // end namespace gdcm
#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