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