VTK  9.0.1
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 { return ".dcm"; }
190 
194  const char* GetDescriptiveName() override { return "DICOM"; }
195 
196 protected:
197  //
198  // Setup the volume size
199  //
200  void SetupOutputInformation(int num_slices);
201 
202  void ExecuteInformation() override;
203  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
204 
205  //
206  // Constructor
207  //
209 
210  //
211  // Destructor
212  //
213  ~vtkDICOMImageReader() override;
214 
215  //
216  // Instance of the parser used to parse the file.
217  //
218  DICOMParser* Parser;
219 
220  //
221  // Instance of the callbacks that get the data from the file.
222  //
223  DICOMAppHelper* AppHelper;
224 
225  //
226  // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
227  //
228  vtkDICOMImageReaderVector* DICOMFileNames;
230 
231  char* PatientName;
232  char* StudyUID;
233  char* StudyID;
235 
236  // DICOMFileNames accessor methods for subclasses:
237  int GetNumberOfDICOMFileNames();
238  const char* GetDICOMFileName(int index);
239 
240 private:
241  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
242  void operator=(const vtkDICOMImageReader&) = delete;
243 };
244 
245 #endif
vtkImageReader2::FileName
char * FileName
Definition: vtkImageReader2.h:306
vtkImageReader2::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageReader2::ExecuteDataWithInformation
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
vtkDICOMImageReader::PatientName
char * PatientName
Definition: vtkDICOMImageReader.h:231
vtkDICOMImageReader
Reads some DICOM images.
Definition: vtkDICOMImageReader.h:47
vtkDICOMImageReader::DirectoryName
char * DirectoryName
Definition: vtkDICOMImageReader.h:229
vtkDICOMImageReader::GetDescriptiveName
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
Definition: vtkDICOMImageReader.h:194
vtkImageReader2::New
static vtkImageReader2 * New()
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkDICOMImageReader::Parser
DICOMParser * Parser
Definition: vtkDICOMImageReader.h:218
vtkDICOMImageReader::SetFileName
void SetFileName(const char *fn) override
Set the filename for the file to read.
Definition: vtkDICOMImageReader.h:68
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkImageReader2
Superclass of binary file readers.
Definition: vtkImageReader2.h:52
vtkDICOMImageReader::DICOMFileNames
vtkDICOMImageReaderVector * DICOMFileNames
Definition: vtkDICOMImageReader.h:228
vtkImageReader2::SetFileName
virtual void SetFileName(const char *)
Specify file name for the image file.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkDICOMImageReader::TransferSyntaxUID
char * TransferSyntaxUID
Definition: vtkDICOMImageReader.h:234
vtkDICOMImageReader::AppHelper
DICOMAppHelper * AppHelper
Definition: vtkDICOMImageReader.h:223
vtkImageReader2::ExecuteInformation
virtual void ExecuteInformation()
vtkDICOMImageReader::StudyID
char * StudyID
Definition: vtkDICOMImageReader.h:233
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkDICOMImageReader::StudyUID
char * StudyUID
Definition: vtkDICOMImageReader.h:232
vtkImageReader2.h