VTK  9.3.1
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 
49  static vtkDICOMImageReader* New();
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 
97  double* GetPixelSpacing() VTK_SIZEHINT(3);
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;
198  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
199 
200  //
201  // Constructor
202  //
204 
205  //
206  // Destructor
207  //
208  ~vtkDICOMImageReader() override;
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:
232  int GetNumberOfDICOMFileNames();
233  VTK_FILEPATH const char* GetDICOMFileName(int index);
234 
235 private:
236  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
237  void operator=(const vtkDICOMImageReader&) = delete;
238 };
239 
240 VTK_ABI_NAMESPACE_END
241 #endif
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
vtkGetFilePathMacro(FileName)
Specify file name for the image file.
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ExecuteInformation()
void SetFileName(VTK_FILEPATH const char *fn) override
Set the filename for the file to read.
#define VTK_SIZEHINT(...)
Superclass of binary file readers.
#define VTK_FILEPATH
virtual void SetFileName(VTK_FILEPATH const char *)
Specify file name for the image file.
DICOMAppHelper * AppHelper
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:54
vtkDICOMImageReaderVector * DICOMFileNames
Reads some DICOM images.