VTK  9.4.20251007
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
30
31#ifndef vtkDICOMImageReader_h
32#define vtkDICOMImageReader_h
33
34#include "vtkIOImageModule.h" // For export macro
35#include "vtkImageReader2.h"
36
37VTK_ABI_NAMESPACE_BEGIN
38class vtkDICOMImageReaderVector;
39class DICOMParser;
40class DICOMAppHelper;
41
42class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
43{
44public:
46
52
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
59
63 void SetFileName(VTK_FILEPATH const char* fn) override
64 {
65 delete[] this->DirectoryName;
66 delete[] this->FileName;
67 this->DirectoryName = nullptr;
68 this->FileName = nullptr;
70 }
71
72
82 void SetDirectoryName(VTK_FILEPATH const char* dn);
83
85
90
98
102 int GetWidth();
103
108
115
122
127
134
140
144 const char* GetTransferSyntaxUID();
145
150
155
159 const char* GetPatientName();
160
164 const char* GetStudyUID();
165
169 const char* GetStudyID();
170
175
176 //
177 // Can I read the file?
178 //
179 int CanReadFile(VTK_FILEPATH const char* fname) override;
180
181 //
182 // What file extensions are supported?
183 //
184 const char* GetFileExtensions() override { return ".dcm"; }
185
189 const char* GetDescriptiveName() override { return "DICOM"; }
190
191protected:
192 //
193 // Setup the volume size
194 //
195 void SetupOutputInformation(int num_slices);
196
197 void ExecuteInformation() override;
199
200 //
201 // Constructor
202 //
204
205 //
206 // Destructor
207 //
209
210 //
211 // Instance of the parser used to parse the file.
212 //
213 DICOMParser* Parser;
214
215 //
216 // Instance of the callbacks that get the data from the file.
217 //
218 DICOMAppHelper* AppHelper;
219
220 //
221 // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
222 //
223 vtkDICOMImageReaderVector* DICOMFileNames;
225
227 char* StudyUID;
228 char* StudyID;
230
231 // DICOMFileNames accessor methods for subclasses:
233 VTK_FILEPATH const char* GetDICOMFileName(int index);
234
235private:
237 void operator=(const vtkDICOMImageReader&) = delete;
238};
239
240VTK_ABI_NAMESPACE_END
241#endif
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
void ExecuteInformation() override
int CanReadFile(VTK_FILEPATH const char *fname) override
const char * GetStudyUID()
Get the study uid for the last image processed.
void SetupOutputInformation(int num_slices)
static vtkDICOMImageReader * New()
Static method for construction.
const char * GetStudyID()
Get the Study ID for the last image processed.
vtkDICOMImageReaderVector * DICOMFileNames
DICOMAppHelper * AppHelper
float GetGantryAngle()
Get the gantry angle for the last image processed.
int GetHeight()
Returns the image height.
int GetNumberOfComponents()
Get the number of components of the image data for the last image processed.
float * GetImagePositionPatient()
Get the (DICOM) x,y,z coordinates of the first pixel in the image (upper left hand corner) of the las...
int GetPixelRepresentation()
Get the pixel representation of the last image processed by the DICOMParser.
float GetRescaleOffset()
Get the rescale offset for the pixel data.
int GetBitsAllocated()
Get the number of bits allocated for each pixel in the file.
const char * GetFileExtensions() override
Get the file extensions for this format.
double * GetPixelSpacing()
Returns the pixel spacing (in X, Y, Z).
float GetRescaleSlope()
Get the rescale slope for the pixel data.
void SetDirectoryName(VTK_FILEPATH const char *dn)
Set the directory name for the reader to look in for DICOM files.
int GetWidth()
Returns the image width.
float * GetImageOrientationPatient()
Get the (DICOM) directions cosines.
void SetFileName(VTK_FILEPATH const char *fn) override
Set the filename for the file to read.
const char * GetTransferSyntaxUID()
Get the transfer syntax UID for the last image processed.
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
const char * GetPatientName()
Get the patient name for the last image processed.
VTK_FILEPATH const char * GetDICOMFileName(int index)
vtkGetFilePathMacro(DirectoryName)
Returns the directory name.
general representation of visualization data
virtual void SetFileName(VTK_FILEPATH const char *)
Specify file name for the image file.
vtkImageReader2()
Return a descriptive name for the file format that might be useful in a GUI.
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)