VTK  9.2.6
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 =========================================================================*/
43 #ifndef vtkDICOMImageReader_h
44 #define vtkDICOMImageReader_h
45 
46 #include "vtkIOImageModule.h" // For export macro
47 #include "vtkImageReader2.h"
48 
49 class vtkDICOMImageReaderVector;
50 class DICOMParser;
51 class DICOMAppHelper;
52 
53 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
54 {
55 public:
57 
60  static vtkDICOMImageReader* New();
63 
67  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
74  void SetFileName(VTK_FILEPATH const char* fn) override
75  {
76  delete[] this->DirectoryName;
77  delete[] this->FileName;
78  this->DirectoryName = nullptr;
79  this->FileName = nullptr;
81  }
83 
93  void SetDirectoryName(VTK_FILEPATH const char* dn);
94 
96 
99  vtkGetFilePathMacro(DirectoryName);
101 
108  double* GetPixelSpacing() VTK_SIZEHINT(3);
109 
113  int GetWidth();
114 
118  int GetHeight();
119 
125  float* GetImagePositionPatient() VTK_SIZEHINT(3);
126 
132  float* GetImageOrientationPatient() VTK_SIZEHINT(6);
133 
137  int GetBitsAllocated();
138 
144  int GetPixelRepresentation();
145 
150  int GetNumberOfComponents();
151 
155  const char* GetTransferSyntaxUID();
156 
160  float GetRescaleSlope();
161 
165  float GetRescaleOffset();
166 
170  const char* GetPatientName();
171 
175  const char* GetStudyUID();
176 
180  const char* GetStudyID();
181 
185  float GetGantryAngle();
186 
187  //
188  // Can I read the file?
189  //
190  int CanReadFile(VTK_FILEPATH const char* fname) override;
191 
192  //
193  // What file extensions are supported?
194  //
195  const char* GetFileExtensions() override { return ".dcm"; }
196 
200  const char* GetDescriptiveName() override { return "DICOM"; }
201 
202 protected:
203  //
204  // Setup the volume size
205  //
206  void SetupOutputInformation(int num_slices);
207 
208  void ExecuteInformation() override;
209  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
210 
211  //
212  // Constructor
213  //
215 
216  //
217  // Destructor
218  //
219  ~vtkDICOMImageReader() override;
220 
221  //
222  // Instance of the parser used to parse the file.
223  //
224  DICOMParser* Parser;
225 
226  //
227  // Instance of the callbacks that get the data from the file.
228  //
229  DICOMAppHelper* AppHelper;
230 
231  //
232  // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
233  //
234  vtkDICOMImageReaderVector* DICOMFileNames;
236 
237  char* PatientName;
238  char* StudyUID;
239  char* StudyID;
241 
242  // DICOMFileNames accessor methods for subclasses:
243  int GetNumberOfDICOMFileNames();
244  VTK_FILEPATH const char* GetDICOMFileName(int index);
245 
246 private:
247  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
248  void operator=(const vtkDICOMImageReader&) = delete;
249 };
250 
251 #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:39
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:65
vtkDICOMImageReaderVector * DICOMFileNames
Reads some DICOM images.