1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/08/02 16:42:14 $
7 Version: $Revision: 1.26 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef GDCMDICOMDIR_H
20 #define GDCMDICOMDIR_H
22 #include "gdcmCommon.h"
23 #include "gdcmDocument.h"
24 #include "gdcmDicomDirPatient.h"
25 #include "gdcmDicomDirMeta.h"
26 #include "gdcmDicomDirElement.h"
31 //-----------------------------------------------------------------------------
32 typedef std::list<gdcmDicomDirPatient*> ListDicomDirPatient;
33 typedef std::vector<gdcmDocument*> VectDocument;
35 typedef GDCM_EXPORT void(gdcmMethod)(void * = NULL);
36 //-----------------------------------------------------------------------------
39 * \ingroup gdcmDicomDir
40 * \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
43 class GDCM_EXPORT gdcmDicomDir: public gdcmDocument
46 gdcmDicomDir( std::string const & fileName, bool parseDir = false );
51 /// \brief canonical Printer
53 virtual void Print(std::ostream &os = std::cout);
55 // Informations contained in the parser
56 virtual bool IsReadable();
58 /// Returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
59 gdcmDicomDirMeta* GetDicomDirMeta() { return metaElems; };
61 /// Returns the PATIENT chained List for this DICOMDIR.
62 ListDicomDirPatient &GetDicomDirPatients() { return patients; };
65 void ParseDirectory();
67 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
68 void SetStartMethodArgDelete(gdcmMethod *);
69 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
70 void SetProgressMethodArgDelete(gdcmMethod *);
71 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
72 void SetEndMethodArgDelete(gdcmMethod *);
74 /// GetProgress GetProgress
75 float GetProgress() { return progress; };
77 /// AbortProgress AbortProgress
78 void AbortProgress() { abort = true; };
80 /// IsAborted IsAborted
81 bool IsAborted() { return abort; };
84 gdcmDicomDirMeta* NewMeta();
85 gdcmDicomDirPatient* NewPatient();
88 void WriteEntries(FILE *_fp);
89 bool Write(std::string const & fileName);
91 /// Types of the gdcmObject within the gdcmDicomDir
96 GDCM_DICOMDIR_PATIENT,
103 void CreateDicomDirChainedList(std::string const & path);
104 void CallStartMethod();
105 void CallProgressMethod();
106 void CallEndMethod();
110 void CreateDicomDir();
111 void AddDicomDirMeta();
112 void AddDicomDirPatientToEnd(gdcmSQItem *s);
113 void AddDicomDirStudyToEnd (gdcmSQItem *s);
114 void AddDicomDirSerieToEnd (gdcmSQItem *s);
115 void AddDicomDirImageToEnd (gdcmSQItem *s);
117 void SetElements(std::string &path, VectDocument &list);
118 void SetElement (std::string &path,gdcmDicomDirType type,
119 gdcmDocument *header);
121 void UpdateDirectoryRecordSequenceLength();
123 static bool HeaderLessThan(gdcmDocument *header1,gdcmDocument *header2);
127 /// Pointer on *the* gdcmObject 'DicomDirMeta Elements'
128 gdcmDicomDirMeta *metaElems;
130 /// Chained list of DicomDirPatient (to be exploited recursively)
131 ListDicomDirPatient patients;
133 /// pointer to the initialisation method for any progress bar
134 gdcmMethod *startMethod;
135 /// pointer to the incrementation method for any progress bar
136 gdcmMethod *progressMethod;
137 /// pointer to the termination method for any progress bar
138 gdcmMethod *endMethod;
139 /// pointer to the ??? method for any progress bar
140 gdcmMethod *startMethodArgDelete;
141 /// pointer to the ??? method for any progress bar
142 gdcmMethod *progressMethodArgDelete;
143 /// pointer to the ??? method for any progress bar
144 gdcmMethod *endMethodArgDelete;
145 /// pointer to the ??? for any progress bar
147 /// pointer to the ??? for any progress bar
149 /// pointer to the ??? for any progress bar
151 /// value of the ??? for any progress bar
153 /// value of the ??? for any progress bar
157 //-----------------------------------------------------------------------------