VTK  9.3.0
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
40#ifndef vtkDICOMImageReader_h
41#define vtkDICOMImageReader_h
42
43#include "vtkIOImageModule.h" // For export macro
44#include "vtkImageReader2.h"
45
46VTK_ABI_NAMESPACE_BEGIN
47class vtkDICOMImageReaderVector;
48class DICOMParser;
49class DICOMAppHelper;
50
51class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
52{
53public:
55
61
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
72 void SetFileName(VTK_FILEPATH const char* fn) override
73 {
74 delete[] this->DirectoryName;
75 delete[] this->FileName;
76 this->DirectoryName = nullptr;
77 this->FileName = nullptr;
79 }
81
91 void SetDirectoryName(VTK_FILEPATH const char* dn);
92
94
97 vtkGetFilePathMacro(DirectoryName);
99
107
111 int GetWidth();
112
116 int GetHeight();
117
123 float* GetImagePositionPatient() VTK_SIZEHINT(3);
124
130 float* GetImageOrientationPatient() VTK_SIZEHINT(6);
131
135 int GetBitsAllocated();
136
142 int GetPixelRepresentation();
143
148 int GetNumberOfComponents();
149
153 const char* GetTransferSyntaxUID();
154
158 float GetRescaleSlope();
159
163 float GetRescaleOffset();
164
168 const char* GetPatientName();
169
173 const char* GetStudyUID();
174
178 const char* GetStudyID();
179
183 float GetGantryAngle();
184
185 //
186 // Can I read the file?
187 //
188 int CanReadFile(VTK_FILEPATH const char* fname) override;
189
190 //
191 // What file extensions are supported?
192 //
193 const char* GetFileExtensions() override { return ".dcm"; }
194
198 const char* GetDescriptiveName() override { return "DICOM"; }
199
200protected:
201 //
202 // Setup the volume size
203 //
204 void SetupOutputInformation(int num_slices);
205
206 void ExecuteInformation() override;
208
209 //
210 // Constructor
211 //
213
214 //
215 // Destructor
216 //
218
219 //
220 // Instance of the parser used to parse the file.
221 //
222 DICOMParser* Parser;
223
224 //
225 // Instance of the callbacks that get the data from the file.
226 //
227 DICOMAppHelper* AppHelper;
228
229 //
230 // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
231 //
232 vtkDICOMImageReaderVector* DICOMFileNames;
234
236 char* StudyUID;
237 char* StudyID;
239
240 // DICOMFileNames accessor methods for subclasses:
242 VTK_FILEPATH const char* GetDICOMFileName(int index);
243
244private:
246 void operator=(const vtkDICOMImageReader&) = delete;
247};
248
249VTK_ABI_NAMESPACE_END
250#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:38
Store vtkAlgorithm input/output information.
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)