1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/12/03 17:13:18 $
7 Version: $Revision: 1.40 $
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"
33 //-----------------------------------------------------------------------------
34 typedef std::list<DicomDirPatient*> ListDicomDirPatient;
35 typedef std::vector<Document*> VectDocument;
37 //-----------------------------------------------------------------------------
41 * \brief DicomDir defines an object representing a DICOMDIR in memory.
44 class GDCM_EXPORT DicomDir: public Document
47 typedef void(Method)(void*);
49 DicomDir( std::string const & filename, bool parseDir = false );
54 /// \brief canonical Printer
56 void Print(std::ostream &os = std::cout);
58 /// Informations contained in the parser
59 virtual bool IsReadable();
61 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
62 DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
64 /// Returns the PATIENT chained List for this DICOMDIR.
65 ListDicomDirPatient const & GetDicomDirPatients() const { return Patients; };
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*,
75 DicomDir::Method* = NULL );
76 void SetProgressMethod( DicomDir::Method*,
78 DicomDir::Method* = NULL );
79 void SetEndMethod( DicomDir::Method*,
81 DicomDir::Method* = NULL );
82 void SetStartMethodArgDelete( DicomDir::Method* );
83 void SetProgressMethodArgDelete( DicomDir::Method* );
84 void SetEndMethodArgDelete( DicomDir::Method* );
86 /// GetProgress GetProgress
87 float GetProgress() { return Progress; };
89 /// AbortProgress AbortProgress
90 void AbortProgress() { Abort = true; };
92 /// IsAborted IsAborted
93 bool IsAborted() { return Abort; };
96 DicomDirMeta* NewMeta();
97 DicomDirPatient* NewPatient();
100 bool WriteDicomDir(std::string const & fileName);
102 /// Types of the DicomDirObject within the DicomDir
107 GDCM_DICOMDIR_PATIENT,
114 void CreateDicomDirChainedList(std::string const & path);
115 void CallStartMethod();
116 void CallProgressMethod();
117 void CallEndMethod();
121 void CreateDicomDir();
123 bool AddDicomDirMeta();
124 bool AddDicomDirPatientToEnd(DicomDirPatient* dd);
125 bool AddDicomDirStudyToEnd (DicomDirStudy* dd);
126 bool AddDicomDirSerieToEnd (DicomDirSerie* dd);
127 bool AddDicomDirImageToEnd (DicomDirImage* dd);
129 void SetElements(std::string const & path, VectDocument const &list);
130 void SetElement (std::string const & path, DicomDirType type,
132 void MoveSQItem(SQItem* dst,SQItem *src);
134 static bool HeaderLessThan(Document* header1, Document* header2);
138 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
139 DicomDirMeta* MetaElems;
141 /// Chained list of DicomDirPatient (to be exploited recursively)
142 ListDicomDirPatient Patients;
144 /// pointer to the initialisation method for any progress bar
146 /// pointer to the incrementation method for any progress bar
147 Method* ProgressMethod;
148 /// pointer to the termination method for any progress bar
150 /// pointer to the ??? method for any progress bar
151 Method* StartMethodArgDelete;
152 /// pointer to the ??? method for any progress bar
153 Method* ProgressMethodArgDelete;
154 /// pointer to the ??? method for any progress bar
155 Method* EndMethodArgDelete;
156 /// pointer to the ??? for any progress bar
158 /// pointer to the ??? for any progress bar
160 /// pointer to the ??? for any progress bar
162 /// value of the ??? for any progress bar
164 /// value of the ??? for any progress bar
167 } // end namespace gdcm
168 //-----------------------------------------------------------------------------