00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018                                                                                 
00019 #ifndef __vtkGdcmReader_h
00020 #define __vtkGdcmReader_h
00021 
00022 #include "gdcmCommon.h" 
00023 #include "gdcmFile.h"
00024 
00025 #include <vtkImageReader.h>
00026 #include <list>
00027 #include <string>
00028 #include <vector>
00029 
00030 typedef void (*VOID_FUNCTION_PUINT8_PFILE_POINTER)(uint8_t *, GDCM_NAME_SPACE::File *);
00031 
00032 
00033 class vtkLookupTable;
00034 
00035 
00036 class VTK_EXPORT vtkGdcmReader : public vtkImageReader
00037 {
00038 public:
00039    static vtkGdcmReader *New();
00040    vtkTypeRevisionMacro(vtkGdcmReader, vtkImageReader);
00041    void PrintSelf(ostream& os, vtkIndent indent);
00042 
00043    virtual void RemoveAllFileName(void);
00044    virtual void AddFileName(const char *name);
00045    virtual void SetFileName(const char *name);
00046 
00047    
00048    void SetCoherentFileList( std::vector<GDCM_NAME_SPACE::File* > *cfl) {
00049                                                       CoherentFileList = cfl; }    
00050    
00051 
00052    
00053    
00054    
00055 
00056    
00057    
00059    
00060    void SetUserFunction (VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc )
00061                         { UserFunction = userFunc; } 
00062    
00063   
00064    
00065    
00066    
00067    
00068    vtkSetMacro(AllowLookupTable, bool);
00069    vtkGetMacro(AllowLookupTable, bool);
00070    vtkBooleanMacro(AllowLookupTable, bool);
00071 
00072    vtkGetObjectMacro(LookupTable, vtkLookupTable);
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084    vtkSetMacro(LoadMode, int);
00085    vtkGetMacro(LoadMode, int);
00086    vtkBooleanMacro(LoadMode, int);
00087  
00088 
00089 
00090 
00091 
00092    
00093    vtkSetMacro(DropDuplicatePositions, bool);
00094    vtkGetMacro(DropDuplicatePositions, bool);
00095    vtkBooleanMacro(DropDuplicatePositions, bool);      
00096 
00097 protected:
00098    vtkGdcmReader();
00099    ~vtkGdcmReader();
00100 
00101    virtual void ExecuteInformation();
00102    virtual void ExecuteData(vtkDataObject *output);
00103 
00104    
00105    virtual void BuildFileListFromPattern();
00106    virtual void LoadFileInformation();
00107    virtual void UpdateFileInformation();
00108    
00109    virtual void GetFileInformation(GDCM_NAME_SPACE::File *file);
00110    virtual bool TestFileInformation(GDCM_NAME_SPACE::File *file);
00111    
00112 
00113 private:
00114    void RemoveAllInternalFileName(void);
00115    void AddInternalFileName(const char *name);
00116    void RemoveAllInternalFile(void);
00117 
00118    
00119    void IncrementProgress(const unsigned long updateProgressTarget,
00120                           unsigned long &updateProgressCount);
00121    
00122 
00123 
00124 
00125    void LoadImageInMemory(GDCM_NAME_SPACE::File *f, unsigned char *dest,
00126                           const unsigned long updateProgressTarget,
00127                           unsigned long &updateProgressCount);
00128    
00129 
00130 
00131    
00132    typedef std::vector<GDCM_NAME_SPACE::File *> gdcmFileList;
00133    
00134 
00135    vtkLookupTable *LookupTable;
00136    vtkTimeStamp fileTime;
00137 
00138    bool AllowLookupTable;
00139    bool AllowLightChecking;
00140 
00141    
00142    
00143    int NumColumns;
00144    
00145    int NumLines;
00146    
00147    int NumPlanes;
00148    
00149    int TotalNumberOfPlanes;
00150    
00151    int NumComponents;
00152    
00153    std::string ImageType;
00154    
00155    size_t PixelSize;
00156    
00157    
00158    std::list<std::string> FileNameList;
00159    gdcmFileList *CoherentFileList;
00160    bool OwnFile;
00161 
00162    
00163    
00164    
00165    
00166    
00167    
00168    std::list<std::string> InternalFileNameList;
00169    gdcmFileList InternalFileList;
00170    
00171   
00172    
00173 
00179    int LoadMode;
00180     
00181    bool DropDuplicatePositions;
00182    
00184    VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
00185 
00186 };
00187 
00188 
00189 #endif
00190