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 "vtkImageWriter.h"
45 #include "vtkVersion.h"
46 
47 class vtkLookupTable;
48 class vtkMedicalImageProperties;
49 class vtkMatrix4x4;
50 class vtkStringArray;
51 class VTK_EXPORT vtkGDCMImageWriter : public vtkImageWriter
52 {
53 public:
55  vtkTypeMacro(vtkGDCMImageWriter,vtkImageWriter);
56  virtual void PrintSelf(ostream& os, vtkIndent indent);
57 
59 
63  vtkGetObjectMacro(MedicalImageProperties, vtkMedicalImageProperties);
64  virtual void SetMedicalImageProperties(vtkMedicalImageProperties*);
66 
68 
71  virtual void SetFileNames(vtkStringArray*);
72  vtkGetObjectMacro(FileNames, vtkStringArray);
74 
76 
79  vtkGetMacro(LossyFlag,int);
80  vtkSetMacro(LossyFlag,int);
81  vtkBooleanMacro(LossyFlag,int);
83 
84  // I need that...
85  virtual void Write();
86 
90  virtual const char* GetFileExtensions() {
91  return ".dcm .DCM"; }
92 
96  virtual const char* GetDescriptiveName() {
97  return "DICOM"; }
98 
100 
104  virtual void SetDirectionCosines(vtkMatrix4x4 *matrix);
105  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
106  virtual void SetDirectionCosinesFromImageOrientationPatient(const double dircos[6]);
108 
110 
113  vtkSetMacro(Shift, double);
114  vtkGetMacro(Shift, double);
115  vtkSetMacro(Scale, double);
116  vtkGetMacro(Scale, double);
118 
120 
123  vtkGetMacro(ImageFormat,int);
124  vtkSetMacro(ImageFormat,int);
126 
128 
132  vtkBooleanMacro(FileLowerLeft, int);
133  vtkGetMacro(FileLowerLeft, int);
134  vtkSetMacro(FileLowerLeft, int);
136 
138 
141  vtkSetMacro(PlanarConfiguration,int);
142  vtkGetMacro(PlanarConfiguration,int);
144 
146 
149  vtkSetStringMacro(StudyUID);
150  vtkGetStringMacro(StudyUID);
151  vtkSetStringMacro(SeriesUID);
152  vtkGetStringMacro(SeriesUID);
154 
155 //BTX
157  NO_COMPRESSION = 0, // raw (default)
160  JPEGLS_COMPRESSION, // JPEG-LS
161  RLE_COMPRESSION // RLE
162  };
163 //ETX
164  // Set/Get the compression type
165  vtkSetMacro(CompressionType, int);
166  vtkGetMacro(CompressionType, int);
167 
168  //void SetCompressionTypeFromString(const char *);
169  //const char *GetCompressionTypeAsString();
170 
171 protected:
174 
175 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
176  int FillInputPortInformation(int port, vtkInformation *info);
177  int RequestInformation(
178  vtkInformation *request,
179  vtkInformationVector **inputVector,
180  vtkInformationVector *outputVector);
181  int RequestUpdateExtent(
182  vtkInformation *request,
183  vtkInformationVector **inputVector,
184  vtkInformationVector *outputVector);
185  int RequestData(
186  vtkInformation *request,
187  vtkInformationVector **inputVector,
188  vtkInformationVector *outputVector);
189 #else
190  void WriteSlice(vtkImageData *data);
191 #endif /*(VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )*/
192  int WriteGDCMData(vtkImageData *data, int timeStep);
193 
194 protected:
195  virtual /*const*/ char *GetFileName();
196 
197 private:
198  vtkGDCMImageWriter(const vtkGDCMImageWriter&); // Not implemented.
199  void operator=(const vtkGDCMImageWriter&); // Not implemented.
200 
201  // VTK structs:
202  //vtkLookupTable *LookupTable;
203  vtkMedicalImageProperties *MedicalImageProperties;
204  char *StudyUID;
205  char *SeriesUID;
206 
207  int DataUpdateExtent[6];
208  int ImageFormat;
209 
210  vtkStringArray *FileNames;
211  vtkMatrix4x4 *DirectionCosines;
212 
213  double Shift;
214  double Scale;
215  int FileLowerLeft;
216  int PlanarConfiguration;
217  int LossyFlag;
218  int CompressionType;
219 };
220 
221 #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)