Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00044 #ifndef __vtkImageReader2_h
00045 #define __vtkImageReader2_h
00046 
00047 #include "vtkImageSource.h"
00048 
00049 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00050 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00051 
00052 class VTK_IO_EXPORT vtkImageReader2 : public vtkImageSource
00053 {
00054 public:
00055   static vtkImageReader2 *New();
00056   vtkTypeRevisionMacro(vtkImageReader2,vtkImageSource);
00057   void PrintSelf(ostream& os, vtkIndent indent);   
00058 
00060 
00063   void SetFileName(const char *);
00064   vtkGetStringMacro(FileName);
00066 
00068 
00071   void SetFilePrefix(const char *);
00072   vtkGetStringMacro(FilePrefix);
00074 
00076 
00077   void SetFilePattern(const char *);
00078   vtkGetStringMacro(FilePattern);
00080 
00082 
00085   void SetDataScalarType(int type);
00086   void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00087   void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00088   void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00089   void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00090   void SetDataScalarTypeToUnsignedShort()
00091     {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00092   void SetDataScalarTypeToUnsignedChar()
00093     {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00095 
00097 
00098   vtkGetMacro(DataScalarType, int);
00100 
00102 
00103   vtkSetMacro(NumberOfScalarComponents,int);
00104   vtkGetMacro(NumberOfScalarComponents,int);
00106   
00108 
00109   vtkSetVector6Macro(DataExtent,int);
00110   vtkGetVector6Macro(DataExtent,int);
00112   
00114 
00115   vtkSetMacro(FileDimensionality, int);
00116   int GetFileDimensionality() {return this->FileDimensionality;}
00118   
00120 
00121   vtkSetVector3Macro(DataSpacing,float);
00122   vtkGetVector3Macro(DataSpacing,float);
00124   
00126 
00127   vtkSetVector3Macro(DataOrigin,float);
00128   vtkGetVector3Macro(DataOrigin,float);
00130 
00132 
00133   unsigned long GetHeaderSize();
00134   unsigned long GetHeaderSize(unsigned long slice);
00136 
00139   void SetHeaderSize(unsigned long size);
00140   
00142 
00152   void SetDataByteOrderToBigEndian();
00153   void SetDataByteOrderToLittleEndian();
00154   int GetDataByteOrder();
00155   void SetDataByteOrder(int);
00156   const char *GetDataByteOrderAsString();
00158 
00160 
00162   vtkSetMacro(FileNameSliceOffset,int);
00163   vtkGetMacro(FileNameSliceOffset,int);
00165 
00167 
00170   vtkSetMacro(FileNameSliceSpacing,int);
00171   vtkGetMacro(FileNameSliceSpacing,int);
00173 
00174 
00176 
00177   vtkSetMacro(SwapBytes,int);
00178   int GetSwapBytes() {return this->SwapBytes;}
00179   vtkBooleanMacro(SwapBytes,int);
00181 
00182 //BTX
00183   ifstream *GetFile() {return this->File;}
00184   vtkGetVectorMacro(DataIncrements,unsigned long,4);
00185 //ETX
00186 
00187   int OpenFile();
00188   void SeekFile(int i, int j, int k);
00189 
00191 
00193   vtkBooleanMacro(FileLowerLeft, int);
00194   vtkGetMacro(FileLowerLeft, int);
00195   vtkSetMacro(FileLowerLeft, int);
00197 
00199 
00200   void ComputeInternalFileName(int slice);
00201   vtkGetStringMacro(InternalFileName);
00203   
00204 #ifndef VTK_REMOVE_LEGACY_CODE
00205 
00206   virtual vtkImageReader2* MakeObject();
00207 #endif
00208   
00210 
00216   virtual int CanReadFile(const char* vtkNotUsed(fname))
00217     {
00218       return 0;
00219     }
00221 
00223 
00225   virtual const char* GetFileExensions()
00226     {
00227       return 0;
00228     }
00230 
00232 
00234   virtual const char* GetDescriptiveName()
00235     {
00236       return 0;
00237     }
00239 protected:
00240   vtkImageReader2();
00241   ~vtkImageReader2();
00242 
00243   char *InternalFileName;
00244   char *FileName;
00245   char *FilePrefix;
00246   char *FilePattern;
00247   int NumberOfScalarComponents;
00248   int FileLowerLeft;
00249 
00250   ifstream *File;
00251   unsigned long DataIncrements[4];
00252   int DataExtent[6];
00253   int SwapBytes;
00254 
00255   int FileDimensionality;
00256   unsigned long HeaderSize;
00257   int DataScalarType;
00258   unsigned long ManualHeaderSize;
00259 
00260   float DataSpacing[3];
00261   float DataOrigin[3];
00262 
00263   int FileNameSliceOffset;
00264   int FileNameSliceSpacing;
00265   
00266   virtual void ExecuteInformation();
00267   virtual void ExecuteData(vtkDataObject *data);
00268   virtual void ComputeDataIncrements();
00269 private:
00270   vtkImageReader2(const vtkImageReader2&);  // Not implemented.
00271   void operator=(const vtkImageReader2&);  // Not implemented.
00272 };
00273 
00274 #endif