VTK
vtkImageReader2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageReader2.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
34 #ifndef __vtkImageReader2_h
35 #define __vtkImageReader2_h
36 
37 #include "vtkImageAlgorithm.h"
38 
39 class vtkStringArray;
40 
41 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
42 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
43 
45 {
46 public:
47  static vtkImageReader2 *New();
49  void PrintSelf(ostream& os, vtkIndent indent);
50 
52 
54  virtual void SetFileName(const char *);
55  vtkGetStringMacro(FileName);
57 
59 
63  virtual void SetFileNames(vtkStringArray *);
64  vtkGetObjectMacro(FileNames, vtkStringArray);
66 
68 
72  virtual void SetFilePrefix(const char *);
73  vtkGetStringMacro(FilePrefix);
75 
77 
79  virtual void SetFilePattern(const char *);
80  vtkGetStringMacro(FilePattern);
82 
84 
87  virtual void SetDataScalarType(int type);
88  virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
89  virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
90  virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
91  virtual void SetDataScalarTypeToUnsignedInt(){this->SetDataScalarType(VTK_UNSIGNED_INT);}
92  virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
94  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
95  virtual void SetDataScalarTypeToChar()
96  {this->SetDataScalarType(VTK_CHAR);}
98  {this->SetDataScalarType(VTK_SIGNED_CHAR);}
100  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
102 
104 
105  vtkGetMacro(DataScalarType, int);
107 
109 
110  vtkSetMacro(NumberOfScalarComponents,int);
111  vtkGetMacro(NumberOfScalarComponents,int);
113 
115 
116  vtkSetVector6Macro(DataExtent,int);
117  vtkGetVector6Macro(DataExtent,int);
119 
121 
122  vtkSetMacro(FileDimensionality, int);
123  int GetFileDimensionality() {return this->FileDimensionality;}
125 
127 
128  vtkSetVector3Macro(DataSpacing,double);
129  vtkGetVector3Macro(DataSpacing,double);
131 
133 
134  vtkSetVector3Macro(DataOrigin,double);
135  vtkGetVector3Macro(DataOrigin,double);
137 
139 
140  unsigned long GetHeaderSize();
141  unsigned long GetHeaderSize(unsigned long slice);
143 
146  virtual void SetHeaderSize(unsigned long size);
147 
149 
159  virtual void SetDataByteOrderToBigEndian();
160  virtual void SetDataByteOrderToLittleEndian();
161  virtual int GetDataByteOrder();
162  virtual void SetDataByteOrder(int);
163  virtual const char *GetDataByteOrderAsString();
165 
167 
169  vtkSetMacro(FileNameSliceOffset,int);
170  vtkGetMacro(FileNameSliceOffset,int);
172 
174 
177  vtkSetMacro(FileNameSliceSpacing,int);
178  vtkGetMacro(FileNameSliceSpacing,int);
180 
181 
183 
184  vtkSetMacro(SwapBytes,int);
185  virtual int GetSwapBytes() {return this->SwapBytes;}
186  vtkBooleanMacro(SwapBytes,int);
188 
189 //BTX
190  ifstream *GetFile() {return this->File;}
191  vtkGetVectorMacro(DataIncrements,unsigned long,4);
192 //ETX
193 
194  virtual int OpenFile();
195  virtual void SeekFile(int i, int j, int k);
196 
198 
200  vtkBooleanMacro(FileLowerLeft, int);
201  vtkGetMacro(FileLowerLeft, int);
202  vtkSetMacro(FileLowerLeft, int);
204 
206 
207  virtual void ComputeInternalFileName(int slice);
208  vtkGetStringMacro(InternalFileName);
210 
212 
218  virtual int CanReadFile(const char* vtkNotUsed(fname))
219  {
220  return 0;
221  }
223 
225 
227  virtual const char* GetFileExtensions()
228  {
229  return 0;
230  }
232 
234 
236  virtual const char* GetDescriptiveName()
237  {
238  return 0;
239  }
240 protected:
241  vtkImageReader2();
242  ~vtkImageReader2();
244 
246 
248  char *FileName;
249  char *FilePrefix;
250  char *FilePattern;
253 
254  ifstream *File;
255  unsigned long DataIncrements[4];
256  int DataExtent[6];
258 
260  unsigned long HeaderSize;
262  unsigned long ManualHeaderSize;
263 
264  double DataSpacing[3];
265  double DataOrigin[3];
266 
269 
270  virtual int RequestInformation(vtkInformation* request,
271  vtkInformationVector** inputVector,
272  vtkInformationVector* outputVector);
273  virtual void ExecuteInformation();
274  virtual void ExecuteData(vtkDataObject *data);
275  virtual void ComputeDataIncrements();
276 private:
277  vtkImageReader2(const vtkImageReader2&); // Not implemented.
278  void operator=(const vtkImageReader2&); // Not implemented.
279 };
280 
281 #endif