# gdcmDICOMDIRGenerator.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-2009 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   DICOMDIRGenerator();
    00062   ~DICOMDIRGenerator();
    00063
    00065   void SetFilenames( FilenamesType const & fns );
    00066
    00069   void SetDescriptor( const char *d );
    00070
    00072   bool Generate();
    00073
    00075   void SetFile(const File& f);
    00076   File &GetFile();
    00077
    00078 protected:
    00079   Scanner &GetScanner();
    00080   bool AddPatientDirectoryRecord();
    00081   bool AddStudyDirectoryRecord();
    00082   bool AddSeriesDirectoryRecord();
    00083   bool AddImageDirectoryRecord();
    00084
    00085 private:
    00086   bool TraverseDirectoryRecords(VL start );
    00087   bool ComputeDirectoryRecordsOffset(const SequenceOfItems *sqi, VL start);
    00088   unsigned int FindNextDirectoryRecord( unsigned int item1, const char *directorytype );
    00089   SequenceOfItems *GetDirectoryRecordSequence();
    00090   unsigned int FindLowerLevelDirectoryRecord( unsigned int item1, const char *directorytype );
    00091   typedef std::pair< std::string, Tag> MyPair;
    00092   MyPair GetReferenceValueForDirectoryType(unsigned int item);
    00093   bool SeriesBelongToStudy(const char *seriesuid, const char *studyuid);
    00094   bool ImageBelongToSeries(const char *sopuid, const char *seriesuid, Tag const &t1, Tag const &t2);
    00095   bool ImageBelongToSameSeries(const char *sopuid, const char *seriesuid, Tag const &t);
    00096
    00097   DICOMDIRGeneratorInternal * Internals;
    00098 };
    00099
    00105 } // end namespace gdcm
    00106
    00107 #endif //__gdcmDICOMDIRGenerator_h