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

IO/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 =========================================================================*/
00028 #ifndef __vtkImageReader2_h
00029 #define __vtkImageReader2_h
00030 
00031 #include "vtkImageSource.h"
00032 
00033 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00034 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00035 
00036 class VTK_IO_EXPORT vtkImageReader2 : public vtkImageSource
00037 {
00038 public:
00039   static vtkImageReader2 *New();
00040   vtkTypeRevisionMacro(vtkImageReader2,vtkImageSource);
00041   void PrintSelf(ostream& os, vtkIndent indent);   
00042 
00044 
00047   virtual void SetFileName(const char *);
00048   vtkGetStringMacro(FileName);
00050 
00052 
00055   virtual void SetFilePrefix(const char *);
00056   vtkGetStringMacro(FilePrefix);
00058 
00060 
00061   virtual void SetFilePattern(const char *);
00062   vtkGetStringMacro(FilePattern);
00064 
00066 
00069   virtual void SetDataScalarType(int type);
00070   virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00071   virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00072   virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00073   virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00074   virtual void SetDataScalarTypeToUnsignedShort()
00075     {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00076   virtual void SetDataScalarTypeToUnsignedChar()
00077     {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00079 
00081 
00082   vtkGetMacro(DataScalarType, int);
00084 
00086 
00087   vtkSetMacro(NumberOfScalarComponents,int);
00088   vtkGetMacro(NumberOfScalarComponents,int);
00090   
00092 
00093   vtkSetVector6Macro(DataExtent,int);
00094   vtkGetVector6Macro(DataExtent,int);
00096   
00098 
00099   vtkSetMacro(FileDimensionality, int);
00100   int GetFileDimensionality() {return this->FileDimensionality;}
00102   
00104 
00105   vtkSetVector3Macro(DataSpacing,double);
00106   vtkGetVector3Macro(DataSpacing,double);
00108   
00110 
00111   vtkSetVector3Macro(DataOrigin,double);
00112   vtkGetVector3Macro(DataOrigin,double);
00114 
00116 
00117   unsigned long GetHeaderSize();
00118   unsigned long GetHeaderSize(unsigned long slice);
00120 
00123   virtual void SetHeaderSize(unsigned long size);
00124   
00126 
00136   virtual void SetDataByteOrderToBigEndian();
00137   virtual void SetDataByteOrderToLittleEndian();
00138   virtual int GetDataByteOrder();
00139   virtual void SetDataByteOrder(int);
00140   virtual const char *GetDataByteOrderAsString();
00142 
00144 
00146   vtkSetMacro(FileNameSliceOffset,int);
00147   vtkGetMacro(FileNameSliceOffset,int);
00149 
00151 
00154   vtkSetMacro(FileNameSliceSpacing,int);
00155   vtkGetMacro(FileNameSliceSpacing,int);
00157 
00158 
00160 
00161   vtkSetMacro(SwapBytes,int);
00162   virtual int GetSwapBytes() {return this->SwapBytes;}
00163   vtkBooleanMacro(SwapBytes,int);
00165 
00166 //BTX
00167   ifstream *GetFile() {return this->File;}
00168   vtkGetVectorMacro(DataIncrements,unsigned long,4);
00169 //ETX
00170 
00171   virtual int OpenFile();
00172   virtual void SeekFile(int i, int j, int k);
00173 
00175 
00177   vtkBooleanMacro(FileLowerLeft, int);
00178   vtkGetMacro(FileLowerLeft, int);
00179   vtkSetMacro(FileLowerLeft, int);
00181 
00183 
00184   virtual void ComputeInternalFileName(int slice);
00185   vtkGetStringMacro(InternalFileName);
00187   
00189 
00195   virtual int CanReadFile(const char* vtkNotUsed(fname))
00196     {
00197       return 0;
00198     }
00200 
00202 
00204   virtual const char* GetFileExtensions()
00205     {
00206       return 0;
00207     }
00209 
00211 
00213   virtual const char* GetDescriptiveName()
00214     {
00215       return 0;
00216     }
00218 protected:
00219   vtkImageReader2();
00220   ~vtkImageReader2();
00221 
00222   char *InternalFileName;
00223   char *FileName;
00224   char *FilePrefix;
00225   char *FilePattern;
00226   int NumberOfScalarComponents;
00227   int FileLowerLeft;
00228 
00229   ifstream *File;
00230   unsigned long DataIncrements[4];
00231   int DataExtent[6];
00232   int SwapBytes;
00233 
00234   int FileDimensionality;
00235   unsigned long HeaderSize;
00236   int DataScalarType;
00237   unsigned long ManualHeaderSize;
00238 
00239   double DataSpacing[3];
00240   double DataOrigin[3];
00241 
00242   int FileNameSliceOffset;
00243   int FileNameSliceSpacing;
00244   
00245   virtual void ExecuteInformation();
00246   virtual void ExecuteData(vtkDataObject *data);
00247   virtual void ComputeDataIncrements();
00248 private:
00249   vtkImageReader2(const vtkImageReader2&);  // Not implemented.
00250   void operator=(const vtkImageReader2&);  // Not implemented.
00251 };
00252 
00253 #endif