VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkMetaImageReader.h,v $ 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 =========================================================================*/ 00062 #ifndef __vtkMetaImageReader2_h 00063 #define __vtkMetaImageReader2_h 00064 00065 #include "vtkImageReader2.h" 00066 00067 //BTX 00068 namespace vtkmetaio { class MetaImage; } // forward declaration 00069 //ETX 00070 00071 class VTK_IO_EXPORT vtkMetaImageReader : public vtkImageReader2 00072 { 00073 public: 00074 vtkTypeRevisionMacro(vtkMetaImageReader,vtkImageReader2); 00075 void PrintSelf(ostream& os, vtkIndent indent); 00076 00078 static vtkMetaImageReader *New(); 00079 00080 virtual const char * GetFileExtensions() 00081 { return ".mhd .mha"; } 00082 00083 virtual const char * GetDescriptiveName() 00084 { return "MetaIO Library: MetaImage"; } 00085 00086 // These duplicate functions in vtkImageReader2, vtkMedicalImageReader. 00087 double * GetPixelSpacing() 00088 { return this->GetDataSpacing(); } 00089 int GetWidth() 00090 { return (this->GetDataExtent()[1] - this->GetDataExtent()[0] + 1); } 00091 int GetHeight() 00092 { return (this->GetDataExtent()[3] - this->GetDataExtent()[2] + 1); } 00093 double * GetImagePositionPatient() 00094 { return this->GetDataOrigin(); } 00095 int GetNumberOfComponents() 00096 { return this->GetNumberOfScalarComponents(); } 00097 int GetPixelRepresentation() 00098 { return this->GetDataScalarType(); } 00099 int GetDataByteOrder(void); 00100 00101 vtkGetMacro(RescaleSlope, double); 00102 vtkGetMacro(RescaleOffset, double); 00103 vtkGetMacro(BitsAllocated, int); 00104 vtkGetStringMacro(DistanceUnits); 00105 vtkGetStringMacro(AnatomicalOrientation); 00106 vtkGetMacro(GantryAngle, double); 00107 vtkGetStringMacro(PatientName); 00108 vtkGetStringMacro(PatientID); 00109 vtkGetStringMacro(Date); 00110 vtkGetStringMacro(Series); 00111 vtkGetStringMacro(ImageNumber); 00112 vtkGetStringMacro(Modality); 00113 vtkGetStringMacro(StudyID); 00114 vtkGetStringMacro(StudyUID); 00115 vtkGetStringMacro(TransferSyntaxUID); 00116 00118 virtual int CanReadFile(const char* name); 00119 00120 protected: 00121 vtkMetaImageReader(); 00122 ~vtkMetaImageReader(); 00123 00124 // These functions make no sense for this (or most) file readers 00125 // and should be hidden from the user...but then the getsettest fails. 00126 /*virtual void SetFilePrefix(const char * arg) 00127 { vtkImageReader2::SetFilePrefix(arg); } 00128 virtual void SetFilePattern(const char * arg) 00129 { vtkImageReader2::SetFilePattern(arg); } 00130 virtual void SetDataScalarType(int type) 00131 { vtkImageReader2::SetDataScalarType(type); } 00132 virtual void SetDataScalarTypeToFloat() 00133 { this->SetDataScalarType(VTK_FLOAT); } 00134 virtual void SetDataScalarTypeToDouble() 00135 { this->SetDataScalarType(VTK_DOUBLE); } 00136 virtual void SetDataScalarTypeToInt() 00137 { this->SetDataScalarType(VTK_INT); } 00138 virtual void SetDataScalarTypeToShort() 00139 { this->SetDataScalarType(VTK_SHORT); } 00140 virtual void SetDataScalarTypeToUnsignedShort() 00141 {this->SetDataScalarType(VTK_UNSIGNED_SHORT);} 00142 virtual void SetDataScalarTypeToUnsignedChar() 00143 {this->SetDataScalarType(VTK_UNSIGNED_CHAR);} 00144 vtkSetMacro(NumberOfScalarComponents, int); 00145 vtkSetVector6Macro(DataExtent, int); 00146 vtkSetMacro(FileDimensionality, int); 00147 vtkSetVector3Macro(DataSpacing, double); 00148 vtkSetVector3Macro(DataOrigin, double); 00149 vtkSetMacro(HeaderSize, unsigned long); 00150 unsigned long GetHeaderSize(unsigned long) 00151 { return 0; } 00152 virtual void SetDataByteOrderToBigEndian() 00153 { this->SetDataByteOrderToBigEndian(); } 00154 virtual void SetDataByteOrderToLittleEndian() 00155 { this->SetDataByteOrderToBigEndian(); } 00156 virtual void SetDataByteOrder(int order) 00157 { this->SetDataByteOrder(order); } 00158 vtkSetMacro(FileNameSliceOffset,int); 00159 vtkSetMacro(FileNameSliceSpacing,int); 00160 vtkSetMacro(SwapBytes, int); 00161 virtual int OpenFile() 00162 { return vtkImageReader2::OpenFile(); } 00163 virtual void SeekFile(int i, int j, int k) 00164 { vtkImageReader2::SeekFile(i, j, k); } 00165 vtkSetMacro(FileLowerLeft, int); 00166 virtual void ComputeInternalFileName(int slice) 00167 { vtkImageReader2::ComputeInternalFileName(slice); } 00168 vtkGetStringMacro(InternalFileName) 00169 const char * GetDataByteOrderAsString(void) 00170 { return vtkImageReader2::GetDataByteOrderAsString(); } 00171 unsigned long GetHeaderSize(void) 00172 { return vtkImageReader2::GetHeaderSize(); }*/ 00173 00174 void ExecuteInformation(); 00175 void ExecuteData(vtkDataObject *out); 00176 virtual int RequestInformation(vtkInformation * request, 00177 vtkInformationVector ** inputVector, 00178 vtkInformationVector * outputVector); 00179 00180 private: 00181 vtkMetaImageReader(const vtkMetaImageReader&); // Not implemented. 00182 void operator=(const vtkMetaImageReader&); // Not implemented. 00183 00184 //BTX 00185 vtkmetaio::MetaImage *MetaImagePtr; 00186 //ETX 00187 00188 double GantryAngle; 00189 char PatientName[255]; 00190 char PatientID[255]; 00191 char Date[255]; 00192 char Series[255]; 00193 char Study[255]; 00194 char ImageNumber[255]; 00195 char Modality[255]; 00196 char StudyID[255]; 00197 char StudyUID[255]; 00198 char TransferSyntaxUID[255]; 00199 00200 double RescaleSlope; 00201 double RescaleOffset; 00202 int BitsAllocated; 00203 char DistanceUnits[255]; 00204 char AnatomicalOrientation[255]; 00205 }; 00206 00207 #endif 00208 00209 00210