VTK
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 =========================================================================*/
37 #ifndef vtkDICOMImageReader_h
38 #define vtkDICOMImageReader_h
39 
40 #include "vtkIOImageModule.h" // For export macro
41 #include "vtkImageReader2.h"
42 
43 class vtkDICOMImageReaderVector;
44 class DICOMParser;
45 class DICOMAppHelper;
46 
47 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
48 {
49  public:
51 
54  static vtkDICOMImageReader *New();
57 
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
64 
68  void SetFileName(const char* fn) override
69  {
70  delete [] this->DirectoryName;
71  delete [] this->FileName;
72  this->DirectoryName = nullptr;
73  this->FileName = nullptr;
75  }
77 
87  void SetDirectoryName(const char* dn);
88 
90 
93  vtkGetStringMacro(DirectoryName);
95 
102  double* GetPixelSpacing() VTK_SIZEHINT(3);
103 
107  int GetWidth();
108 
112  int GetHeight();
113 
119  float* GetImagePositionPatient() VTK_SIZEHINT(3);
120 
126  float* GetImageOrientationPatient() VTK_SIZEHINT(6);
127 
131  int GetBitsAllocated();
132 
138  int GetPixelRepresentation();
139 
144  int GetNumberOfComponents();
145 
149  const char* GetTransferSyntaxUID();
150 
154  float GetRescaleSlope();
155 
159  float GetRescaleOffset();
160 
164  const char* GetPatientName();
165 
169  const char* GetStudyUID();
170 
174  const char* GetStudyID();
175 
179  float GetGantryAngle();
180 
181  //
182  // Can I read the file?
183  //
184  int CanReadFile(const char* fname) override;
185 
186  //
187  // What file extensions are supported?
188  //
189  const char* GetFileExtensions() override
190  {
191  return ".dcm";
192  }
193 
197  const char* GetDescriptiveName() override
198  {
199  return "DICOM";
200  }
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  const char* GetDICOMFileName(int index);
245 private:
246  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
247  void operator=(const vtkDICOMImageReader&) = delete;
248 
249 };
250 
251 #endif
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
void SetFileName(const char *fn) override
Set the filename for the file to read.
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
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:33
virtual void ExecuteInformation()
#define VTK_SIZEHINT(...)
Superclass of binary file readers.
DICOMAppHelper * AppHelper
virtual void SetFileName(const char *)
Specify file name for the image file.
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:58
vtkDICOMImageReaderVector * DICOMFileNames
Reads some DICOM images.