1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/07/02 13:55:27 $
7 Version: $Revision: 1.23 $
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.htm 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"
31 //-----------------------------------------------------------------------------
32 typedef std::list<gdcmDicomDirPatient*> ListDicomDirPatient;
33 typedef std::vector<gdcmDocument*> VectDocument;
35 typedef GDCM_EXPORT void(gdcmMethod)(void * = NULL);
36 //-----------------------------------------------------------------------------
39 * \ingroup gdcmDicomDir
40 * \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
43 class GDCM_EXPORT gdcmDicomDir: public gdcmDocument
46 gdcmDicomDir(const char *FileName,
47 bool parseDir = false,
48 bool exception_on_error = false);
49 gdcmDicomDir(bool exception_on_error = false);
53 /// \brief Sets the print level for the Dicom Header
54 /// \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
55 void SetPrintLevel(int level)
56 { printLevel = level; };
58 /// \brief canonical Printer
60 virtual void Print(std::ostream &os = std::cout);
62 // Informations contained in the parser
63 virtual bool IsReadable(void);
65 /// Returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
66 gdcmDicomDirMeta* GetDicomDirMeta() { return metaElems; };
68 /// Returns the PATIENT chained List for this DICOMDIR.
69 ListDicomDirPatient &GetDicomDirPatients() { return patients; };
72 void ParseDirectory(void);
74 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
75 void SetStartMethodArgDelete(gdcmMethod *);
76 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
77 void SetProgressMethodArgDelete(gdcmMethod *);
78 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
79 void SetEndMethodArgDelete(gdcmMethod *);
81 /// GetProgress GetProgress
82 float GetProgress(void) { return(progress); };
84 /// AbortProgress AbortProgress
85 void AbortProgress(void) {abort=true; };
87 /// IsAborted IsAborted
88 bool IsAborted(void) {return(abort); };
91 gdcmDicomDirMeta* NewMeta(void);
92 gdcmDicomDirPatient* NewPatient(void);
95 void WriteEntries(FILE *_fp);
96 bool Write(std::string fileName);
98 /// Types of the gdcmObject within the gdcmDicomDir
103 GDCM_DICOMDIR_PATIENT,
110 void CreateDicomDirChainedList(std::string path);
111 void CallStartMethod(void);
112 void CallProgressMethod(void);
113 void CallEndMethod(void);
116 void Initialize(void);
117 void CreateDicomDir(void);
118 void AddDicomDirMeta ();
119 void AddDicomDirPatientToEnd(gdcmSQItem *s);
120 void AddDicomDirStudyToEnd (gdcmSQItem *s);
121 void AddDicomDirSerieToEnd (gdcmSQItem *s);
122 void AddDicomDirImageToEnd (gdcmSQItem *s);
124 void SetElements(std::string &path, VectDocument &list);
125 void SetElement (std::string &path,gdcmDicomDirType type,
126 gdcmDocument *header);
128 void UpdateDirectoryRecordSequenceLength(void);
130 static bool HeaderLessThan(gdcmDocument *header1,gdcmDocument *header2);
134 /// Pointer on *the* gdcmObject 'DicomDirMeta Elements'
135 gdcmDicomDirMeta *metaElems;
137 /// Chained list of DicomDirPatient (to be exploited recursively)
138 ListDicomDirPatient patients;
140 /// pointer to the initialisation method for any progress bar
141 gdcmMethod *startMethod;
142 /// pointer to the incrementation method for any progress bar
143 gdcmMethod *progressMethod;
144 /// pointer to the tremination method for any progress bar
145 gdcmMethod *endMethod;
146 /// pointer to the ??? method for any progress bar
147 gdcmMethod *startMethodArgDelete;
148 /// pointer to the ??? method for any progress bar
149 gdcmMethod *progressMethodArgDelete;
150 /// pointer to the ??? method for any progress bar
151 gdcmMethod *endMethodArgDelete;
152 /// pointer to the ??? for any progress bar
154 /// pointer to the ??? for any progress bar
156 /// pointer to the ??? for any progress bar
158 /// value of the ??? for any progress bar
160 /// value of the ??? for any progress bar
164 //-----------------------------------------------------------------------------