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 "vtkgdcmModule.h"
72 #include "vtkMedicalImageReader2.h"
73 #include "vtkImageData.h"
74 #include "vtkVersion.h"
75 
76 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
77 #else
78 class vtkMedicalImageProperties;
79 #endif
80 #if (VTK_MAJOR_VERSION > 5) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 0 )
81 #else
82 class vtkStringArray;
83 #endif
84 class vtkPolyData;
85 
86 // vtkSystemIncludes.h defines:
87 // #define VTK_LUMINANCE 1
88 // #define VTK_LUMINANCE_ALPHA 2
89 // #define VTK_RGB 3
90 // #define VTK_RGBA 4
91 #ifndef VTK_INVERSE_LUMINANCE
92 #define VTK_INVERSE_LUMINANCE 5
93 #endif
94 #ifndef VTK_LOOKUP_TABLE
95 #define VTK_LOOKUP_TABLE 6
96 #endif
97 #ifndef VTK_YBR
98 #define VTK_YBR 7
99 #endif
100 #ifndef VTK_CMYK
101 #define VTK_CMYK 8
102 #endif
103 
104 //BTX
105 namespace gdcm { class ImageReader; }
106 //ETX
107 class vtkMatrix4x4;
108 class VTKGDCM_EXPORT vtkGDCMImageReader : public vtkMedicalImageReader2
109 {
110 public:
112  vtkTypeMacro(vtkGDCMImageReader,vtkMedicalImageReader2);
113  virtual void PrintSelf(ostream& os, vtkIndent indent);
114 
115  virtual int CanReadFile(const char* fname);
116 
120  virtual const char* GetFileExtensions()
121  {
122  // I would like to get rid of ACR/NEMA/IMA so only allow dcm extension for now
123  return ".dcm .DCM";
124  }
125 
129  virtual const char* GetDescriptiveName()
130  {
131  return "DICOM";
132  }
133 
135 
139  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
141 
142 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
143 #else
145 
148  vtkGetObjectMacro(MedicalImageProperties, vtkMedicalImageProperties);
149 #endif
150  virtual void SetMedicalImageProperties(vtkMedicalImageProperties *pd);
152 
153 #if (VTK_MAJOR_VERSION > 5) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 0 )
154 #else
155  virtual void SetFileNames(vtkStringArray*);
156  vtkGetObjectMacro(FileNames, vtkStringArray);
157 #endif
158 
160 
164  vtkGetMacro(LoadOverlays,int);
165  vtkSetMacro(LoadOverlays,int);
166  vtkBooleanMacro(LoadOverlays,int);
168 
170 
173  vtkGetMacro(LoadIconImage,int);
174  vtkSetMacro(LoadIconImage,int);
175  vtkBooleanMacro(LoadIconImage,int);
177 
179 
182  vtkGetMacro(LossyFlag,int);
183  vtkSetMacro(LossyFlag,int);
184  vtkBooleanMacro(LossyFlag,int);
186 
188 
192  vtkGetMacro(NumberOfOverlays,int);
194 
196 
200  vtkGetMacro(NumberOfIconImages,int);
202 
204 
209 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
210 //FIXME: Need to get rid of BTX/ETX if only the Python Wrapper of VTK 4.2 would let me
211 //BTX
212  vtkAlgorithmOutput* GetOverlayPort(int index);
213  vtkAlgorithmOutput* GetIconImagePort();
214 //ETX
215 #endif
216  vtkImageData* GetOverlay(int i);
217  vtkImageData* GetIconImage();
219 
221 
224  vtkGetMacro(ApplyLookupTable,int);
225  vtkSetMacro(ApplyLookupTable,int);
226  vtkBooleanMacro(ApplyLookupTable,int);
228 
230 
233  vtkGetMacro(ApplyYBRToRGB,int)
234  vtkSetMacro(ApplyYBRToRGB,int)
235  vtkBooleanMacro(ApplyYBRToRGB,int);
237 
239 
244  vtkGetMacro(ImageFormat,int);
246 
248 
253  vtkGetMacro(PlanarConfiguration,int);
255 
257 
265  vtkGetVector3Macro(ImagePositionPatient,double);
266  vtkGetVector6Macro(ImageOrientationPatient,double);
268 
270 
273  vtkGetObjectMacro(Curve,vtkPolyData);
274  virtual void SetCurve(vtkPolyData *pd);
276 
278 
285  vtkGetMacro(Shift,double);
286  vtkGetMacro(Scale,double);
288 
289 protected:
292 
293  vtkSetVector6Macro(ImageOrientationPatient,double);
294 
295 //BTX
296  void FillMedicalImageInformation(const gdcm::ImageReader &reader);
297 //ETX
298  int RequestInformationCompat();
299  int RequestDataCompat();
300 
301 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
302  int ProcessRequest(vtkInformation* request,
303  vtkInformationVector** inputVector,
304  vtkInformationVector* outputVector);
305  int RequestInformation(vtkInformation *request,
306  vtkInformationVector **inputVector,
307  vtkInformationVector *outputVector);
308  int RequestData(vtkInformation *request,
309  vtkInformationVector **inputVector,
310  vtkInformationVector *outputVector);
311 #else /*(VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )*/
313  void ExecuteData(vtkDataObject *out);
314 #endif /*(VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )*/
315 
316 protected:
317 #if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 5 )
318 #else
320 
323  vtkMedicalImageProperties *MedicalImageProperties;
324 #endif
325 #if (VTK_MAJOR_VERSION > 5) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION > 0 )
326 #else
327  vtkStringArray *FileNames;
328 #endif
330 
331  vtkMatrix4x4 *DirectionCosines;
336  int IconImageDataExtent[6];
337  double ImagePositionPatient[3];
338  double ImageOrientationPatient[6];
339  vtkPolyData *Curve;
340 
342  // the following 3, should remain optional
346  // I think that planar configuration need to always be applied as far as VTK is concerned
349 
350  int LoadSingleFile(const char *filename, char *pointer, unsigned long &outlen);
351 
352  double Shift;
353  double Scale;
359 
360 protected:
361  // TODO / FIXME
362  void SetFilePrefix(const char *) {}
363  vtkGetStringMacro(FilePrefix);
364  void SetFilePattern(const char *) {}
365  vtkGetStringMacro(FilePattern);
366 
367 private:
368  vtkGDCMImageReader(const vtkGDCMImageReader&); // Not implemented.
369  void operator=(const vtkGDCMImageReader&); // Not implemented.
370 };
371 #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 *)