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