Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gdcmDicomDir.h

Go to the documentation of this file.
00001 /*=========================================================================
00002   
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDicomDir.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/11/29 17:21:34 $
00007   Version:   $Revision: 1.73 $
00008   
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012   
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016   
00017 =========================================================================*/
00018 
00019 #ifndef GDCMDICOMDIR_H
00020 #define GDCMDICOMDIR_H
00021 
00022 #include "gdcmDocument.h"
00023 #include "gdcmDebug.h"
00024 
00025 #include <list>
00026 #include <vector>
00027 
00028 namespace gdcm 
00029 {
00030 //-----------------------------------------------------------------------------
00031 class DicomDirPatient;
00032 class DicomDirMeta;
00033 class DicomDirElement;
00034 class DicomDirStudy;
00035 class DicomDirSerie;
00036 class DicomDirVisit;
00037 class DicomDirImage;
00038 class SQItem;
00039 
00040 typedef std::list<DicomDirPatient *> ListDicomDirPatient;
00041 typedef std::vector<Document *> VectDocument;
00042 
00043 //-----------------------------------------------------------------------------
00051 class GDCM_EXPORT DicomDir: public Document
00052 {
00053    gdcmTypeMacro(DicomDir);
00054 
00055 public:
00057    static DicomDir *New() {return new DicomDir();}
00058 
00059    bool Load( );
00060    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
00061    
00063    void SetDirectoryName(std::string const &dirName) 
00064         { ParseDir = true; if (Filename != dirName)
00065                                Filename = dirName, IsDocumentModified = true; }
00067    virtual void SetFileName(std::string const &fileName) 
00068                    { ParseDir = false; if (Filename != fileName)
00069                               Filename = fileName, IsDocumentModified = true;}
00070    
00071    // Informations contained in the parser
00072    virtual bool IsReadable();
00073 
00074    // Meta
00075    DicomDirMeta *NewMeta();
00077    DicomDirMeta *GetMeta() { return MetaElems; }
00078 
00079    // Patients
00080    DicomDirPatient *NewPatient();
00081    void ClearPatient();
00082 
00083    DicomDirPatient *GetFirstPatient();
00084    DicomDirPatient *GetNextPatient();
00085 
00086    // Parsing
00087    void ParseDirectory();
00088 
00090    float GetProgress() const { return Progress; }
00092    void  AbortProgress() { Abort = true; }
00094    bool  IsAborted() { return Abort; }
00095 
00096    // Write
00097    bool Write(std::string const &fileName);
00098 
00099    bool Anonymize();
00100 
00101    virtual void Copy(DocEntrySet *set);
00102 
00104    typedef enum
00105    {
00106       GDCM_DICOMDIR_NONE,
00107       GDCM_DICOMDIR_META,
00108       GDCM_DICOMDIR_PATIENT,
00109       GDCM_DICOMDIR_STUDY,
00110       GDCM_DICOMDIR_SERIE,
00111       GDCM_DICOMDIR_VISIT,
00112       GDCM_DICOMDIR_IMAGE
00113    } DicomDirType;
00114    
00115 protected:
00116    DicomDir(); 
00117    ~DicomDir();
00118 
00119    void CreateDicomDirChainedList(std::string const &path);
00120 
00121 private:
00122    void Initialize();
00123    void CreateDicomDir();
00124    bool DoTheLoadingJob();
00125    bool AddPatientToEnd(DicomDirPatient *dd);
00126    bool AddStudyToEnd  (DicomDirStudy *dd);
00127    bool AddSerieToEnd  (DicomDirSerie *dd);
00128    bool AddVisitToEnd  (DicomDirVisit *dd);
00129    bool AddImageToEnd  (DicomDirImage *dd);
00130 
00131    void SetElements(std::string const &path, VectDocument const &list);
00132    void SetElement (std::string const &path, DicomDirType type,
00133                     Document *header);
00134    void MoveSQItem(DocEntrySet *dst, DocEntrySet *src);
00135 
00136    static bool HeaderLessThan(Document *header1, Document *header2);
00137    
00138 // Variables
00139 
00141    DicomDirMeta *MetaElems;
00142 
00144    ListDicomDirPatient Patients;
00145    ListDicomDirPatient::iterator ItPatient;
00146 
00148    bool ParseDir;
00149 
00150 };
00151 } // end namespace gdcm
00152 //-----------------------------------------------------------------------------
00153 #endif

Generated on Fri Jan 20 10:14:24 2006 for gdcm by  doxygen 1.4.4