1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2005/01/17 10:59:52 $
7 Version: $Revision: 1.47 $
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 // should avoid exposing internal mechanism
71 DicomDirPatient *GetNextEntry();
74 void ParseDirectory();
76 // Note: the DicomDir:: namespace prefix is needed by Swig in the
77 // following method declarations. Refer to gdcmPython/gdcm.i
78 // for the reasons of this unecessary notation at C++ level.
79 void SetStartMethod( DicomDir::Method *method,
81 DicomDir::Method *argDelete = NULL );
82 void SetProgressMethod( DicomDir::Method *method,
84 DicomDir::Method *argDelete = NULL );
85 void SetEndMethod( DicomDir::Method *method,
87 DicomDir::Method *argDelete = NULL );
88 void SetStartMethodArgDelete( DicomDir::Method *m );
89 void SetProgressMethodArgDelete( DicomDir::Method *m );
90 void SetEndMethodArgDelete( DicomDir::Method *m );
92 /// GetProgress GetProgress
93 float GetProgress() { return Progress; };
95 /// AbortProgress AbortProgress
96 void AbortProgress() { Abort = true; };
98 /// IsAborted IsAborted
99 bool IsAborted() { return Abort; };
102 DicomDirMeta *NewMeta();
103 DicomDirPatient *NewPatient();
106 bool WriteDicomDir(std::string const &fileName);
108 /// Types of the DicomDirObject within the DicomDir
113 GDCM_DICOMDIR_PATIENT,
120 void CreateDicomDirChainedList(std::string const &path);
121 void CallStartMethod();
122 void CallProgressMethod();
123 void CallEndMethod();
127 void CreateDicomDir();
129 bool AddDicomDirMeta();
130 bool AddDicomDirPatientToEnd(DicomDirPatient *dd);
131 bool AddDicomDirStudyToEnd (DicomDirStudy *dd);
132 bool AddDicomDirSerieToEnd (DicomDirSerie *dd);
133 bool AddDicomDirImageToEnd (DicomDirImage *dd);
135 void SetElements(std::string const &path, VectDocument const &list);
136 void SetElement (std::string const &path, DicomDirType type,
138 void MoveSQItem(SQItem *dst,SQItem *src);
140 static bool HeaderLessThan(Document *header1, Document *header2);
144 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
145 DicomDirMeta* MetaElems;
146 ListDicomDirPatient::iterator ItDicomDirPatient;
148 /// Chained list of DicomDirPatient (to be exploited recursively)
149 ListDicomDirPatient Patients;
151 /// pointer to the initialisation method for any progress bar
153 /// pointer to the incrementation method for any progress bar
154 Method* ProgressMethod;
155 /// pointer to the termination method for any progress bar
157 /// pointer to the ??? method for any progress bar
158 Method* StartMethodArgDelete;
159 /// pointer to the ??? method for any progress bar
160 Method* ProgressMethodArgDelete;
161 /// pointer to the ??? method for any progress bar
162 Method* EndMethodArgDelete;
163 /// pointer to the ??? for any progress bar
165 /// pointer to the ??? for any progress bar
167 /// pointer to the ??? for any progress bar
169 /// value of the ??? for any progress bar
171 /// value of the ??? for any progress bar
174 } // end namespace gdcm
175 //-----------------------------------------------------------------------------