vtkgdcm
vtkGDCMImageReader2.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 VTKGDCMIMAGEREADER2_H
69 #define VTKGDCMIMAGEREADER2_H
70 
71 #include "vtkMedicalImageReader2.h"
72 #include "vtkImageData.h"
73 
74 class vtkPolyData;
75 
76 // vtkSystemIncludes.h defines:
77 // #define VTK_LUMINANCE 1
78 // #define VTK_LUMINANCE_ALPHA 2
79 // #define VTK_RGB 3
80 // #define VTK_RGBA 4
81 #ifndef VTK_INVERSE_LUMINANCE
82 #define VTK_INVERSE_LUMINANCE 5
83 #endif
84 #ifndef VTK_LOOKUP_TABLE
85 #define VTK_LOOKUP_TABLE 6
86 #endif
87 #ifndef VTK_YBR
88 #define VTK_YBR 7
89 #endif
90 #ifndef VTK_CMYK
91 #define VTK_CMYK 8
92 #endif
93 
94 //BTX
95 namespace gdcm { class ImageReader; }
96 //ETX
97 class vtkMatrix4x4;
98 class VTK_EXPORT vtkGDCMImageReader2 : public vtkMedicalImageReader2
99 {
100 public:
101  static vtkGDCMImageReader2 *New();
102  vtkTypeMacro(vtkGDCMImageReader2,vtkMedicalImageReader2);
103  virtual void PrintSelf(ostream& os, vtkIndent indent);
104 
105  virtual int CanReadFile(const char* fname);
106 
110  virtual const char* GetFileExtensions()
111  {
112  // I would like to get rid of ACR/NEMA/IMA so only allow dcm extension for now
113  return ".dcm .DCM";
114  }
115 
119  virtual const char* GetDescriptiveName()
120  {
121  return "DICOM";
122  }
123 
125 
129  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
131 
132  virtual void SetMedicalImageProperties(vtkMedicalImageProperties *pd);
133 
135 
139  vtkGetMacro(LoadOverlays,int);
140  vtkSetMacro(LoadOverlays,int);
141  vtkBooleanMacro(LoadOverlays,int);
143 
145 
148  vtkGetMacro(LoadIconImage,int);
149  vtkSetMacro(LoadIconImage,int);
150  vtkBooleanMacro(LoadIconImage,int);
152 
154 
157  vtkGetMacro(LossyFlag,int);
158  vtkSetMacro(LossyFlag,int);
159  vtkBooleanMacro(LossyFlag,int);
161 
163 
167  vtkGetMacro(NumberOfOverlays,int);
169 
171 
175  vtkGetMacro(NumberOfIconImages,int);
177 
179 
184  vtkAlgorithmOutput* GetOverlayPort(int index);
185  vtkAlgorithmOutput* GetIconImagePort();
186  vtkImageData* GetOverlay(int i);
187  vtkImageData* GetIconImage();
189 
191 
194  vtkGetMacro(ApplyLookupTable,int);
195  vtkSetMacro(ApplyLookupTable,int);
196  vtkBooleanMacro(ApplyLookupTable,int);
198 
200 
203  vtkGetMacro(ApplyYBRToRGB,int)
204  vtkSetMacro(ApplyYBRToRGB,int)
205  vtkBooleanMacro(ApplyYBRToRGB,int);
207 
209 
214  vtkGetMacro(ImageFormat,int);
216 
218 
223  vtkGetMacro(PlanarConfiguration,int);
225 
227 
235  vtkGetVector3Macro(ImagePositionPatient,double);
236  vtkGetVector6Macro(ImageOrientationPatient,double);
238 
240 
243  vtkGetObjectMacro(Curve,vtkPolyData);
244  virtual void SetCurve(vtkPolyData *pd);
246 
248 
255  vtkGetMacro(Shift,double);
256  vtkGetMacro(Scale,double);
258 
259 protected:
262 
263  vtkSetVector6Macro(ImageOrientationPatient,double);
264 
265 //BTX
266  void FillMedicalImageInformation(const gdcm::ImageReader &reader);
267 //ETX
268  int RequestInformationCompat();
269  int RequestDataCompat();
270 
271  int ProcessRequest(vtkInformation* request,
272  vtkInformationVector** inputVector,
273  vtkInformationVector* outputVector);
274  int RequestInformation(vtkInformation *request,
275  vtkInformationVector **inputVector,
276  vtkInformationVector *outputVector);
277  int RequestData(vtkInformation *request,
278  vtkInformationVector **inputVector,
279  vtkInformationVector *outputVector);
280 
281 protected:
282  vtkMatrix4x4 *DirectionCosines;
287  int IconImageDataExtent[6];
288  double ImagePositionPatient[3];
289  double ImageOrientationPatient[6];
290  vtkPolyData *Curve;
291 
293  // the following 3, should remain optional
297  // I think that planar configuration need to always be applied as far as VTK is concerned
300 
301  int LoadSingleFile(const char *filename, char *pointer, unsigned long &outlen);
302 
303  double Shift;
304  double Scale;
310 
311 protected:
312  // TODO / FIXME
313  void SetFilePrefix(const char *) {}
314  vtkGetStringMacro(FilePrefix);
315  void SetFilePattern(const char *) {}
316  vtkGetStringMacro(FilePattern);
317 
318 private:
319  vtkGDCMImageReader2(const vtkGDCMImageReader2&); // Not implemented.
320  void operator=(const vtkGDCMImageReader2&); // Not implemented.
321 };
322 #endif
vtkMatrix4x4 * DirectionCosines
virtual const char * GetFileExtensions()
Valid extensions.
void SetFilePrefix(const char *)
virtual const char * GetDescriptiveName()
A descriptive name for this format.
void SetFilePattern(const char *)
read DICOM Image files (Pixel Data)