VTK  9.7.0
vtkDICOMImageReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
32
33#ifndef vtkDICOMImageReader_h
34#define vtkDICOMImageReader_h
35
36#include "vtkIOImageModule.h" // For export macro
37#include "vtkImageReader2.h"
38
39#include <istream> // for IStream
40#include <streambuf> // for Streambuf
41
42VTK_ABI_NAMESPACE_BEGIN
43class vtkDICOMImageReaderVector;
44class DICOMParser;
45class DICOMAppHelper;
46
47class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
48{
49public:
51
57
61 void PrintSelf(ostream& os, vtkIndent indent) override;
62
64
68 void SetFileName(VTK_FILEPATH 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(VTK_FILEPATH const char* dn);
88
90
95
103
107 int GetWidth();
108
113
120
127
132
139
145
149 const char* GetTransferSyntaxUID();
150
155
160
164 const char* GetPatientName();
165
169 const char* GetStudyUID();
170
174 const char* GetStudyID();
175
180
182
187 int CanReadFile(VTK_FILEPATH const char* fname) override;
188 int CanReadFile(vtkResourceStream* stream) override;
190
191 //
192 // What file extensions are supported?
193 //
194 const char* GetFileExtensions() override { return ".dcm"; }
195
199 const char* GetDescriptiveName() override { return "DICOM"; }
200
201protected:
202 //
203 // Setup the volume size
204 //
205 void SetupOutputInformation(int num_slices);
206
207 void ExecuteInformation() override;
209
210 //
211 // Constructor
212 //
214
215 //
216 // Destructor
217 //
219
220 //
221 // Instance of the parser used to parse the file.
222 //
223 DICOMParser* Parser;
224
225 //
226 // Instance of the callbacks that get the data from the file.
227 //
228 DICOMAppHelper* AppHelper;
229
230 //
231 // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
232 //
233 vtkDICOMImageReaderVector* DICOMFileNames;
235
237 char* StudyUID;
238 char* StudyID;
240
241 // DICOMFileNames accessor methods for subclasses:
243 VTK_FILEPATH const char* GetDICOMFileName(int index);
244
245private:
247 void operator=(const vtkDICOMImageReader&) = delete;
248
249 // Used when reading streams
250 std::unique_ptr<std::streambuf> Streambuf;
251};
252
253VTK_ABI_NAMESPACE_END
254#endif
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
void ExecuteInformation() override
const char * GetStudyUID()
Get the study uid for the last image processed.
void SetupOutputInformation(int num_slices)
static vtkDICOMImageReader * New()
Static method for construction.
const char * GetStudyID()
Get the Study ID for the last image processed.
vtkDICOMImageReaderVector * DICOMFileNames
DICOMAppHelper * AppHelper
void SetDirectoryName(const char *dn)
Set the directory name for the reader to look in for DICOM files.
float GetGantryAngle()
Get the gantry angle for the last image processed.
int GetHeight()
Returns the image height.
int GetNumberOfComponents()
Get the number of components of the image data for the last image processed.
float * GetImagePositionPatient()
Get the (DICOM) x,y,z coordinates of the first pixel in the image (upper left hand corner) of the las...
int GetPixelRepresentation()
Get the pixel representation of the last image processed by the DICOMParser.
float GetRescaleOffset()
Get the rescale offset for the pixel data.
void SetFileName(const char *fn) override
Set the filename for the file to read.
int CanReadFile(const char *fname) override
Return 1 if, after a quick check of file header, it looks like the provided file or stream can be rea...
int GetBitsAllocated()
Get the number of bits allocated for each pixel in the file.
const char * GetFileExtensions() override
Get the file extensions for this format.
double * GetPixelSpacing()
Returns the pixel spacing (in X, Y, Z).
float GetRescaleSlope()
Get the rescale slope for the pixel data.
int GetWidth()
Returns the image width.
const char * GetDICOMFileName(int index)
float * GetImageOrientationPatient()
Get the (DICOM) directions cosines.
const char * GetTransferSyntaxUID()
Get the transfer syntax UID for the last image processed.
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 * GetPatientName()
Get the patient name for the last image processed.
vtkGetFilePathMacro(DirectoryName)
Returns the directory name.
general representation of visualization data
virtual void SetFileName(const char *)
Specify file name for the image file.
vtkImageReader2()
Return a descriptive name for the file format that might be useful in a GUI.
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
Abstract class used for custom streams.
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)