VTK  9.5.20251027
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
82#ifndef vtkDICOMImageReader_h
83#define vtkDICOMImageReader_h
84
85#include "vtkIOImageModule.h" // For export macro
86#include "vtkImageReader2.h"
87
88VTK_ABI_NAMESPACE_BEGIN
89class vtkDICOMImageReaderVector;
90class DICOMParser;
91class DICOMAppHelper;
92
93class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
94{
95public:
97
103
107 void PrintSelf(ostream& os, vtkIndent indent) override;
108
110
114 void SetFileName(VTK_FILEPATH const char* fn) override
115 {
116 delete[] this->DirectoryName;
117 delete[] this->FileName;
118 this->DirectoryName = nullptr;
119 this->FileName = nullptr;
121 }
123
133 void SetDirectoryName(VTK_FILEPATH const char* dn);
134
136
139 vtkGetFilePathMacro(DirectoryName);
141
149
153 int GetWidth();
154
158 int GetHeight();
159
165 float* GetImagePositionPatient() VTK_SIZEHINT(3);
166
172 float* GetImageOrientationPatient() VTK_SIZEHINT(6);
173
177 int GetBitsAllocated();
178
184 int GetPixelRepresentation();
185
190 int GetNumberOfComponents();
191
195 const char* GetTransferSyntaxUID();
196
200 float GetRescaleSlope();
201
205 float GetRescaleOffset();
206
210 const char* GetPatientName();
211
215 const char* GetStudyUID();
216
220 const char* GetStudyID();
221
225 float GetGantryAngle();
226
227 //
228 // Can I read the file?
229 //
230 int CanReadFile(VTK_FILEPATH const char* fname) override;
231
232 //
233 // What file extensions are supported?
234 //
235 const char* GetFileExtensions() override { return ".dcm"; }
236
240 const char* GetDescriptiveName() override { return "DICOM"; }
241
242protected:
243 //
244 // Setup the volume size
245 //
246 void SetupOutputInformation(int num_slices);
247
248 void ExecuteInformation() override;
250
251 //
252 // Constructor
253 //
255
256 //
257 // Destructor
258 //
260
261 //
262 // Instance of the parser used to parse the file.
263 //
264 DICOMParser* Parser;
265
266 //
267 // Instance of the callbacks that get the data from the file.
268 //
269 DICOMAppHelper* AppHelper;
270
271 //
272 // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
273 //
274 vtkDICOMImageReaderVector* DICOMFileNames;
276
278 char* StudyUID;
279 char* StudyID;
281
282 // DICOMFileNames accessor methods for subclasses:
284 VTK_FILEPATH const char* GetDICOMFileName(int index);
285
286private:
288 void operator=(const vtkDICOMImageReader&) = delete;
289};
290
291VTK_ABI_NAMESPACE_END
292#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
void SetDirectoryName(const char *dn)
Set the directory name for the reader to look in for DICOM files.
void SetFileName(const char *fn) override
Set the filename for the file to read.
double * GetPixelSpacing()
Returns the pixel spacing (in X, Y, Z).
const char * GetDICOMFileName(int index)
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
vtkGetFilePathMacro(DirectoryName)
Returns the directory name.
general representation of visualization data
Superclass of binary file readers.
virtual void SetFileName(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(...)