]> Creatis software - gdcm.git/blob - vtk/vtkGdcmWriter.h
Example a using new features .
[gdcm.git] / vtk / vtkGdcmWriter.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: vtkGdcmWriter.h,v $
5   Language:  C++
6   Date:      $Date: 2006/03/17 14:46:18 $
7   Version:   $Revision: 1.7 $
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 VTK_EXPORT vtkGdcmWriter : public vtkImageWriter
43 {
44 public:
45    static vtkGdcmWriter *New();
46    vtkTypeRevisionMacro(vtkGdcmWriter, vtkImageWriter);
47
48    void PrintSelf(ostream &os, vtkIndent indent);
49
50    vtkSetObjectMacro(LookupTable, vtkLookupTable);
51    vtkGetObjectMacro(LookupTable, vtkLookupTable);
52
53    void SetWriteTypeToDcmImplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_EXPLICIT_VR);};
54    void SetWriteTypeToDcmExplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR);};
55    void SetWriteTypeToAcr()      {SetWriteType(VTK_GDCM_WRITE_TYPE_ACR);        };
56    void SetWriteTypeToAcrLibido(){SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); };
57    
58    void SetContentTypeToUserOwnImage()         {SetContentType(VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE);};   
59    void SetContentTypeToFilteredImage()        {SetContentType(VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE);};   
60    void SetContentTypeToUserCreatedImage()     {SetContentType(VTK_GDCM_WRITE_TYPE_CREATED_IMAGE);};   
61    void SetContentTypeToUnmodifiedPixelsImage(){SetContentType(VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE);};   
62    
63    vtkSetMacro(WriteType, int);
64    vtkGetMacro(WriteType, int);
65    const char *GetWriteTypeAsString();
66
67 //BTX
68    vtkSetMacro(GdcmFile, gdcm::File *);
69    vtkGetMacro(GdcmFile, gdcm::File *);
70 //ETX
71
72    vtkSetMacro(ContentType, int);
73    vtkGetMacro(ContentType, int);
74
75      
76 protected:
77    vtkGdcmWriter();
78    ~vtkGdcmWriter();
79
80   virtual void RecursiveWrite(int axis, vtkImageData *image, ofstream *file);
81   virtual void RecursiveWrite(int axis, vtkImageData *image, 
82                               vtkImageData *cache, ofstream *file);
83   void WriteDcmFile(char *fileName, vtkImageData *image);
84
85 private:
86 // Variables
87    vtkLookupTable *LookupTable;
88    int WriteType;
89 //BTX
90    gdcm::File *GdcmFile;
91 //ETX
92    int ContentType;
93    
94 };
95
96 //-----------------------------------------------------------------------------
97 #endif