GDCM
2.2.3
|
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 GDCMDICOMDIRGENERATOR_H 00015 #define GDCMDICOMDIRGENERATOR_H 00016 00017 #include "gdcmDirectory.h" 00018 #include "gdcmTag.h" 00019 #include <utility> // std::pair 00020 00021 namespace gdcm 00022 { 00023 class File; 00024 class Scanner; 00025 class SequenceOfItems; 00026 class VL; 00027 class DICOMDIRGeneratorInternal; 00028 00056 class GDCM_EXPORT DICOMDIRGenerator 00057 { 00058 public: 00059 typedef Directory::FilenamesType FilenamesType; 00060 typedef Directory::FilenameType FilenameType; 00061 DICOMDIRGenerator(); 00062 ~DICOMDIRGenerator(); 00063 00065 void SetFilenames( FilenamesType const & fns ); 00066 00068 void SetRootDirectory( FilenameType const & root ); 00069 00072 void SetDescriptor( const char *d ); 00073 00075 bool Generate(); 00076 00078 void SetFile(const File& f); 00079 File &GetFile(); 00080 00081 protected: 00082 Scanner &GetScanner(); 00083 bool AddPatientDirectoryRecord(); 00084 bool AddStudyDirectoryRecord(); 00085 bool AddSeriesDirectoryRecord(); 00086 bool AddImageDirectoryRecord(); 00087 00088 private: 00089 const char *ComputeFileID(const char *); 00090 bool TraverseDirectoryRecords(VL start ); 00091 bool ComputeDirectoryRecordsOffset(const SequenceOfItems *sqi, VL start); 00092 size_t FindNextDirectoryRecord( size_t item1, const char *directorytype ); 00093 SequenceOfItems *GetDirectoryRecordSequence(); 00094 size_t FindLowerLevelDirectoryRecord( size_t item1, const char *directorytype ); 00095 typedef std::pair< std::string, Tag> MyPair; 00096 MyPair GetReferenceValueForDirectoryType(size_t item); 00097 bool SeriesBelongToStudy(const char *seriesuid, const char *studyuid); 00098 bool ImageBelongToSeries(const char *sopuid, const char *seriesuid, Tag const &t1, Tag const &t2); 00099 bool ImageBelongToSameSeries(const char *sopuid, const char *seriesuid, Tag const &t); 00100 00101 DICOMDIRGeneratorInternal * Internals; 00102 }; 00103 00109 } // end namespace gdcm 00110 00111 #endif //GDCMDICOMDIRGENERATOR_H