VTK  9.1.0
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 =========================================================================*/
86 #ifndef vtkDICOMImageReader_h
87 #define vtkDICOMImageReader_h
88 
89 #include "vtkIOImageModule.h" // For export macro
90 #include "vtkImageReader2.h"
91 
92 class vtkDICOMImageReaderVector;
93 class DICOMParser;
94 class DICOMAppHelper;
95 
96 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
97 {
98 public:
100 
106 
110  void PrintSelf(ostream& os, vtkIndent indent) override;
111 
113 
117  void SetFileName(VTK_FILEPATH const char* fn) override
118  {
119  delete[] this->DirectoryName;
120  delete[] this->FileName;
121  this->DirectoryName = nullptr;
122  this->FileName = nullptr;
124  }
126 
136  void SetDirectoryName(VTK_FILEPATH const char* dn);
137 
139 
142  vtkGetFilePathMacro(DirectoryName);
144 
152 
156  int GetWidth();
157 
161  int GetHeight();
162 
168  float* GetImagePositionPatient() VTK_SIZEHINT(3);
169 
175  float* GetImageOrientationPatient() VTK_SIZEHINT(6);
176 
180  int GetBitsAllocated();
181 
187  int GetPixelRepresentation();
188 
193  int GetNumberOfComponents();
194 
198  const char* GetTransferSyntaxUID();
199 
203  float GetRescaleSlope();
204 
208  float GetRescaleOffset();
209 
213  const char* GetPatientName();
214 
218  const char* GetStudyUID();
219 
223  const char* GetStudyID();
224 
228  float GetGantryAngle();
229 
230  //
231  // Can I read the file?
232  //
233  int CanReadFile(VTK_FILEPATH const char* fname) override;
234 
235  //
236  // What file extensions are supported?
237  //
238  const char* GetFileExtensions() override { return ".dcm"; }
239 
243  const char* GetDescriptiveName() override { return "DICOM"; }
244 
245 protected:
246  //
247  // Setup the volume size
248  //
249  void SetupOutputInformation(int num_slices);
250 
251  void ExecuteInformation() override;
253 
254  //
255  // Constructor
256  //
258 
259  //
260  // Destructor
261  //
263 
264  //
265  // Instance of the parser used to parse the file.
266  //
267  DICOMParser* Parser;
268 
269  //
270  // Instance of the callbacks that get the data from the file.
271  //
272  DICOMAppHelper* AppHelper;
273 
274  //
275  // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
276  //
277  vtkDICOMImageReaderVector* DICOMFileNames;
279 
280  char* PatientName;
281  char* StudyUID;
282  char* StudyID;
284 
285  // DICOMFileNames accessor methods for subclasses:
288 
289 private:
290  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
291  void operator=(const vtkDICOMImageReader&) = delete;
292 };
293 
294 #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:113
Store vtkAlgorithm input/output information.
@ index
Definition: vtkX3D.h:252
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)