vtkgdcm
vtkGDCMImageReader.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 =========================================================================*/
68 #ifndef VTKGDCMIMAGEREADER_H
69 #define VTKGDCMIMAGEREADER_H
70 
71 #include "vtkMedicalImageReader2.h"
72 #include "vtkImageData.h"
73 #include "vtkVersion.h"
74 
75 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
76 #else
77 class vtkMedicalImageProperties;
78 #endif
79 #if (VTK_MAJOR_VERSION > 5) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 0 )
80 #else
81 class vtkStringArray;
82 #endif
83 class vtkPolyData;
84 
85 // vtkSystemIncludes.h defines:
86 // #define VTK_LUMINANCE 1
87 // #define VTK_LUMINANCE_ALPHA 2
88 // #define VTK_RGB 3
89 // #define VTK_RGBA 4
90 #ifndef VTK_INVERSE_LUMINANCE
91 #define VTK_INVERSE_LUMINANCE 5
92 #endif
93 #ifndef VTK_LOOKUP_TABLE
94 #define VTK_LOOKUP_TABLE 6
95 #endif
96 #ifndef VTK_YBR
97 #define VTK_YBR 7
98 #endif
99 #ifndef VTK_CMYK
100 #define VTK_CMYK 8
101 #endif
102 
103 //BTX
104 namespace gdcm { class ImageReader; }
105 //ETX
106 class vtkMatrix4x4;
107 class VTK_EXPORT vtkGDCMImageReader : public vtkMedicalImageReader2
108 {
109 public:
111  vtkTypeMacro(vtkGDCMImageReader,vtkMedicalImageReader2);
112  virtual void PrintSelf(ostream& os, vtkIndent indent);
113 
114  virtual int CanReadFile(const char* fname);
115 
119  virtual const char* GetFileExtensions()
120  {
121  // I would like to get rid of ACR/NEMA/IMA so only allow dcm extension for now
122  return ".dcm .DCM";
123  }
124 
128  virtual const char* GetDescriptiveName()
129  {
130  return "DICOM";
131  }
132 
134 
138  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
140 
141 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
142 #else
144 
147  vtkGetObjectMacro(MedicalImageProperties, vtkMedicalImageProperties);
148 #endif
149  virtual void SetMedicalImageProperties(vtkMedicalImageProperties *pd);
151 
152 #if (VTK_MAJOR_VERSION > 5) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 0 )
153 #else
154  virtual void SetFileNames(vtkStringArray*);
155  vtkGetObjectMacro(FileNames, vtkStringArray);
156 #endif
157 
159 
163  vtkGetMacro(LoadOverlays,int);
164  vtkSetMacro(LoadOverlays,int);
165  vtkBooleanMacro(LoadOverlays,int);
167 
169 
172  vtkGetMacro(LoadIconImage,int);
173  vtkSetMacro(LoadIconImage,int);
174  vtkBooleanMacro(LoadIconImage,int);
176 
178 
181  vtkGetMacro(LossyFlag,int);
182  vtkSetMacro(LossyFlag,int);
183  vtkBooleanMacro(LossyFlag,int);
185 
187 
191  vtkGetMacro(NumberOfOverlays,int);
193 
195 
199  vtkGetMacro(NumberOfIconImages,int);
201 
203 
208 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
209 //FIXME: Need to get rid of BTX/ETX if only the Python Wrapper of VTK 4.2 would let me
210 //BTX
211  vtkAlgorithmOutput* GetOverlayPort(int index);
212  vtkAlgorithmOutput* GetIconImagePort();
213 //ETX
214 #endif
215  vtkImageData* GetOverlay(int i);
216  vtkImageData* GetIconImage();
218 
220 
223  vtkGetMacro(ApplyLookupTable,int);
224  vtkSetMacro(ApplyLookupTable,int);
225  vtkBooleanMacro(ApplyLookupTable,int);
227 
229 
232  vtkGetMacro(ApplyYBRToRGB,int)
233  vtkSetMacro(ApplyYBRToRGB,int)
234  vtkBooleanMacro(ApplyYBRToRGB,int);
236 
238 
243  vtkGetMacro(ImageFormat,int);
245 
247 
252  vtkGetMacro(PlanarConfiguration,int);
254 
256 
264  vtkGetVector3Macro(ImagePositionPatient,double);
265  vtkGetVector6Macro(ImageOrientationPatient,double);
267 
269 
272  vtkGetObjectMacro(Curve,vtkPolyData);
273  virtual void SetCurve(vtkPolyData *pd);
275 
277 
284  vtkGetMacro(Shift,double);
285  vtkGetMacro(Scale,double);
287 
288 protected:
291 
292  vtkSetVector6Macro(ImageOrientationPatient,double);
293 
294 //BTX
295  void FillMedicalImageInformation(const gdcm::ImageReader &reader);
296 //ETX
297  int RequestInformationCompat();
298  int RequestDataCompat();
299 
300 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
301  int ProcessRequest(vtkInformation* request,
302  vtkInformationVector** inputVector,
303  vtkInformationVector* outputVector);
304  int RequestInformation(vtkInformation *request,
305  vtkInformationVector **inputVector,
306  vtkInformationVector *outputVector);
307  int RequestData(vtkInformation *request,
308  vtkInformationVector **inputVector,
309  vtkInformationVector *outputVector);
310 #else /*(VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )*/
312  void ExecuteData(vtkDataObject *out);
313 #endif /*(VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )*/
314 
315 protected:
316 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
317 #else
319 
322  vtkMedicalImageProperties *MedicalImageProperties;
323 #endif
324 #if (VTK_MAJOR_VERSION > 5) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 0 )
325 #else
326  vtkStringArray *FileNames;
327 #endif
329 
330  vtkMatrix4x4 *DirectionCosines;
335  int IconImageDataExtent[6];
336  double ImagePositionPatient[3];
337  double ImageOrientationPatient[6];
338  vtkPolyData *Curve;
339 
341  // the following 3, should remain optional
345  // I think that planar configuration need to always be applied as far as VTK is concerned
348 
349  int LoadSingleFile(const char *filename, char *pointer, unsigned long &outlen);
350 
351  double Shift;
352  double Scale;
358 
359 protected:
360  // TODO / FIXME
361  void SetFilePrefix(const char *) {}
362  vtkGetStringMacro(FilePrefix);
363  void SetFilePattern(const char *) {}
364  vtkGetStringMacro(FilePattern);
365 
366 private:
367  vtkGDCMImageReader(const vtkGDCMImageReader&); // Not implemented.
368  void operator=(const vtkGDCMImageReader&); // Not implemented.
369 };
370 #endif
read DICOM Image files (Pixel Data)
void SetFilePattern(const char *)
virtual void SetFileNames(vtkStringArray *)
virtual const char * GetFileExtensions()
Valid extensions.
static vtkGDCMImageReader * New()
int LoadSingleFile(const char *filename, char *pointer, unsigned long &outlen)
virtual void SetMedicalImageProperties(vtkMedicalImageProperties *pd)
vtkMedicalImageProperties * MedicalImageProperties
Medical Image properties.
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkImageData * GetOverlay(int i)
Get Overlay/IconImage Remember to ALWAYS use those methods in your code, as the internal number for t...
virtual const char * GetDescriptiveName()
A descriptive name for this format.
vtkImageData * GetIconImage()
virtual int CanReadFile(const char *fname)
vtkStringArray * FileNames
vtkMatrix4x4 * DirectionCosines
void ExecuteData(vtkDataObject *out)
void SetFilePrefix(const char *)