VTK  9.4.20241219
vtkDICOMImageReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
80#ifndef vtkDICOMImageReader_h
81#define vtkDICOMImageReader_h
82
83#include "vtkIOImageModule.h" // For export macro
84#include "vtkImageReader2.h"
85
86VTK_ABI_NAMESPACE_BEGIN
87class vtkDICOMImageReaderVector;
88class DICOMParser;
89class DICOMAppHelper;
90
91class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
92{
93public:
95
101
105 void PrintSelf(ostream& os, vtkIndent indent) override;
106
108
112 void SetFileName(VTK_FILEPATH const char* fn) override
113 {
114 delete[] this->DirectoryName;
115 delete[] this->FileName;
116 this->DirectoryName = nullptr;
117 this->FileName = nullptr;
119 }
121
131 void SetDirectoryName(VTK_FILEPATH const char* dn);
132
134
137 vtkGetFilePathMacro(DirectoryName);
139
147
151 int GetWidth();
152
156 int GetHeight();
157
163 float* GetImagePositionPatient() VTK_SIZEHINT(3);
164
170 float* GetImageOrientationPatient() VTK_SIZEHINT(6);
171
175 int GetBitsAllocated();
176
182 int GetPixelRepresentation();
183
188 int GetNumberOfComponents();
189
193 const char* GetTransferSyntaxUID();
194
198 float GetRescaleSlope();
199
203 float GetRescaleOffset();
204
208 const char* GetPatientName();
209
213 const char* GetStudyUID();
214
218 const char* GetStudyID();
219
223 float GetGantryAngle();
224
225 //
226 // Can I read the file?
227 //
228 int CanReadFile(VTK_FILEPATH const char* fname) override;
229
230 //
231 // What file extensions are supported?
232 //
233 const char* GetFileExtensions() override { return ".dcm"; }
234
238 const char* GetDescriptiveName() override { return "DICOM"; }
239
240protected:
241 //
242 // Setup the volume size
243 //
244 void SetupOutputInformation(int num_slices);
245
246 void ExecuteInformation() override;
248
249 //
250 // Constructor
251 //
253
254 //
255 // Destructor
256 //
258
259 //
260 // Instance of the parser used to parse the file.
261 //
262 DICOMParser* Parser;
263
264 //
265 // Instance of the callbacks that get the data from the file.
266 //
267 DICOMAppHelper* AppHelper;
268
269 //
270 // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
271 //
272 vtkDICOMImageReaderVector* DICOMFileNames;
274
276 char* StudyUID;
277 char* StudyID;
279
280 // DICOMFileNames accessor methods for subclasses:
282 VTK_FILEPATH const char* GetDICOMFileName(int index);
283
284private:
286 void operator=(const vtkDICOMImageReader&) = delete;
287};
288
289VTK_ABI_NAMESPACE_END
290#endif
Reads some DICOM images.
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
void ExecuteInformation() override
void SetupOutputInformation(int num_slices)
static vtkDICOMImageReader * New()
Static method for construction.
vtkDICOMImageReaderVector * DICOMFileNames
DICOMAppHelper * AppHelper
double * GetPixelSpacing()
Returns the pixel spacing (in X, Y, Z).
void SetDirectoryName(VTK_FILEPATH const char *dn)
Set the directory name for the reader to look in for DICOM files.
void SetFileName(VTK_FILEPATH const char *fn) override
Set the filename for the file to read.
int GetNumberOfDICOMFileNames()
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
void PrintSelf(ostream &os, vtkIndent indent) override
Prints the ivars.
~vtkDICOMImageReader() override
VTK_FILEPATH const char * GetDICOMFileName(int index)
vtkGetFilePathMacro(DirectoryName)
Returns the directory name.
general representation of visualization data
Superclass of binary file readers.
virtual void SetFileName(VTK_FILEPATH const char *)
Specify file name for the image file.
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)