]> Creatis software - gdcm.git/blob - vtk/vtkGdcmWriter.h
3de9c069d8ad371a6be3e1bb1004ab7f1cac8434
[gdcm.git] / vtk / vtkGdcmWriter.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: vtkGdcmWriter.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/28 10:07:35 $
7   Version:   $Revision: 1.5 $
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
24 #include <vtkImageWriter.h>
25 #include <vtkLookupTable.h>
26 #include <string>
27
28 //-----------------------------------------------------------------------------
29 #define VTK_GDCM_WRITE_TYPE_EXPLICIT_VR 1
30 #define VTK_GDCM_WRITE_TYPE_IMPLICIT_VR 2
31 #define VTK_GDCM_WRITE_TYPE_ACR         3
32 #define VTK_GDCM_WRITE_TYPE_ACR_LIBIDO  4
33
34 //-----------------------------------------------------------------------------
35 class VTK_EXPORT vtkGdcmWriter : public vtkImageWriter
36 {
37 public:
38    static vtkGdcmWriter *New();
39    vtkTypeRevisionMacro(vtkGdcmWriter, vtkImageWriter);
40
41    void PrintSelf(ostream& os, vtkIndent indent);
42
43    vtkSetObjectMacro(LookupTable,vtkLookupTable);
44    vtkGetObjectMacro(LookupTable,vtkLookupTable);
45
46    void SetWriteTypeToDcmImplVR()     { SetWriteType(VTK_GDCM_WRITE_TYPE_EXPLICIT_VR); };
47    void SetWriteTypeToDcmExplVR()     { SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR); };
48    void SetWriteTypeToAcr()           { SetWriteType(VTK_GDCM_WRITE_TYPE_ACR); };
49    void SetWriteTypeToAcrLibido()     { SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); };
50    vtkSetMacro(WriteType,int);
51    vtkGetMacro(WriteType,int);
52    const char *GetWriteTypeAsString();
53
54    void SetUIDPrefix(const char *prefix);
55    const char *GetUIDPrefix();
56
57    void NewStudyInstanceUID();
58    void NewSeriesInstanceUID();
59    void NewFrameOfReferenceInstanceUID();
60
61 protected:
62    vtkGdcmWriter();
63    ~vtkGdcmWriter();
64
65   virtual void RecursiveWrite(int axis, vtkImageData *image, ofstream *file);
66   virtual void RecursiveWrite(int axis, vtkImageData *image, 
67                               vtkImageData *cache, ofstream *file);
68   void WriteDcmFile(char *fileName,vtkImageData *image);
69
70 private:
71 // Variables
72    vtkLookupTable *LookupTable;
73    int WriteType;
74
75    //BTX
76    std::string UIDPrefix;
77    std::string StudyInstanceUID;
78    std::string SeriesInstanceUID;
79    std::string FrameOfReferenceInstanceUID;
80    //ETX
81 };
82
83 //-----------------------------------------------------------------------------
84 #endif