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
74class 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
95namespace gdcm { class ImageReader; }
96//ETX
97class vtkMatrix4x4;
98class VTK_EXPORT vtkGDCMImageReader2 : public vtkMedicalImageReader2
99{
100public:
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
259protected:
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
281protected:
282 vtkMatrix4x4 *DirectionCosines;
283 int LoadOverlays;
284 int NumberOfOverlays;
285 int LoadIconImage;
286 int NumberOfIconImages;
287 int IconImageDataExtent[6];
288 double ImagePositionPatient[3];
289 double ImageOrientationPatient[6];
290 vtkPolyData *Curve;
291
292 int ImageFormat;
293 // the following 3, should remain optional
294 int ApplyInverseVideo;
295 int ApplyLookupTable;
296 int ApplyYBRToRGB;
297 // I think that planar configuration need to always be applied as far as VTK is concerned
298 int ApplyPlanarConfiguration;
299 int ApplyShiftScale;
300
301 int LoadSingleFile(const char *filename, char *pointer, unsigned long &outlen);
302
303 double Shift;
304 double Scale;
305 int IconDataScalarType;
306 int IconNumberOfScalarComponents;
307 int PlanarConfiguration;
308 int LossyFlag;
309 int ForceRescale;
310
311protected:
312 // TODO / FIXME
313 void SetFilePrefix(const char *) {}
314 vtkGetStringMacro(FilePrefix);
315 void SetFilePattern(const char *) {}
316 vtkGetStringMacro(FilePattern);
317
318private:
319 vtkGDCMImageReader2(const vtkGDCMImageReader2&); // Not implemented.
320 void operator=(const vtkGDCMImageReader2&); // Not implemented.
321};
322#endif
read DICOM Image files (Pixel Data)
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual int CanReadFile(const char *fname)
virtual void SetMedicalImageProperties(vtkMedicalImageProperties *pd)
static vtkGDCMImageReader2 * New()
virtual const char * GetFileExtensions()
Valid extensions.
vtkImageData * GetOverlay(int i)
void SetFilePattern(const char *)
virtual const char * GetDescriptiveName()
A descriptive name for this format.
vtkAlgorithmOutput * GetOverlayPort(int index)
Get Overlay/IconImage Remember to ALWAYS use those methods in your code, as the internal number for t...
vtkImageData * GetIconImage()
vtkAlgorithmOutput * GetIconImagePort()