# gdcmSerieHelper.h

Go to the documentation of this file.

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