1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/07/19 03:34:11 $
7 Version: $Revision: 1.25 $
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,
47 bool parseDir = false,
48 bool exception_on_error = false);
49 gdcmDicomDir(bool exception_on_error = false);
53 /// \brief canonical Printer
55 virtual void Print(std::ostream &os = std::cout);
57 // Informations contained in the parser
58 virtual bool IsReadable();
60 /// Returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
61 gdcmDicomDirMeta* GetDicomDirMeta() { return metaElems; };
63 /// Returns the PATIENT chained List for this DICOMDIR.
64 ListDicomDirPatient &GetDicomDirPatients() { return patients; };
67 void ParseDirectory();
69 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
70 void SetStartMethodArgDelete(gdcmMethod *);
71 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
72 void SetProgressMethodArgDelete(gdcmMethod *);
73 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
74 void SetEndMethodArgDelete(gdcmMethod *);
76 /// GetProgress GetProgress
77 float GetProgress() { return progress; };
79 /// AbortProgress AbortProgress
80 void AbortProgress() { abort = true; };
82 /// IsAborted IsAborted
83 bool IsAborted() { return abort; };
86 gdcmDicomDirMeta* NewMeta();
87 gdcmDicomDirPatient* NewPatient();
90 void WriteEntries(FILE *_fp);
91 bool Write(std::string const & fileName);
93 /// Types of the gdcmObject within the gdcmDicomDir
98 GDCM_DICOMDIR_PATIENT,
105 void CreateDicomDirChainedList(std::string const & path);
106 void CallStartMethod();
107 void CallProgressMethod();
108 void CallEndMethod();
112 void CreateDicomDir();
113 void AddDicomDirMeta();
114 void AddDicomDirPatientToEnd(gdcmSQItem *s);
115 void AddDicomDirStudyToEnd (gdcmSQItem *s);
116 void AddDicomDirSerieToEnd (gdcmSQItem *s);
117 void AddDicomDirImageToEnd (gdcmSQItem *s);
119 void SetElements(std::string &path, VectDocument &list);
120 void SetElement (std::string &path,gdcmDicomDirType type,
121 gdcmDocument *header);
123 void UpdateDirectoryRecordSequenceLength();
125 static bool HeaderLessThan(gdcmDocument *header1,gdcmDocument *header2);
129 /// Pointer on *the* gdcmObject 'DicomDirMeta Elements'
130 gdcmDicomDirMeta *metaElems;
132 /// Chained list of DicomDirPatient (to be exploited recursively)
133 ListDicomDirPatient patients;
135 /// pointer to the initialisation method for any progress bar
136 gdcmMethod *startMethod;
137 /// pointer to the incrementation method for any progress bar
138 gdcmMethod *progressMethod;
139 /// pointer to the termination method for any progress bar
140 gdcmMethod *endMethod;
141 /// pointer to the ??? method for any progress bar
142 gdcmMethod *startMethodArgDelete;
143 /// pointer to the ??? method for any progress bar
144 gdcmMethod *progressMethodArgDelete;
145 /// pointer to the ??? method for any progress bar
146 gdcmMethod *endMethodArgDelete;
147 /// pointer to the ??? for any progress bar
149 /// pointer to the ??? for any progress bar
151 /// pointer to the ??? for any progress bar
153 /// value of the ??? for any progress bar
155 /// value of the ??? for any progress bar
159 //-----------------------------------------------------------------------------