1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2005/01/20 11:09:23 $
7 Version: $Revision: 1.49 $
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 = "" );
64 /// Informations contained in the parser
65 virtual bool IsReadable();
68 void ParseDirectory();
70 // Note: the DicomDir:: namespace prefix is needed by Swig in the
71 // following method declarations. Refer to gdcmPython/gdcm.i
72 // for the reasons of this unecessary notation at C++ level.
73 void SetStartMethod( DicomDir::Method *method,
75 DicomDir::Method *argDelete = NULL );
76 void SetProgressMethod( DicomDir::Method *method,
78 DicomDir::Method *argDelete = NULL );
79 void SetEndMethod( DicomDir::Method *method,
81 DicomDir::Method *argDelete = NULL );
82 void SetStartMethodArgDelete( DicomDir::Method *m );
83 void SetProgressMethodArgDelete( DicomDir::Method *m );
84 void SetEndMethodArgDelete( DicomDir::Method *m );
85 /// GetProgress GetProgress
86 float GetProgress() { return Progress; };
87 /// AbortProgress AbortProgress
88 void AbortProgress() { Abort = true; };
89 /// IsAborted IsAborted
90 bool IsAborted() { return Abort; };
92 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
93 DicomDirMeta* GetMeta() { return MetaElems; };
95 // should avoid exposing internal mechanism
96 DicomDirPatient *GetFirstPatient();
97 DicomDirPatient *GetNextPatient();
100 DicomDirMeta *NewMeta();
101 DicomDirPatient *NewPatient();
104 bool WriteDicomDir(std::string const &fileName);
106 /// Types of the DicomDirObject within the DicomDir
111 GDCM_DICOMDIR_PATIENT,
118 void CreateDicomDirChainedList(std::string const &path);
119 void CallStartMethod();
120 void CallProgressMethod();
121 void CallEndMethod();
125 void CreateDicomDir();
127 bool AddPatientToEnd(DicomDirPatient *dd);
128 bool AddStudyToEnd (DicomDirStudy *dd);
129 bool AddSerieToEnd (DicomDirSerie *dd);
130 bool AddImageToEnd (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;
146 ListDicomDirPatient::iterator ItPatient;
148 /// pointer to the initialisation method for any progress bar
150 /// pointer to the incrementation method for any progress bar
151 Method* ProgressMethod;
152 /// pointer to the termination method for any progress bar
154 /// pointer to the ??? method for any progress bar
155 Method* StartMethodArgDelete;
156 /// pointer to the ??? method for any progress bar
157 Method* ProgressMethodArgDelete;
158 /// pointer to the ??? method for any progress bar
159 Method* EndMethodArgDelete;
160 /// pointer to the ??? for any progress bar
162 /// pointer to the ??? for any progress bar
164 /// pointer to the ??? for any progress bar
166 /// value of the ??? for any progress bar
168 /// value of the ??? for any progress bar
171 } // end namespace gdcm
172 //-----------------------------------------------------------------------------