Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkImageReader2.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageReader2.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 =========================================================================*/
00041 #ifndef __vtkImageReader2_h
00042 #define __vtkImageReader2_h
00043 
00044 #include "vtkImageSource.h"
00045 
00046 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00047 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00048 
00049 class VTK_IO_EXPORT vtkImageReader2 : public vtkImageSource
00050 {
00051 public:
00052   static vtkImageReader2 *New();
00053   vtkTypeRevisionMacro(vtkImageReader2,vtkImageSource);
00054   void PrintSelf(ostream& os, vtkIndent indent);   
00055 
00057 
00060   virtual void SetFileName(const char *);
00061   vtkGetStringMacro(FileName);
00063 
00065 
00068   virtual void SetFilePrefix(const char *);
00069   vtkGetStringMacro(FilePrefix);
00071 
00073 
00074   virtual void SetFilePattern(const char *);
00075   vtkGetStringMacro(FilePattern);
00077 
00079 
00082   virtual void SetDataScalarType(int type);
00083   virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00084   virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00085   virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00086   virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00087   virtual void SetDataScalarTypeToUnsignedShort()
00088     {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00089   virtual void SetDataScalarTypeToUnsignedChar()
00090     {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00092 
00094 
00095   vtkGetMacro(DataScalarType, int);
00097 
00099 
00100   vtkSetMacro(NumberOfScalarComponents,int);
00101   vtkGetMacro(NumberOfScalarComponents,int);
00103   
00105 
00106   vtkSetVector6Macro(DataExtent,int);
00107   vtkGetVector6Macro(DataExtent,int);
00109   
00111 
00112   vtkSetMacro(FileDimensionality, int);
00113   int GetFileDimensionality() {return this->FileDimensionality;}
00115   
00117 
00118   vtkSetVector3Macro(DataSpacing,double);
00119   vtkGetVector3Macro(DataSpacing,double);
00121   
00123 
00124   vtkSetVector3Macro(DataOrigin,double);
00125   vtkGetVector3Macro(DataOrigin,double);
00127 
00129 
00130   unsigned long GetHeaderSize();
00131   unsigned long GetHeaderSize(unsigned long slice);
00133 
00136   virtual void SetHeaderSize(unsigned long size);
00137   
00139 
00149   virtual void SetDataByteOrderToBigEndian();
00150   virtual void SetDataByteOrderToLittleEndian();
00151   virtual int GetDataByteOrder();
00152   virtual void SetDataByteOrder(int);
00153   virtual const char *GetDataByteOrderAsString();
00155 
00157 
00159   vtkSetMacro(FileNameSliceOffset,int);
00160   vtkGetMacro(FileNameSliceOffset,int);
00162 
00164 
00167   vtkSetMacro(FileNameSliceSpacing,int);
00168   vtkGetMacro(FileNameSliceSpacing,int);
00170 
00171 
00173 
00174   vtkSetMacro(SwapBytes,int);
00175   virtual int GetSwapBytes() {return this->SwapBytes;}
00176   vtkBooleanMacro(SwapBytes,int);
00178 
00179 //BTX
00180   ifstream *GetFile() {return this->File;}
00181   vtkGetVectorMacro(DataIncrements,unsigned long,4);
00182 //ETX
00183 
00184   virtual int OpenFile();
00185   virtual void SeekFile(int i, int j, int k);
00186 
00188 
00190   vtkBooleanMacro(FileLowerLeft, int);
00191   vtkGetMacro(FileLowerLeft, int);
00192   vtkSetMacro(FileLowerLeft, int);
00194 
00196 
00197   virtual void ComputeInternalFileName(int slice);
00198   vtkGetStringMacro(InternalFileName);
00200   
00202 
00208   virtual int CanReadFile(const char* vtkNotUsed(fname))
00209     {
00210       return 0;
00211     }
00213 
00215 
00217   virtual const char* GetFileExtensions()
00218     {
00219       return 0;
00220     }
00222 
00224 
00226   virtual const char* GetDescriptiveName()
00227     {
00228       return 0;
00229     }
00231 protected:
00232   vtkImageReader2();
00233   ~vtkImageReader2();
00234 
00235   char *InternalFileName;
00236   char *FileName;
00237   char *FilePrefix;
00238   char *FilePattern;
00239   int NumberOfScalarComponents;
00240   int FileLowerLeft;
00241 
00242   ifstream *File;
00243   unsigned long DataIncrements[4];
00244   int DataExtent[6];
00245   int SwapBytes;
00246 
00247   int FileDimensionality;
00248   unsigned long HeaderSize;
00249   int DataScalarType;
00250   unsigned long ManualHeaderSize;
00251 
00252   double DataSpacing[3];
00253   double DataOrigin[3];
00254 
00255   int FileNameSliceOffset;
00256   int FileNameSliceSpacing;
00257   
00258   virtual void ExecuteInformation();
00259   virtual void ExecuteData(vtkDataObject *data);
00260   virtual void ComputeDataIncrements();
00261 private:
00262   vtkImageReader2(const vtkImageReader2&);  // Not implemented.
00263   void operator=(const vtkImageReader2&);  // Not implemented.
00264 };
00265 
00266 #endif