GDCM 2.2.0

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

- File List
- File Members

gdcmSerieHelper.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004
    00005   Copyright (c) 2006-2011 Mathieu Malaterre
    00006   All rights reserved.
    00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00008
    00009      This software is distributed WITHOUT ANY WARRANTY; without even
    00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00011      PURPOSE.  See the above copyright notice for more information.
    00012
    00013 =========================================================================*/
    00014 #ifndef GDCMSERIEHELPER_H
    00015 #define GDCMSERIEHELPER_H
    00016
    00017 #include "gdcmTag.h"
    00018 #include "gdcmSmartPointer.h"
    00019 #include "gdcmFile.h"
    00020 #include <vector>
    00021 #include <string>
    00022 #include <map>
    00023
    00024 namespace gdcm
    00025 {
    00026
    00027 enum CompOperators {
    00028    GDCM_EQUAL = 0,
    00029    GDCM_DIFFERENT,
    00030    GDCM_GREATER,
    00031    GDCM_GREATEROREQUAL,
    00032    GDCM_LESS,
    00033    GDCM_LESSOREQUAL
    00034 };
    00035 enum LodModeType
    00036 {
    00037    LD_ALL         = 0x00000000,
    00038    LD_NOSEQ       = 0x00000001,
    00039    LD_NOSHADOW    = 0x00000002,
    00040    LD_NOSHADOWSEQ = 0x00000004
    00041 };
    00042
    00043
    00050 class GDCM_EXPORT FileWithName : public File
    00051 {
    00052 public:
    00053   FileWithName(File &f):File(f),filename(){}
    00054   std::string filename;
    00055 };
    00056
    00057 typedef std::vector< SmartPointer<FileWithName> > FileList;
    00058 typedef bool (*BOOL_FUNCTION_PFILE_PFILE_POINTER)(File *, File *);
    00059 class Scanner;
    00060
    00068 class GDCM_EXPORT SerieHelper
    00069 {
    00070 public:
    00071   SerieHelper();
    00072   ~SerieHelper();
    00073
    00074   void Clear();
    00075   void SetLoadMode (int ) {}
    00076   void SetDirectory(std::string const &dir, bool recursive=false);
    00077
    00078   void AddRestriction(const std::string & tag);
    00079   void SetUseSeriesDetails( bool useSeriesDetails );
    00080   void CreateDefaultUniqueSeriesIdentifier();
    00081   FileList *GetFirstSingleSerieUIDFileSet();
    00082   FileList *GetNextSingleSerieUIDFileSet();
    00083   std::string CreateUniqueSeriesIdentifier( File * inFile );
    00084   void OrderFileList(FileList *fileSet);
    00085   void AddRestriction(uint16_t group, uint16_t elem, std::string const &value, int op);
    00086
    00087 protected:
    00088   bool UserOrdering(FileList *fileSet);
    00089   void AddFileName(std::string const &filename);
    00090   bool AddFile(FileWithName &header);
    00091   void AddRestriction(const Tag& tag);
    00092   bool ImagePositionPatientOrdering(FileList *fileSet);
    00093   bool FileNameOrdering( FileList *fileList );
    00094
    00095   typedef struct {
    00096     uint16_t group;
    00097     uint16_t elem;
    00098     std::string value;
    00099     int op;
    00100   } Rule;
    00101   typedef std::vector<Rule> SerieRestrictions;
    00102
    00103   typedef std::map<std::string, FileList *> SingleSerieUIDFileSetmap;
    00104   SingleSerieUIDFileSetmap SingleSerieUIDFileSetHT;
    00105   SingleSerieUIDFileSetmap::iterator ItFileSetHt;
    00106
    00107 private:
    00108   SerieRestrictions Restrictions;
    00109   SerieRestrictions Refine;
    00110
    00111   bool UseSeriesDetails;
    00112   bool DirectOrder;
    00113
    00114   BOOL_FUNCTION_PFILE_PFILE_POINTER UserLessThanFunction;
    00115
    00116   bool m_UseSeriesDetails;
    00117 };
    00118
    00119 // backward compat
    00120 } // end namespace gdcm
    00121
    00122
    00123 #endif //GDCMSERIEHELPER_H