00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00034 #ifndef __vtkImageReader2_h
00035 #define __vtkImageReader2_h
00036
00037 #include "vtkImageAlgorithm.h"
00038
00039 class vtkStringArray;
00040
00041 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00042 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00043
00044 class VTK_IO_EXPORT vtkImageReader2 : public vtkImageAlgorithm
00045 {
00046 public:
00047 static vtkImageReader2 *New();
00048 vtkTypeMacro(vtkImageReader2,vtkImageAlgorithm);
00049 void PrintSelf(ostream& os, vtkIndent indent);
00050
00052
00054 virtual void SetFileName(const char *);
00055 vtkGetStringMacro(FileName);
00057
00059
00063 virtual void SetFileNames(vtkStringArray *);
00064 vtkGetObjectMacro(FileNames, vtkStringArray);
00066
00068
00072 virtual void SetFilePrefix(const char *);
00073 vtkGetStringMacro(FilePrefix);
00075
00077
00079 virtual void SetFilePattern(const char *);
00080 vtkGetStringMacro(FilePattern);
00082
00084
00087 virtual void SetDataScalarType(int type);
00088 virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00089 virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00090 virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00091 virtual void SetDataScalarTypeToUnsignedInt(){this->SetDataScalarType(VTK_UNSIGNED_INT);}
00092 virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00093 virtual void SetDataScalarTypeToUnsignedShort()
00094 {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00095 virtual void SetDataScalarTypeToChar()
00096 {this->SetDataScalarType(VTK_CHAR);}
00097 virtual void SetDataScalarTypeToSignedChar()
00098 {this->SetDataScalarType(VTK_SIGNED_CHAR);}
00099 virtual void SetDataScalarTypeToUnsignedChar()
00100 {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00102
00104
00105 vtkGetMacro(DataScalarType, int);
00107
00109
00110 vtkSetMacro(NumberOfScalarComponents,int);
00111 vtkGetMacro(NumberOfScalarComponents,int);
00113
00115
00116 vtkSetVector6Macro(DataExtent,int);
00117 vtkGetVector6Macro(DataExtent,int);
00119
00121
00122 vtkSetMacro(FileDimensionality, int);
00123 int GetFileDimensionality() {return this->FileDimensionality;}
00125
00127
00128 vtkSetVector3Macro(DataSpacing,double);
00129 vtkGetVector3Macro(DataSpacing,double);
00131
00133
00134 vtkSetVector3Macro(DataOrigin,double);
00135 vtkGetVector3Macro(DataOrigin,double);
00137
00139
00140 unsigned long GetHeaderSize();
00141 unsigned long GetHeaderSize(unsigned long slice);
00143
00146 virtual void SetHeaderSize(unsigned long size);
00147
00149
00159 virtual void SetDataByteOrderToBigEndian();
00160 virtual void SetDataByteOrderToLittleEndian();
00161 virtual int GetDataByteOrder();
00162 virtual void SetDataByteOrder(int);
00163 virtual const char *GetDataByteOrderAsString();
00165
00167
00169 vtkSetMacro(FileNameSliceOffset,int);
00170 vtkGetMacro(FileNameSliceOffset,int);
00172
00174
00177 vtkSetMacro(FileNameSliceSpacing,int);
00178 vtkGetMacro(FileNameSliceSpacing,int);
00180
00181
00183
00184 vtkSetMacro(SwapBytes,int);
00185 virtual int GetSwapBytes() {return this->SwapBytes;}
00186 vtkBooleanMacro(SwapBytes,int);
00188
00189
00190 ifstream *GetFile() {return this->File;}
00191 vtkGetVectorMacro(DataIncrements,unsigned long,4);
00192
00193
00194 virtual int OpenFile();
00195 virtual void SeekFile(int i, int j, int k);
00196
00198
00200 vtkBooleanMacro(FileLowerLeft, int);
00201 vtkGetMacro(FileLowerLeft, int);
00202 vtkSetMacro(FileLowerLeft, int);
00204
00206
00207 virtual void ComputeInternalFileName(int slice);
00208 vtkGetStringMacro(InternalFileName);
00210
00212
00218 virtual int CanReadFile(const char* vtkNotUsed(fname))
00219 {
00220 return 0;
00221 }
00223
00225
00227 virtual const char* GetFileExtensions()
00228 {
00229 return 0;
00230 }
00232
00234
00236 virtual const char* GetDescriptiveName()
00237 {
00238 return 0;
00239 }
00241 protected:
00242 vtkImageReader2();
00243 ~vtkImageReader2();
00244
00245 vtkStringArray *FileNames;
00246
00247 char *InternalFileName;
00248 char *FileName;
00249 char *FilePrefix;
00250 char *FilePattern;
00251 int NumberOfScalarComponents;
00252 int FileLowerLeft;
00253
00254 ifstream *File;
00255 unsigned long DataIncrements[4];
00256 int DataExtent[6];
00257 int SwapBytes;
00258
00259 int FileDimensionality;
00260 unsigned long HeaderSize;
00261 int DataScalarType;
00262 unsigned long ManualHeaderSize;
00263
00264 double DataSpacing[3];
00265 double DataOrigin[3];
00266
00267 int FileNameSliceOffset;
00268 int FileNameSliceSpacing;
00269
00270 virtual int RequestInformation(vtkInformation* request,
00271 vtkInformationVector** inputVector,
00272 vtkInformationVector* outputVector);
00273 virtual void ExecuteInformation();
00274 virtual void ExecuteData(vtkDataObject *data);
00275 virtual void ComputeDataIncrements();
00276 private:
00277 vtkImageReader2(const vtkImageReader2&);
00278 void operator=(const vtkImageReader2&);
00279 };
00280
00281 #endif