GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmDICOMDIRGenerator.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMDICOMDIRGENERATOR_H
15 #define GDCMDICOMDIRGENERATOR_H
16
17 #include "gdcmDirectory.h"
18 #include "gdcmTag.h"
19 #include <utility> // std::pair
20
21 namespace gdcm
22 {
23 class File;
24 class Scanner;
25 class SequenceOfItems;
26 class VL;
27 class DICOMDIRGeneratorInternal;
28
56 class GDCM_EXPORT DICOMDIRGenerator
57 {
58 public:
59 typedef Directory::FilenamesType FilenamesType;
60 typedef Directory::FilenameType FilenameType;
61 DICOMDIRGenerator();
62 ~DICOMDIRGenerator();
63
65 void SetFilenames( FilenamesType const & fns );
66
68 void SetRootDirectory( FilenameType const & root );
69
72 void SetDescriptor( const char *d );
73
75 bool Generate();
76
78 void SetFile(const File& f);
79 File &GetFile();
80
81 protected:
82 Scanner &GetScanner();
83 bool AddPatientDirectoryRecord();
84 bool AddStudyDirectoryRecord();
85 bool AddSeriesDirectoryRecord();
86 bool AddImageDirectoryRecord();
87
88 private:
89 const char *ComputeFileID(const char *);
90 bool TraverseDirectoryRecords(VL start );
91 bool ComputeDirectoryRecordsOffset(const SequenceOfItems *sqi, VL start);
92 size_t FindNextDirectoryRecord( size_t item1, const char *directorytype );
93 SequenceOfItems *GetDirectoryRecordSequence();
94 size_t FindLowerLevelDirectoryRecord( size_t item1, const char *directorytype );
95 typedef std::pair< std::string, Tag> MyPair;
96 MyPair GetReferenceValueForDirectoryType(size_t item);
97 bool SeriesBelongToStudy(const char *seriesuid, const char *studyuid);
98 bool ImageBelongToSeries(const char *sopuid, const char *seriesuid, Tag const &t1, Tag const &t2);
99 bool ImageBelongToSameSeries(const char *sopuid, const char *seriesuid, Tag const &t);
100
101 DICOMDIRGeneratorInternal * Internals;
102 };
103
109 } // end namespace gdcm
110
111 #endif //GDCMDICOMDIRGENERATOR_H