VTK
dox/IO/Image/vtkDICOMImageReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDICOMImageReader.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00042 #ifndef __vtkDICOMImageReader_h
00043 #define __vtkDICOMImageReader_h
00044 
00045 #include "vtkIOImageModule.h" // For export macro
00046 #include "vtkImageReader2.h"
00047 
00048 //BTX
00049 class vtkDICOMImageReaderVector;
00050 class DICOMParser;
00051 class DICOMAppHelper;
00052 //ETX
00053 
00054 class VTKIOIMAGE_EXPORT vtkDICOMImageReader : public vtkImageReader2
00055 {
00056  public:
00058 
00059   static vtkDICOMImageReader *New();
00060   vtkTypeMacro(vtkDICOMImageReader,vtkImageReader2);
00062 
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00067 
00069   void SetFileName(const char* fn)
00070   {
00071     if (this->DirectoryName)
00072       {
00073       delete [] this->DirectoryName;
00074       }
00075     if (this->FileName)
00076       {
00077       delete [] this->FileName;
00078       }
00079     this->DirectoryName = NULL;
00080     this->FileName = NULL;
00081     this->vtkImageReader2::SetFileName(fn);
00082   }
00084 
00091   void SetDirectoryName(const char* dn);
00092 
00094 
00095   vtkGetStringMacro(DirectoryName);
00097 
00102   double* GetPixelSpacing();
00103 
00105   int GetWidth();
00106 
00108   int GetHeight();
00109 
00113   float* GetImagePositionPatient();
00114 
00118   float* GetImageOrientationPatient();
00119 
00121   int GetBitsAllocated();
00122 
00126   int GetPixelRepresentation();
00127 
00130   int GetNumberOfComponents();
00131 
00133   const char* GetTransferSyntaxUID();
00134 
00136   float GetRescaleSlope();
00137 
00139   float GetRescaleOffset();
00140 
00142   const char* GetPatientName();
00143 
00145   const char* GetStudyUID();
00146 
00148   const char* GetStudyID();
00149 
00151   float GetGantryAngle();
00152 
00153   //
00154   // Can I read the file?
00155   //
00156   virtual int CanReadFile(const char* fname);
00157 
00158   //
00159   // What file extensions are supported?
00160   //
00161   virtual const char* GetFileExtensions()
00162   {
00163     return ".dcm";
00164   }
00165 
00167 
00169   virtual const char* GetDescriptiveName()
00170   {
00171     return "DICOM";
00172   }
00174 
00175 protected:
00176   //
00177   // Setup the volume size
00178   //
00179   void SetupOutputInformation(int num_slices);
00180 
00181   virtual void ExecuteInformation();
00182   virtual void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo);
00183 
00184   //
00185   // Constructor
00186   //
00187   vtkDICOMImageReader();
00188 
00189   //
00190   // Destructor
00191   //
00192   virtual ~vtkDICOMImageReader();
00193 
00194   //
00195   // Instance of the parser used to parse the file.
00196   //
00197   DICOMParser* Parser;
00198 
00199   //
00200   // Instance of the callbacks that get the data from the file.
00201   //
00202   DICOMAppHelper* AppHelper;
00203 
00204   //
00205   // vtkDICOMImageReaderVector wants to be a PIMPL and it will be, but not quite yet.
00206   //
00207   vtkDICOMImageReaderVector* DICOMFileNames;
00208   char* DirectoryName;
00209 
00210   char* PatientName;
00211   char* StudyUID;
00212   char* StudyID;
00213   char* TransferSyntaxUID;
00214 
00215   // DICOMFileNames accessor methods for subclasses:
00216   int GetNumberOfDICOMFileNames();
00217   const char* GetDICOMFileName(int index);
00218 private:
00219   vtkDICOMImageReader(const vtkDICOMImageReader&);  // Not implemented.
00220   void operator=(const vtkDICOMImageReader&);  // Not implemented.
00221 
00222 };
00223 
00224 #endif