00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018                                                                                 
00019 #ifndef __vtkGdcmWriter_h
00020 #define __vtkGdcmWriter_h
00021 
00022 #include "gdcmCommon.h" 
00023 #include "gdcmFile.h"   
00024 
00025 #include <vtkImageWriter.h>
00026 #include <vtkLookupTable.h>
00027 #include <string>
00028 
00029 
00030 
00031 #define VTK_GDCM_WRITE_TYPE_EXPLICIT_VR 1
00032 #define VTK_GDCM_WRITE_TYPE_IMPLICIT_VR 2
00033 #define VTK_GDCM_WRITE_TYPE_ACR         3
00034 #define VTK_GDCM_WRITE_TYPE_ACR_LIBIDO  4
00035 
00036 #define VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE          1
00037 #define VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE          2
00038 #define VTK_GDCM_WRITE_TYPE_CREATED_IMAGE           3
00039 #define VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE 4
00040 
00041 
00042 class vtkLookupTable;
00043 class vtkMedicalImageProperties;
00044 
00045 class VTK_EXPORT vtkGdcmWriter : public vtkImageWriter
00046 {
00047 public:
00048    static vtkGdcmWriter *New();
00049    vtkTypeRevisionMacro(vtkGdcmWriter, vtkImageWriter);
00050 
00051    void PrintSelf(ostream &os, vtkIndent indent);
00052 
00053    
00054    virtual void SetLookupTable(vtkLookupTable*);
00055    vtkGetObjectMacro(LookupTable, vtkLookupTable);
00056 
00057    void SetWriteTypeToDcmImplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_EXPLICIT_VR);}
00058    void SetWriteTypeToDcmExplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR);}
00059    void SetWriteTypeToAcr()      {SetWriteType(VTK_GDCM_WRITE_TYPE_ACR);        }
00060    void SetWriteTypeToAcrLibido(){SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); }
00061    
00062 
00063    
00064    
00065    
00066    
00067    
00068    
00069    
00070    
00071    
00072    
00073    
00074    
00075    
00076    void SetContentTypeToUserOwnImage()         {SetContentType(VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE);}   
00077    void SetContentTypeToFilteredImage()        {SetContentType(VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE);}   
00078    void SetContentTypeToUserCreatedImage()     {SetContentType(VTK_GDCM_WRITE_TYPE_CREATED_IMAGE);}   
00079    void SetContentTypeToUnmodifiedPixelsImage(){SetContentType(VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE);}   
00080    
00081    vtkSetMacro(WriteType, int);
00082    vtkGetMacro(WriteType, int);
00083    const char *GetWriteTypeAsString();
00084 
00085 
00086 
00087    
00088    
00089    
00090    
00091    
00092    vtkSetMacro(GdcmFile, GDCM_NAME_SPACE::File *);
00093    vtkGetMacro(GdcmFile, GDCM_NAME_SPACE::File *);
00094 
00095 
00096    vtkSetMacro(ContentType, int);
00097    vtkGetMacro(ContentType, int);
00098 
00099    
00100    
00101    
00102 #if (VTK_MAJOR_VERSION >= 5)   
00103    void SetMedicalImageProperties(vtkMedicalImageProperties*);
00104 #else
00105    void SetMedicalImageProperties(vtkMedicalImageProperties*) {}
00106 #endif
00107         
00108 protected:
00109    vtkGdcmWriter();
00110    ~vtkGdcmWriter();
00111 
00112   virtual void RecursiveWrite(int axis, vtkImageData *image, ofstream *file);
00113   virtual void RecursiveWrite(int axis, vtkImageData *image, 
00114                               vtkImageData *cache, ofstream *file);
00115   void WriteDcmFile(char *fileName, vtkImageData *image);
00116 
00117 private:
00118 
00119    vtkLookupTable *LookupTable;
00120    vtkMedicalImageProperties *MedicalImageProperties;   
00121    int WriteType;
00122 
00123    GDCM_NAME_SPACE::File *GdcmFile;
00124 
00125    int ContentType;
00126    
00127 };
00128 
00129 
00130 #endif