]> Creatis software - gdcm.git/blob - vtk/vtkGdcmWriter.h
305aede70d7bb13cb48d5c6bfb8cb63ae468746f
[gdcm.git] / vtk / vtkGdcmWriter.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: vtkGdcmWriter.h,v $
5   Language:  C++
6   Date:      $Date: 2006/05/02 10:09:43 $
7   Version:   $Revision: 1.8 $
8                                                                                 
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.html for details.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18                                                                                 
19 #ifndef __vtkGdcmWriter_h
20 #define __vtkGdcmWriter_h
21
22 #include "gdcmCommon.h" // To avoid warnings concerning the std
23 #include "gdcmFile.h"   // for gdcm::File
24
25 #include <vtkImageWriter.h>
26 #include <vtkLookupTable.h>
27 #include <string>
28
29 //-----------------------------------------------------------------------------
30
31 #define VTK_GDCM_WRITE_TYPE_EXPLICIT_VR 1
32 #define VTK_GDCM_WRITE_TYPE_IMPLICIT_VR 2
33 #define VTK_GDCM_WRITE_TYPE_ACR         3
34 #define VTK_GDCM_WRITE_TYPE_ACR_LIBIDO  4
35
36 #define VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE          1
37 #define VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE          2
38 #define VTK_GDCM_WRITE_TYPE_CREATED_IMAGE           3
39 #define VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE 4
40
41 //-----------------------------------------------------------------------------
42 class vtkLookupTable;
43 class vtkMedicalImageProperties;
44
45 class VTK_EXPORT vtkGdcmWriter : public vtkImageWriter
46 {
47 public:
48    static vtkGdcmWriter *New();
49    vtkTypeRevisionMacro(vtkGdcmWriter, vtkImageWriter);
50
51    void PrintSelf(ostream &os, vtkIndent indent);
52
53    //vtkSetObjectMacro(LookupTable, vtkLookupTable);
54    virtual void SetLookupTable(vtkLookupTable*);
55    vtkGetObjectMacro(LookupTable, vtkLookupTable);
56
57    void SetWriteTypeToDcmImplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_EXPLICIT_VR);};
58    void SetWriteTypeToDcmExplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR);};
59    void SetWriteTypeToAcr()      {SetWriteType(VTK_GDCM_WRITE_TYPE_ACR);        };
60    void SetWriteTypeToAcrLibido(){SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); };
61    
62    void SetContentTypeToUserOwnImage()         {SetContentType(VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE);};   
63    void SetContentTypeToFilteredImage()        {SetContentType(VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE);};   
64    void SetContentTypeToUserCreatedImage()     {SetContentType(VTK_GDCM_WRITE_TYPE_CREATED_IMAGE);};   
65    void SetContentTypeToUnmodifiedPixelsImage(){SetContentType(VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE);};   
66    
67    vtkSetMacro(WriteType, int);
68    vtkGetMacro(WriteType, int);
69    const char *GetWriteTypeAsString();
70
71
72 //BTX
73    vtkSetMacro(GdcmFile, gdcm::File *);
74    vtkGetMacro(GdcmFile, gdcm::File *);
75 //ETX
76
77    vtkSetMacro(ContentType, int);
78    vtkGetMacro(ContentType, int);
79
80    // Description:
81    // To pass in some extra information from a VTK context a user can pass a
82    // vtkMedicalImageProperties object
83 #if (VTK_MAJOR_VERSION >= 5)   
84    void SetMedicalImageProperties(vtkMedicalImageProperties*);
85 #else
86    void SetMedicalImageProperties(vtkMedicalImageProperties*) {}
87 #endif
88         
89 protected:
90    vtkGdcmWriter();
91    ~vtkGdcmWriter();
92
93   virtual void RecursiveWrite(int axis, vtkImageData *image, ofstream *file);
94   virtual void RecursiveWrite(int axis, vtkImageData *image, 
95                               vtkImageData *cache, ofstream *file);
96   void WriteDcmFile(char *fileName, vtkImageData *image);
97
98 private:
99 // Variables
100    vtkLookupTable *LookupTable;
101    vtkMedicalImageProperties *MedicalImageProperties;   
102    int WriteType;
103 //BTX
104    gdcm::File *GdcmFile;
105 //ETX
106    int ContentType;
107    
108 };
109
110 //-----------------------------------------------------------------------------
111 #endif