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
vtkImageReader2::FileName
char * FileName
Definition: vtkImageReader2.h:415
vtkDICOMImageReader::SetDirectoryName
void SetDirectoryName(VTK_FILEPATH const char *dn)
Set the directory name for the reader to look in for DICOM files.
vtkDICOMImageReader::GetPixelSpacing
double * GetPixelSpacing()
Returns the pixel spacing (in X, Y, Z).
vtkDICOMImageReader::ExecuteDataWithInformation
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
VTK_FILEPATH
#define VTK_FILEPATH
Definition: vtkWrappingHints.h:46
vtkDICOMImageReader::PatientName
char * PatientName
Definition: vtkDICOMImageReader.h:280
vtkDICOMImageReader::~vtkDICOMImageReader
~vtkDICOMImageReader() override
vtkDICOMImageReader::GetNumberOfDICOMFileNames
int GetNumberOfDICOMFileNames()
vtkDICOMImageReader::vtkGetFilePathMacro
vtkGetFilePathMacro(DirectoryName)
Returns the directory name.
vtkDICOMImageReader::GetDICOMFileName
VTK_FILEPATH const char * GetDICOMFileName(int index)
vtkDICOMImageReader
Reads some DICOM images.
Definition: vtkDICOMImageReader.h:97
vtkDICOMImageReader::DirectoryName
char * DirectoryName
Definition: vtkDICOMImageReader.h:278
vtkDICOMImageReader::GetDescriptiveName
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
Definition: vtkDICOMImageReader.h:243
vtkDICOMImageReader::New
static vtkDICOMImageReader * New()
Static method for construction.
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkDICOMImageReader::Parser
DICOMParser * Parser
Definition: vtkDICOMImageReader.h:267
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkDICOMImageReader::SetFileName
void SetFileName(VTK_FILEPATH const char *fn) override
Set the filename for the file to read.
Definition: vtkDICOMImageReader.h:117
vtkImageReader2
Superclass of binary file readers.
Definition: vtkImageReader2.h:162
vtkDICOMImageReader::ExecuteInformation
void ExecuteInformation() override
vtkDICOMImageReader::DICOMFileNames
vtkDICOMImageReaderVector * DICOMFileNames
Definition: vtkDICOMImageReader.h:277
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkDICOMImageReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Prints the ivars.
vtkDICOMImageReader::TransferSyntaxUID
char * TransferSyntaxUID
Definition: vtkDICOMImageReader.h:283
vtkDICOMImageReader::AppHelper
DICOMAppHelper * AppHelper
Definition: vtkDICOMImageReader.h:272
vtkDICOMImageReader::StudyID
char * StudyID
Definition: vtkDICOMImageReader.h:282
vtkDICOMImageReader::vtkDICOMImageReader
vtkDICOMImageReader()
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkDICOMImageReader::StudyUID
char * StudyUID
Definition: vtkDICOMImageReader.h:281
vtkDICOMImageReader::SetupOutputInformation
void SetupOutputInformation(int num_slices)
vtkImageReader2::SetFileName
virtual void SetFileName(VTK_FILEPATH const char *)
Specify file name for the image file.
vtkImageReader2.h