1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2005/01/06 20:33:55 $
7 Version: $Revision: 1.44 $
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.
48 class GDCM_EXPORT DicomDir: public Document
51 typedef void(Method)(void*);
53 DicomDir( std::string const &filename, bool parseDir = false );
58 /// \brief canonical Printer
59 void Print(std::ostream &os = std::cout);
61 /// Informations contained in the parser
62 virtual bool IsReadable();
64 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
65 DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
67 /// Returns the PATIENT chained List for this DICOMDIR.
68 ListDicomDirPatient const & GetDicomDirPatients() const { return Patients; };
71 void ParseDirectory();
73 // Note: the DicomDir:: namespace prefix is needed by Swig in the
74 // following method declarations. Refer to gdcmPython/gdcm.i
75 // for the reasons of this unecessary notation at C++ level.
76 void SetStartMethod( DicomDir::Method *method,
78 DicomDir::Method *argDelete = NULL );
79 void SetProgressMethod( DicomDir::Method *method,
81 DicomDir::Method *argDelete = NULL );
82 void SetEndMethod( DicomDir::Method *method,
84 DicomDir::Method *argDelete = NULL );
85 void SetStartMethodArgDelete( DicomDir::Method *m );
86 void SetProgressMethodArgDelete( DicomDir::Method *m );
87 void SetEndMethodArgDelete( DicomDir::Method *m );
89 /// GetProgress GetProgress
90 float GetProgress() { return Progress; };
92 /// AbortProgress AbortProgress
93 void AbortProgress() { Abort = true; };
95 /// IsAborted IsAborted
96 bool IsAborted() { return Abort; };
99 DicomDirMeta *NewMeta();
100 DicomDirPatient *NewPatient();
103 bool WriteDicomDir(std::string const &fileName);
105 /// Types of the DicomDirObject within the DicomDir
110 GDCM_DICOMDIR_PATIENT,
117 void CreateDicomDirChainedList(std::string const &path);
118 void CallStartMethod();
119 void CallProgressMethod();
120 void CallEndMethod();
124 void CreateDicomDir();
126 bool AddDicomDirMeta();
127 bool AddDicomDirPatientToEnd(DicomDirPatient *dd);
128 bool AddDicomDirStudyToEnd (DicomDirStudy *dd);
129 bool AddDicomDirSerieToEnd (DicomDirSerie *dd);
130 bool AddDicomDirImageToEnd (DicomDirImage *dd);
132 void SetElements(std::string const &path, VectDocument const &list);
133 void SetElement (std::string const &path, DicomDirType type,
135 void MoveSQItem(SQItem *dst,SQItem *src);
137 static bool HeaderLessThan(Document *header1, Document *header2);
141 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
142 DicomDirMeta* MetaElems;
144 /// Chained list of DicomDirPatient (to be exploited recursively)
145 ListDicomDirPatient Patients;
147 /// pointer to the initialisation method for any progress bar
149 /// pointer to the incrementation method for any progress bar
150 Method* ProgressMethod;
151 /// pointer to the termination method for any progress bar
153 /// pointer to the ??? method for any progress bar
154 Method* StartMethodArgDelete;
155 /// pointer to the ??? method for any progress bar
156 Method* ProgressMethodArgDelete;
157 /// pointer to the ??? method for any progress bar
158 Method* EndMethodArgDelete;
159 /// pointer to the ??? for any progress bar
161 /// pointer to the ??? for any progress bar
163 /// pointer to the ??? for any progress bar
165 /// value of the ??? for any progress bar
167 /// value of the ??? for any progress bar
170 } // end namespace gdcm
171 //-----------------------------------------------------------------------------