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 
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

Generated on Sat Dec 4 2010 08:58:47 for GDCM by doxygen 1.7.2
SourceForge.net Logo