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 =========================================================================*/
52 #ifndef vtkDICOMImageReader_h
53 #define vtkDICOMImageReader_h
54 
55 #include "vtkIOImageModule.h" // For export macro
56 #include "vtkImageReader2.h"
57 
58 class vtkDICOMImageReaderVector;
59 class DICOMParser;
60 class DICOMAppHelper;
61 
62 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
63 {
64 public:
66 
72 
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
83  void SetFileName(VTK_FILEPATH const char* fn) override
84  {
85  delete[] this->DirectoryName;
86  delete[] this->FileName;
87  this->DirectoryName = nullptr;
88  this->FileName = nullptr;
90  }
92 
102  void SetDirectoryName(VTK_FILEPATH const char* dn);
103 
105 
108  vtkGetFilePathMacro(DirectoryName);
110 
118 
122  int GetWidth();
123 
127  int GetHeight();
128 
134  float* GetImagePositionPatient() VTK_SIZEHINT(3);
135 
141  float* GetImageOrientationPatient() VTK_SIZEHINT(6);
142 
146  int GetBitsAllocated();
147 
153  int GetPixelRepresentation();
154 
159  int GetNumberOfComponents();
160 
164  const char* GetTransferSyntaxUID();
165 
169  float GetRescaleSlope();
170 
174  float GetRescaleOffset();
175 
179  const char* GetPatientName();
180 
184  const char* GetStudyUID();
185 
189  const char* GetStudyID();
190 
194  float GetGantryAngle();
195 
196  //
197  // Can I read the file?
198  //
199  int CanReadFile(VTK_FILEPATH const char* fname) override;
200 
201  //
202  // What file extensions are supported?
203  //
204  const char* GetFileExtensions() override { return ".dcm"; }
205 
209  const char* GetDescriptiveName() override { return "DICOM"; }
210 
211 protected:
212  //
213  // Setup the volume size
214  //
215  void SetupOutputInformation(int num_slices);
216 
217  void ExecuteInformation() override;
219 
220  //
221  // Constructor
222  //
224 
225  //
226  // Destructor
227  //
229 
230  //
231  // Instance of the parser used to parse the file.
232  //
233  DICOMParser* Parser;
234 
235  //
236  // Instance of the callbacks that get the data from the file.
237  //
238  DICOMAppHelper* AppHelper;
239 
240  //
241  // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
242  //
243  vtkDICOMImageReaderVector* DICOMFileNames;
245 
246  char* PatientName;
247  char* StudyUID;
248  char* StudyID;
250 
251  // DICOMFileNames accessor methods for subclasses:
254 
255 private:
256  vtkDICOMImageReader(const vtkDICOMImageReader&) = delete;
257  void operator=(const vtkDICOMImageReader&) = delete;
258 };
259 
260 #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
Definition: vtkDataObject.h:75
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:49
Store vtkAlgorithm input/output information.
@ index
Definition: vtkX3D.h:252
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)