VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImageReader2.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 =========================================================================*/ 00046 #ifndef __vtkImageReader2_h 00047 #define __vtkImageReader2_h 00048 00049 #include "vtkIOImageModule.h" // For export macro 00050 #include "vtkImageAlgorithm.h" 00051 00052 class vtkStringArray; 00053 00054 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0 00055 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1 00056 00057 class VTKIOIMAGE_EXPORT vtkImageReader2 : public vtkImageAlgorithm 00058 { 00059 public: 00060 static vtkImageReader2 *New(); 00061 vtkTypeMacro(vtkImageReader2,vtkImageAlgorithm); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00063 00065 00067 virtual void SetFileName(const char *); 00068 vtkGetStringMacro(FileName); 00070 00072 00076 virtual void SetFileNames(vtkStringArray *); 00077 vtkGetObjectMacro(FileNames, vtkStringArray); 00079 00081 00085 virtual void SetFilePrefix(const char *); 00086 vtkGetStringMacro(FilePrefix); 00088 00090 00092 virtual void SetFilePattern(const char *); 00093 vtkGetStringMacro(FilePattern); 00095 00097 00099 virtual void SetMemoryBuffer(void *); 00100 virtual void *GetMemoryBuffer() { return this->MemoryBuffer; } 00102 00104 00105 virtual void SetMemoryBufferLength(vtkIdType buflen); 00106 vtkIdType GetMemoryBufferLength() { return this->MemoryBufferLength; } 00108 00110 00113 virtual void SetDataScalarType(int type); 00114 virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);} 00115 virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);} 00116 virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);} 00117 virtual void SetDataScalarTypeToUnsignedInt(){this->SetDataScalarType(VTK_UNSIGNED_INT);} 00118 virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);} 00119 virtual void SetDataScalarTypeToUnsignedShort() 00120 {this->SetDataScalarType(VTK_UNSIGNED_SHORT);} 00121 virtual void SetDataScalarTypeToChar() 00122 {this->SetDataScalarType(VTK_CHAR);} 00123 virtual void SetDataScalarTypeToSignedChar() 00124 {this->SetDataScalarType(VTK_SIGNED_CHAR);} 00125 virtual void SetDataScalarTypeToUnsignedChar() 00126 {this->SetDataScalarType(VTK_UNSIGNED_CHAR);} 00128 00130 00131 vtkGetMacro(DataScalarType, int); 00133 00135 00136 vtkSetMacro(NumberOfScalarComponents,int); 00137 vtkGetMacro(NumberOfScalarComponents,int); 00139 00141 00142 vtkSetVector6Macro(DataExtent,int); 00143 vtkGetVector6Macro(DataExtent,int); 00145 00147 00148 vtkSetMacro(FileDimensionality, int); 00149 int GetFileDimensionality() {return this->FileDimensionality;} 00151 00153 00154 vtkSetVector3Macro(DataSpacing,double); 00155 vtkGetVector3Macro(DataSpacing,double); 00157 00159 00160 vtkSetVector3Macro(DataOrigin,double); 00161 vtkGetVector3Macro(DataOrigin,double); 00163 00165 00166 unsigned long GetHeaderSize(); 00167 unsigned long GetHeaderSize(unsigned long slice); 00169 00172 virtual void SetHeaderSize(unsigned long size); 00173 00175 00185 virtual void SetDataByteOrderToBigEndian(); 00186 virtual void SetDataByteOrderToLittleEndian(); 00187 virtual int GetDataByteOrder(); 00188 virtual void SetDataByteOrder(int); 00189 virtual const char *GetDataByteOrderAsString(); 00191 00193 00195 vtkSetMacro(FileNameSliceOffset,int); 00196 vtkGetMacro(FileNameSliceOffset,int); 00198 00200 00203 vtkSetMacro(FileNameSliceSpacing,int); 00204 vtkGetMacro(FileNameSliceSpacing,int); 00206 00207 00209 00210 vtkSetMacro(SwapBytes,int); 00211 virtual int GetSwapBytes() {return this->SwapBytes;} 00212 vtkBooleanMacro(SwapBytes,int); 00214 00215 //BTX 00216 ifstream *GetFile() {return this->File;} 00217 vtkGetVectorMacro(DataIncrements,unsigned long,4); 00218 //ETX 00219 00220 virtual int OpenFile(); 00221 virtual void SeekFile(int i, int j, int k); 00222 00224 00226 vtkBooleanMacro(FileLowerLeft, int); 00227 vtkGetMacro(FileLowerLeft, int); 00228 vtkSetMacro(FileLowerLeft, int); 00230 00232 00233 virtual void ComputeInternalFileName(int slice); 00234 vtkGetStringMacro(InternalFileName); 00236 00238 00244 virtual int CanReadFile(const char* vtkNotUsed(fname)) 00245 { 00246 return 0; 00247 } 00249 00251 00253 virtual const char* GetFileExtensions() 00254 { 00255 return 0; 00256 } 00258 00260 00262 virtual const char* GetDescriptiveName() 00263 { 00264 return 0; 00265 } 00266 protected: 00267 vtkImageReader2(); 00268 ~vtkImageReader2(); 00270 00271 vtkStringArray *FileNames; 00272 00273 char *InternalFileName; 00274 char *FileName; 00275 char *FilePrefix; 00276 char *FilePattern; 00277 int NumberOfScalarComponents; 00278 int FileLowerLeft; 00279 00280 void *MemoryBuffer; 00281 vtkIdType MemoryBufferLength; 00282 00283 ifstream *File; 00284 unsigned long DataIncrements[4]; 00285 int DataExtent[6]; 00286 int SwapBytes; 00287 00288 int FileDimensionality; 00289 unsigned long HeaderSize; 00290 int DataScalarType; 00291 unsigned long ManualHeaderSize; 00292 00293 double DataSpacing[3]; 00294 double DataOrigin[3]; 00295 00296 int FileNameSliceOffset; 00297 int FileNameSliceSpacing; 00298 00299 virtual int RequestInformation(vtkInformation* request, 00300 vtkInformationVector** inputVector, 00301 vtkInformationVector* outputVector); 00302 virtual void ExecuteInformation(); 00303 virtual void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo); 00304 virtual void ComputeDataIncrements(); 00305 private: 00306 vtkImageReader2(const vtkImageReader2&); // Not implemented. 00307 void operator=(const vtkImageReader2&); // Not implemented. 00308 }; 00309 00310 #endif