VTK  9.2.5
vtkDICOMImageReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDICOMImageReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
92 #ifndef vtkDICOMImageReader_h
93 #define vtkDICOMImageReader_h
94 
95 #include "vtkIOImageModule.h" // For export macro
96 #include "vtkImageReader2.h"
97 
98 class vtkDICOMImageReaderVector;
99 class DICOMParser;
100 class DICOMAppHelper;
101 
102 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
103 {
104 public:
106 
112 
116  void PrintSelf(ostream& os, vtkIndent indent) override;
117 
119 
123  void SetFileName(VTK_FILEPATH const char* fn) override
124  {
125  delete[] this->DirectoryName;
126  delete[] this->FileName;
127  this->DirectoryName = nullptr;
128  this->FileName = nullptr;
130  }
132 
142  void SetDirectoryName(VTK_FILEPATH const char* dn);
143 
145 
148  vtkGetFilePathMacro(DirectoryName);
150 
158 
162  int GetWidth();
163 
167  int GetHeight();
168 
174  float* GetImagePositionPatient() VTK_SIZEHINT(3);
175 
181  float* GetImageOrientationPatient() VTK_SIZEHINT(6);
182 
186  int GetBitsAllocated();
187 
193  int GetPixelRepresentation();
194 
199  int GetNumberOfComponents();
200 
204  const char* GetTransferSyntaxUID();
205 
209  float GetRescaleSlope();
210 
214  float GetRescaleOffset();
215 
219  const char* GetPatientName();
220 
224  const char* GetStudyUID();
225 
229  const char* GetStudyID();
230 
234  float GetGantryAngle();
235 
236  //
237  // Can I read the file?
238  //
239  int CanReadFile(VTK_FILEPATH const char* fname) override;
240 
241  //
242  // What file extensions are supported?
243  //
244  const char* GetFileExtensions() override { return ".dcm"; }
245 
249  const char* GetDescriptiveName() override { return "DICOM"; }
250 
251 protected:
252  //
253  // Setup the volume size
254  //
255  void SetupOutputInformation(int num_slices);
256 
257  void ExecuteInformation() override;
259 
260  //
261  // Constructor
262  //
264 
265  //
266  // Destructor
267  //
269 
270  //
271  // Instance of the parser used to parse the file.
272  //
273  DICOMParser* Parser;
274 
275  //
276  // Instance of the callbacks that get the data from the file.
277  //
278  DICOMAppHelper* AppHelper;
279 
280  //
281  // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
282  //
283  vtkDICOMImageReaderVector* DICOMFileNames;
285 
286  char* PatientName;
287  char* StudyUID;
288  char* StudyID;
290 
291  // DICOMFileNames accessor methods for subclasses:
294 
295 private:
296  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
297  void operator=(const vtkDICOMImageReader&) = delete;
298 };
299 
300 #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
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:119
Store vtkAlgorithm input/output information.
@ index
Definition: vtkX3D.h:252
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)