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-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038 =========================================================================*/
00052 #ifndef __vtkImageReader2_h
00053 #define __vtkImageReader2_h
00054 
00055 #include "vtkImageSource.h"
00056 
00057 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00058 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00059 
00060 class VTK_IO_EXPORT vtkImageReader2 : public vtkImageSource
00061 {
00062 public:
00063   static vtkImageReader2 *New();
00064   vtkTypeMacro(vtkImageReader2,vtkImageSource);
00065   void PrintSelf(ostream& os, vtkIndent indent);   
00066 
00068 
00071   void SetFileName(const char *);
00072   vtkGetStringMacro(FileName);
00074 
00076 
00079   void SetFilePrefix(const char *);
00080   vtkGetStringMacro(FilePrefix);
00082 
00084 
00085   void SetFilePattern(const char *);
00086   vtkGetStringMacro(FilePattern);
00088 
00090 
00093   void SetDataScalarType(int type);
00094   void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00095   void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00096   void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00097   void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00098   void SetDataScalarTypeToUnsignedShort()
00099     {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00100   void SetDataScalarTypeToUnsignedChar()
00101     {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00103 
00105 
00106   vtkGetMacro(DataScalarType, int);
00108 
00110 
00111   vtkSetMacro(NumberOfScalarComponents,int);
00112   vtkGetMacro(NumberOfScalarComponents,int);
00114   
00116 
00117   vtkSetVector6Macro(DataExtent,int);
00118   vtkGetVector6Macro(DataExtent,int);
00120   
00122 
00123   vtkSetMacro(FileDimensionality, int);
00124   int GetFileDimensionality() {return this->FileDimensionality;}
00126   
00128 
00129   vtkSetVector3Macro(DataSpacing,float);
00130   vtkGetVector3Macro(DataSpacing,float);
00132   
00134 
00135   vtkSetVector3Macro(DataOrigin,float);
00136   vtkGetVector3Macro(DataOrigin,float);
00138 
00140 
00141   int GetHeaderSize();
00142   int GetHeaderSize(int slice);
00144 
00147   void SetHeaderSize(int size);
00148   
00150 
00160   void SetDataByteOrderToBigEndian();
00161   void SetDataByteOrderToLittleEndian();
00162   int GetDataByteOrder();
00163   void SetDataByteOrder(int);
00164   const char *GetDataByteOrderAsString();
00166 
00168 
00169   vtkSetMacro(SwapBytes,int);
00170   int GetSwapBytes() {return this->SwapBytes;}
00171   vtkBooleanMacro(SwapBytes,int);
00173 
00174 //BTX
00175   ifstream *GetFile() {return this->File;}
00176   vtkGetVectorMacro(DataIncrements,unsigned long,4);
00177 //ETX
00178 
00179   void OpenFile();
00180   void SeekFile(int i, int j, int k);
00181 
00183 
00185   vtkBooleanMacro(FileLowerLeft, int);
00186   vtkGetMacro(FileLowerLeft, int);
00187   vtkSetMacro(FileLowerLeft, int);
00189 
00191 
00192   void ComputeInternalFileName(int slice);
00193   vtkGetStringMacro(InternalFileName);
00195   
00196 protected:
00197   vtkImageReader2();
00198   ~vtkImageReader2();
00199 
00200   char *InternalFileName;
00201   char *FileName;
00202   char *FilePrefix;
00203   char *FilePattern;
00204   int NumberOfScalarComponents;
00205   int FileLowerLeft;
00206 
00207   ifstream *File;
00208   unsigned long DataIncrements[4];
00209   int DataExtent[6];
00210   int SwapBytes;
00211 
00212   int FileDimensionality;
00213   int HeaderSize;
00214   int DataScalarType;
00215   int ManualHeaderSize;
00216 
00217   float DataSpacing[3];
00218   float DataOrigin[3];
00219 
00220   virtual void ExecuteInformation();
00221   virtual void ExecuteData(vtkDataObject *data);
00222   virtual void ComputeDataIncrements();
00223 private:
00224   vtkImageReader2(const vtkImageReader2&);  // Not implemented.
00225   void operator=(const vtkImageReader2&);  // Not implemented.
00226 };
00227 
00228 #endif

Generated on Thu Mar 28 14:19:28 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001