1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2005/01/16 04:50:41 $
7 Version: $Revision: 1.46 $
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 "gdcmDocument.h"
29 //-----------------------------------------------------------------------------
30 class DicomDirPatient;
32 class DicomDirElement;
38 typedef std::list<DicomDirPatient *> ListDicomDirPatient;
39 typedef std::vector<Document *> VectDocument;
41 //-----------------------------------------------------------------------------
45 * \brief DicomDir defines an object representing a DICOMDIR in memory
46 * as a tree-like structure DicomDirPatient -> DicomDirStudy -> DicomDirSerie
50 class GDCM_EXPORT DicomDir: public Document
53 typedef void(Method)(void*);
55 DicomDir( std::string const &filename, bool parseDir = false );
60 /// \brief canonical Printer
61 void Print(std::ostream &os = std::cout, std::string const & indent = "" );
63 /// Informations contained in the parser
64 virtual bool IsReadable();
66 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
67 DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
69 /// Returns the PATIENT chained List for this DICOMDIR.
70 ListDicomDirPatient const & GetDicomDirPatients() const { return Patients; };
73 void ParseDirectory();
75 // Note: the DicomDir:: namespace prefix is needed by Swig in the
76 // following method declarations. Refer to gdcmPython/gdcm.i
77 // for the reasons of this unecessary notation at C++ level.
78 void SetStartMethod( DicomDir::Method *method,
80 DicomDir::Method *argDelete = NULL );
81 void SetProgressMethod( DicomDir::Method *method,
83 DicomDir::Method *argDelete = NULL );
84 void SetEndMethod( DicomDir::Method *method,
86 DicomDir::Method *argDelete = NULL );
87 void SetStartMethodArgDelete( DicomDir::Method *m );
88 void SetProgressMethodArgDelete( DicomDir::Method *m );
89 void SetEndMethodArgDelete( DicomDir::Method *m );
91 /// GetProgress GetProgress
92 float GetProgress() { return Progress; };
94 /// AbortProgress AbortProgress
95 void AbortProgress() { Abort = true; };
97 /// IsAborted IsAborted
98 bool IsAborted() { return Abort; };
101 DicomDirMeta *NewMeta();
102 DicomDirPatient *NewPatient();
105 bool WriteDicomDir(std::string const &fileName);
107 /// Types of the DicomDirObject within the DicomDir
112 GDCM_DICOMDIR_PATIENT,
119 void CreateDicomDirChainedList(std::string const &path);
120 void CallStartMethod();
121 void CallProgressMethod();
122 void CallEndMethod();
126 void CreateDicomDir();
128 bool AddDicomDirMeta();
129 bool AddDicomDirPatientToEnd(DicomDirPatient *dd);
130 bool AddDicomDirStudyToEnd (DicomDirStudy *dd);
131 bool AddDicomDirSerieToEnd (DicomDirSerie *dd);
132 bool AddDicomDirImageToEnd (DicomDirImage *dd);
134 void SetElements(std::string const &path, VectDocument const &list);
135 void SetElement (std::string const &path, DicomDirType type,
137 void MoveSQItem(SQItem *dst,SQItem *src);
139 static bool HeaderLessThan(Document *header1, Document *header2);
143 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
144 DicomDirMeta* MetaElems;
146 /// Chained list of DicomDirPatient (to be exploited recursively)
147 ListDicomDirPatient Patients;
149 /// pointer to the initialisation method for any progress bar
151 /// pointer to the incrementation method for any progress bar
152 Method* ProgressMethod;
153 /// pointer to the termination method for any progress bar
155 /// pointer to the ??? method for any progress bar
156 Method* StartMethodArgDelete;
157 /// pointer to the ??? method for any progress bar
158 Method* ProgressMethodArgDelete;
159 /// pointer to the ??? method for any progress bar
160 Method* EndMethodArgDelete;
161 /// pointer to the ??? for any progress bar
163 /// pointer to the ??? for any progress bar
165 /// pointer to the ??? for any progress bar
167 /// value of the ??? for any progress bar
169 /// value of the ??? for any progress bar
172 } // end namespace gdcm
173 //-----------------------------------------------------------------------------