vtkgdcm
vtkGDCMImageWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
41 #ifndef VTKGDCMIMAGEWRITER_H
42 #define VTKGDCMIMAGEWRITER_H
43 
44 #include "vtkgdcmModule.h"
45 #include "vtkImageWriter.h"
46 #include "vtkVersion.h"
47 
48 class vtkLookupTable;
49 class vtkMedicalImageProperties;
50 class vtkMatrix4x4;
51 class vtkStringArray;
52 class VTKGDCM_EXPORT vtkGDCMImageWriter : public vtkImageWriter
53 {
54 public:
56  vtkTypeMacro(vtkGDCMImageWriter,vtkImageWriter);
57  virtual void PrintSelf(ostream& os, vtkIndent indent);
58 
60 
64  vtkGetObjectMacro(MedicalImageProperties, vtkMedicalImageProperties);
65  virtual void SetMedicalImageProperties(vtkMedicalImageProperties*);
67 
69 
72  virtual void SetFileNames(vtkStringArray*);
73  vtkGetObjectMacro(FileNames, vtkStringArray);
75 
77 
80  vtkGetMacro(LossyFlag,int);
81  vtkSetMacro(LossyFlag,int);
82  vtkBooleanMacro(LossyFlag,int);
84 
85  // I need that...
86  virtual void Write();
87 
91  virtual const char* GetFileExtensions() {
92  return ".dcm .DCM"; }
93 
97  virtual const char* GetDescriptiveName() {
98  return "DICOM"; }
99 
101 
105  virtual void SetDirectionCosines(vtkMatrix4x4 *matrix);
106  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
107  virtual void SetDirectionCosinesFromImageOrientationPatient(const double dircos[6]);
109 
111 
114  vtkSetMacro(Shift, double);
115  vtkGetMacro(Shift, double);
116  vtkSetMacro(Scale, double);
117  vtkGetMacro(Scale, double);
119 
121 
124  vtkGetMacro(ImageFormat,int);
125  vtkSetMacro(ImageFormat,int);
127 
129 
133  vtkBooleanMacro(FileLowerLeft, int);
134  vtkGetMacro(FileLowerLeft, int);
135  vtkSetMacro(FileLowerLeft, int);
137 
139 
142  vtkSetMacro(PlanarConfiguration,int);
143  vtkGetMacro(PlanarConfiguration,int);
145 
147 
150  vtkSetStringMacro(StudyUID);
151  vtkGetStringMacro(StudyUID);
152  vtkSetStringMacro(SeriesUID);
153  vtkGetStringMacro(SeriesUID);
155 
156 //BTX
158  NO_COMPRESSION = 0, // raw (default)
161  JPEGLS_COMPRESSION, // JPEG-LS
162  RLE_COMPRESSION // RLE
163  };
164 //ETX
165  // Set/Get the compression type
166  vtkSetMacro(CompressionType, int);
167  vtkGetMacro(CompressionType, int);
168 
169  //void SetCompressionTypeFromString(const char *);
170  //const char *GetCompressionTypeAsString();
171 
172 protected:
175 
176 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
177  int FillInputPortInformation(int port, vtkInformation *info);
178  int RequestInformation(
179  vtkInformation *request,
180  vtkInformationVector **inputVector,
181  vtkInformationVector *outputVector);
182  int RequestUpdateExtent(
183  vtkInformation *request,
184  vtkInformationVector **inputVector,
185  vtkInformationVector *outputVector);
186  int RequestData(
187  vtkInformation *request,
188  vtkInformationVector **inputVector,
189  vtkInformationVector *outputVector);
190 #else
191  void WriteSlice(vtkImageData *data);
192 #endif /*(VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )*/
193  int WriteGDCMData(vtkImageData *data, int timeStep);
194 
195 protected:
196  virtual /*const*/ char *GetFileName();
197 
198 private:
199  vtkGDCMImageWriter(const vtkGDCMImageWriter&); // Not implemented.
200  void operator=(const vtkGDCMImageWriter&); // Not implemented.
201 
202  // VTK structs:
203  //vtkLookupTable *LookupTable;
204  vtkMedicalImageProperties *MedicalImageProperties;
205  char *StudyUID;
206  char *SeriesUID;
207 
208  int DataUpdateExtent[6];
209  int ImageFormat;
210 
211  vtkStringArray *FileNames;
212  vtkMatrix4x4 *DirectionCosines;
213 
214  double Shift;
215  double Scale;
216  int FileLowerLeft;
217  int PlanarConfiguration;
218  int LossyFlag;
219  int CompressionType;
220 };
221 
222 #endif
write DICOM files
virtual void Write()
virtual void SetMedicalImageProperties(vtkMedicalImageProperties *)
virtual const char * GetDescriptiveName()
Get the name of this file format.
virtual void SetFileNames(vtkStringArray *)
Pass in the list of filename to be used to write out the DICOM file(s)
void WriteSlice(vtkImageData *data)
virtual char * GetFileName()
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual void SetDirectionCosines(vtkMatrix4x4 *matrix)
You need to manually specify the direction the image is in to write a valid DICOM file since vtkImage...
virtual void SetDirectionCosinesFromImageOrientationPatient(const double dircos[6])
virtual const char * GetFileExtensions()
Get the entension for this file format.
static vtkGDCMImageWriter * New()
int WriteGDCMData(vtkImageData *data, int timeStep)