Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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/02/07 14:48:34 $
00007   Version:   $Revision: 1.55 $
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 
00024 #include <list>
00025 #include <vector>
00026 
00027 namespace gdcm 
00028 {
00029 //-----------------------------------------------------------------------------
00030 class DicomDirPatient;
00031 class DicomDirMeta;
00032 class DicomDirElement;
00033 class DicomDirStudy;
00034 class DicomDirSerie;
00035 class DicomDirImage;
00036 class SQItem;
00037 
00038 typedef std::list<DicomDirPatient *>   ListDicomDirPatient;
00039 typedef std::vector<Document *>  VectDocument;
00040 
00041 //-----------------------------------------------------------------------------
00049 class GDCM_EXPORT DicomDir: public Document
00050 {
00051 public:
00052    typedef void(Method)(void*);
00053 
00054    DicomDir( std::string const &filename, bool parseDir = false );
00055    DicomDir(); 
00056                    
00057    ~DicomDir();
00058 
00059    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
00060 
00061    // Informations contained in the parser
00062    virtual bool IsReadable();
00063 
00064    // Meta
00065    DicomDirMeta    *NewMeta();
00067    DicomDirMeta* GetMeta() { return MetaElems; };
00068 
00069    // Patients
00070    DicomDirPatient *NewPatient();
00071    void ClearPatient();
00072 
00073    DicomDirPatient *GetFirstPatient();
00074    DicomDirPatient *GetNextPatient();
00075 
00076    // Parsing
00077    void ParseDirectory();
00078 
00079    // Note: the DicomDir:: namespace prefix is needed by Swig in the 
00080    //       following method declarations. Refer to gdcmPython/gdcm.i
00081    //       for the reasons of this unecessary notation at C++ level.
00082    void SetStartMethod(    DicomDir::Method *method,
00083                            void *arg = NULL,
00084                            DicomDir::Method *argDelete = NULL );
00085    void SetProgressMethod( DicomDir::Method *method, 
00086                            void *arg = NULL,
00087                            DicomDir::Method *argDelete = NULL );
00088    void SetEndMethod(      DicomDir::Method *method,
00089                            void *arg = NULL, 
00090                            DicomDir::Method *argDelete = NULL );
00091    void SetStartMethodArgDelete( DicomDir::Method *m );
00092    void SetProgressMethodArgDelete( DicomDir::Method *m );
00093    void SetEndMethodArgDelete( DicomDir::Method *m );
00094 
00096    float GetProgress()  { return Progress; };
00098    void  AbortProgress() { Abort = true; };
00100    bool  IsAborted() { return Abort; };
00101 
00102    // Write
00103    bool WriteDicomDir(std::string const &fileName);
00104 
00106    typedef enum
00107    {
00108       GDCM_DICOMDIR_NONE,
00109       GDCM_DICOMDIR_META,
00110       GDCM_DICOMDIR_PATIENT,
00111       GDCM_DICOMDIR_STUDY,
00112       GDCM_DICOMDIR_SERIE,
00113       GDCM_DICOMDIR_IMAGE
00114    } DicomDirType;
00115    
00116 protected:
00117    void CreateDicomDirChainedList(std::string const &path);
00118    void CallStartMethod();
00119    void CallProgressMethod();
00120    void CallEndMethod();
00121 
00122 private:
00123    void Initialize();
00124    void CreateDicomDir();
00125 
00126    bool AddPatientToEnd(DicomDirPatient *dd);
00127    bool AddStudyToEnd  (DicomDirStudy *dd);
00128    bool AddSerieToEnd  (DicomDirSerie *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    Method *StartMethod;
00150    Method *ProgressMethod;
00152    Method *EndMethod;
00154    Method *StartMethodArgDelete;
00156    Method* ProgressMethodArgDelete;
00158    Method *EndMethodArgDelete;
00160    void *StartArg;
00162    void *ProgressArg;
00164    void *EndArg;
00166    float Progress;
00168    bool Abort;
00169 };
00170 } // end namespace gdcm
00171 //-----------------------------------------------------------------------------
00172 #endif

Generated on Thu Feb 10 22:17:56 2005 for gdcm by doxygen 1.3.6