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 "vtkgdcmModule.h"
72#include "vtkMedicalImageReader2.h"
73#include "vtkImageData.h"
74
75class vtkPolyData;
76
77// vtkSystemIncludes.h defines:
78// #define VTK_LUMINANCE 1
79// #define VTK_LUMINANCE_ALPHA 2
80// #define VTK_RGB 3
81// #define VTK_RGBA 4
82#ifndef VTK_INVERSE_LUMINANCE
83#define VTK_INVERSE_LUMINANCE 5
84#endif
85#ifndef VTK_LOOKUP_TABLE
86#define VTK_LOOKUP_TABLE 6
87#endif
88#ifndef VTK_YBR
89#define VTK_YBR 7
90#endif
91#ifndef VTK_CMYK
92#define VTK_CMYK 8
93#endif
94
95//BTX
96namespace gdcm { class ImageReader; }
97//ETX
98class vtkMatrix4x4;
99class VTKGDCM_EXPORT vtkGDCMImageReader2 : public vtkMedicalImageReader2
100{
101public:
103 vtkTypeMacro(vtkGDCMImageReader2,vtkMedicalImageReader2);
104 virtual void PrintSelf(ostream& os, vtkIndent indent);
105
106 virtual int CanReadFile(const char* fname);
107
111 virtual const char* GetFileExtensions()
112 {
113 // I would like to get rid of ACR/NEMA/IMA so only allow dcm extension for now
114 return ".dcm .DCM";
115 }
116
120 virtual const char* GetDescriptiveName()
121 {
122 return "DICOM";
123 }
124
126
130 vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
132
133 virtual void SetMedicalImageProperties(vtkMedicalImageProperties *pd);
134
136
140 vtkGetMacro(LoadOverlays,int);
141 vtkSetMacro(LoadOverlays,int);
142 vtkBooleanMacro(LoadOverlays,int);
144
146
149 vtkGetMacro(LoadIconImage,int);
150 vtkSetMacro(LoadIconImage,int);
151 vtkBooleanMacro(LoadIconImage,int);
153
155
158 vtkGetMacro(LossyFlag,int);
159 vtkSetMacro(LossyFlag,int);
160 vtkBooleanMacro(LossyFlag,int);
162
164
168 vtkGetMacro(NumberOfOverlays,int);
170
172
176 vtkGetMacro(NumberOfIconImages,int);
178
180
185 vtkAlgorithmOutput* GetOverlayPort(int index);
186 vtkAlgorithmOutput* GetIconImagePort();
187 vtkImageData* GetOverlay(int i);
188 vtkImageData* GetIconImage();
190
192
195 vtkGetMacro(ApplyLookupTable,int);
196 vtkSetMacro(ApplyLookupTable,int);
197 vtkBooleanMacro(ApplyLookupTable,int);
199
201
204 vtkGetMacro(ApplyYBRToRGB,int)
205 vtkSetMacro(ApplyYBRToRGB,int)
206 vtkBooleanMacro(ApplyYBRToRGB,int);
208
210
215 vtkGetMacro(ImageFormat,int);
217
219
224 vtkGetMacro(PlanarConfiguration,int);
226
228
236 vtkGetVector3Macro(ImagePositionPatient,double);
237 vtkGetVector6Macro(ImageOrientationPatient,double);
239
241
244 vtkGetObjectMacro(Curve,vtkPolyData);
245 virtual void SetCurve(vtkPolyData *pd);
247
249
256 vtkGetMacro(Shift,double);
257 vtkGetMacro(Scale,double);
259
260protected:
263
264 vtkSetVector6Macro(ImageOrientationPatient,double);
265
266//BTX
267 void FillMedicalImageInformation(const gdcm::ImageReader &reader);
268//ETX
269 int RequestInformationCompat();
270 int RequestDataCompat();
271
272 int ProcessRequest(vtkInformation* request,
273 vtkInformationVector** inputVector,
274 vtkInformationVector* outputVector);
275 int RequestInformation(vtkInformation *request,
276 vtkInformationVector **inputVector,
277 vtkInformationVector *outputVector);
278 int RequestData(vtkInformation *request,
279 vtkInformationVector **inputVector,
280 vtkInformationVector *outputVector);
281
282protected:
283 vtkMatrix4x4 *DirectionCosines;
284 int LoadOverlays;
285 int NumberOfOverlays;
286 int LoadIconImage;
287 int NumberOfIconImages;
288 int IconImageDataExtent[6];
289 double ImagePositionPatient[3];
290 double ImageOrientationPatient[6];
291 vtkPolyData *Curve;
292
293 int ImageFormat;
294 // the following 3, should remain optional
295 int ApplyInverseVideo;
296 int ApplyLookupTable;
297 int ApplyYBRToRGB;
298 // I think that planar configuration need to always be applied as far as VTK is concerned
299 int ApplyPlanarConfiguration;
300 int ApplyShiftScale;
301
302 int LoadSingleFile(const char *filename, char *pointer, unsigned long &outlen);
303
304 double Shift;
305 double Scale;
306 int IconDataScalarType;
307 int IconNumberOfScalarComponents;
308 int PlanarConfiguration;
309 int LossyFlag;
310 int ForceRescale;
311
312protected:
313 // TODO / FIXME
314 void SetFilePrefix(const char *) {}
315 vtkGetStringMacro(FilePrefix);
316 void SetFilePattern(const char *) {}
317 vtkGetStringMacro(FilePattern);
318
319private:
320 vtkGDCMImageReader2(const vtkGDCMImageReader2&); // Not implemented.
321 void operator=(const vtkGDCMImageReader2&); // Not implemented.
322};
323#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()