1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/09/27 08:39:06 $
7 Version: $Revision: 1.32 $
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.html 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 bool WriteDicomDir(std::string const & fileName);
90 /// Types of the gdcmDicomDirObject within the gdcmDicomDir
95 GDCM_DICOMDIR_PATIENT,
102 void CreateDicomDirChainedList(std::string const & path);
103 void CallStartMethod();
104 void CallProgressMethod();
105 void CallEndMethod();
109 void CreateDicomDir();
110 void AddDicomDirMeta();
111 void AddDicomDirPatientToEnd(gdcmSQItem* s);
112 void AddDicomDirStudyToEnd (gdcmSQItem* s);
113 void AddDicomDirSerieToEnd (gdcmSQItem* s);
114 void AddDicomDirImageToEnd (gdcmSQItem* s);
116 void SetElements(std::string &path, VectDocument &list);
117 void SetElement (std::string &path,gdcmDicomDirType type,
118 gdcmDocument* header);
120 static bool HeaderLessThan(gdcmDocument* header1,gdcmDocument* header2);
124 /// Pointer on *the* gdcmDicomDirObject 'DicomDirMeta Elements'
125 gdcmDicomDirMeta* metaElems;
127 /// Chained list of DicomDirPatient (to be exploited recursively)
128 ListDicomDirPatient patients;
130 /// pointer to the initialisation method for any progress bar
131 gdcmMethod* startMethod;
132 /// pointer to the incrementation method for any progress bar
133 gdcmMethod* progressMethod;
134 /// pointer to the termination method for any progress bar
135 gdcmMethod* endMethod;
136 /// pointer to the ??? method for any progress bar
137 gdcmMethod* startMethodArgDelete;
138 /// pointer to the ??? method for any progress bar
139 gdcmMethod* progressMethodArgDelete;
140 /// pointer to the ??? method for any progress bar
141 gdcmMethod* endMethodArgDelete;
142 /// pointer to the ??? for any progress bar
144 /// pointer to the ??? for any progress bar
146 /// pointer to the ??? for any progress bar
148 /// value of the ??? for any progress bar
150 /// value of the ??? for any progress bar
154 //-----------------------------------------------------------------------------