]> Creatis software - gdcm.git/blob - vtk/vtkGdcmWriter.h
Fix mistypings
[gdcm.git] / vtk / vtkGdcmWriter.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: vtkGdcmWriter.h,v $
5   Language:  C++
6   Date:      $Date: 2007/06/21 14:47:16 $
7   Version:   $Revision: 1.12 $
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_NAME_SPACE::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
63    // gdcm cannot guess how user built his image (and therefore cannot be clever about some Dicom fields)
64    // It's up to the user to tell gdcm what he did. 
65    // -1) user created ex nihilo his own image and wants to write it as a Dicom image.
66    // USER_OWN_IMAGE
67    // -2) user modified the pixels of an existing image.
68    // FILTERED_IMAGE
69    // -3) user created a new image, using existing a set of images (eg MIP, MPR, cartography image)
70    //  CREATED_IMAGE
71    // -4) user modified/added some tags *without processing* the pixels (anonymization..
72    //  UNMODIFIED_PIXELS_IMAGE 
73    // -Probabely some more to be added 
74    //(see gdcmFileHelper.h for more explanations)
75    
76    void SetContentTypeToUserOwnImage()         {SetContentType(VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE);}   
77    void SetContentTypeToFilteredImage()        {SetContentType(VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE);}   
78    void SetContentTypeToUserCreatedImage()     {SetContentType(VTK_GDCM_WRITE_TYPE_CREATED_IMAGE);}   
79    void SetContentTypeToUnmodifiedPixelsImage(){SetContentType(VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE);}   
80    
81    vtkSetMacro(WriteType, int);
82    vtkGetMacro(WriteType, int);
83    const char *GetWriteTypeAsString();
84
85
86 //BTX
87    // Description:
88    // Aware user is allowed to pass his own GDCM_NAME_SPACE::File *, so he may set *any Dicom field* he wants.
89    // (including his own Shadow Elements, or any GDCM_NAME_SPACE::SeqEntry)
90    // GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements() will check inconsistencies, as far as it knows how.
91    // Sorry, not yet available under Python.
92    vtkSetMacro(GdcmFile, GDCM_NAME_SPACE::File *);
93    vtkGetMacro(GdcmFile, GDCM_NAME_SPACE::File *);
94 //ETX
95
96    vtkSetMacro(ContentType, int);
97    vtkGetMacro(ContentType, int);
98
99    // Description:
100    // To pass in some extra information from a VTK context a user can pass a
101    // vtkMedicalImageProperties object
102 #if (VTK_MAJOR_VERSION >= 5)   
103    void SetMedicalImageProperties(vtkMedicalImageProperties*);
104 #else
105    void SetMedicalImageProperties(vtkMedicalImageProperties*) {}
106 #endif
107         
108 protected:
109    vtkGdcmWriter();
110    ~vtkGdcmWriter();
111
112   virtual void RecursiveWrite(int axis, vtkImageData *image, ofstream *file);
113   virtual void RecursiveWrite(int axis, vtkImageData *image, 
114                               vtkImageData *cache, ofstream *file);
115   void WriteDcmFile(char *fileName, vtkImageData *image);
116
117 private:
118 // Variables
119    vtkLookupTable *LookupTable;
120    vtkMedicalImageProperties *MedicalImageProperties;   
121    int WriteType;
122 //BTX
123    GDCM_NAME_SPACE::File *GdcmFile;
124 //ETX
125    int ContentType;
126    
127 };
128
129 //-----------------------------------------------------------------------------
130 #endif