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
31 #ifndef vtkDICOMImageReader_h
32 #define vtkDICOMImageReader_h
33 
34 #include "vtkIOImageModule.h" // For export macro
35 #include "vtkImageReader2.h"
36 
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkDICOMImageReaderVector;
39 class DICOMParser;
40 class DICOMAppHelper;
41 
42 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
43 {
44 public:
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  }
72 
82  void SetDirectoryName(VTK_FILEPATH const char* dn);
83 
85 
88  vtkGetFilePathMacro(DirectoryName);
90 
98 
102  int GetWidth();
103 
107  int GetHeight();
108 
114  float* GetImagePositionPatient() VTK_SIZEHINT(3);
115 
121  float* GetImageOrientationPatient() VTK_SIZEHINT(6);
122 
126  int GetBitsAllocated();
127 
133  int GetPixelRepresentation();
134 
139  int GetNumberOfComponents();
140 
144  const char* GetTransferSyntaxUID();
145 
149  float GetRescaleSlope();
150 
154  float GetRescaleOffset();
155 
159  const char* GetPatientName();
160 
164  const char* GetStudyUID();
165 
169  const char* GetStudyID();
170 
174  float GetGantryAngle();
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 
191 protected:
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 
226  char* PatientName;
227  char* StudyUID;
228  char* StudyID;
230 
231  // DICOMFileNames accessor methods for subclasses:
234 
235 private:
236  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
237  void operator=(const vtkDICOMImageReader&) = delete;
238 };
239 
240 VTK_ABI_NAMESPACE_END
241 #endif
Reads some DICOM images.
void ExecuteInformation() override
double * GetPixelSpacing()
Returns the pixel spacing (in X, Y, Z).
VTK_FILEPATH const char * GetDICOMFileName(int index)
void SetupOutputInformation(int num_slices)
vtkDICOMImageReaderVector * DICOMFileNames
DICOMAppHelper * AppHelper
static vtkDICOMImageReader * New()
Static method for construction.
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
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
vtkGetFilePathMacro(DirectoryName)
Returns the directory name.
general representation of visualization data
Definition: vtkDataObject.h:55
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:29
Store vtkAlgorithm input/output information.
@ index
Definition: vtkX3D.h:246
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)