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 =========================================================================*/
46 #ifndef __vtkImageReader2_h
47 #define __vtkImageReader2_h
48 
49 #include "vtkImageAlgorithm.h"
50 
51 class vtkStringArray;
52 
53 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
54 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
55 
57 {
58 public:
59  static vtkImageReader2 *New();
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
64 
66  virtual void SetFileName(const char *);
67  vtkGetStringMacro(FileName);
69 
71 
75  virtual void SetFileNames(vtkStringArray *);
76  vtkGetObjectMacro(FileNames, vtkStringArray);
78 
80 
84  virtual void SetFilePrefix(const char *);
85  vtkGetStringMacro(FilePrefix);
87 
89 
91  virtual void SetFilePattern(const char *);
92  vtkGetStringMacro(FilePattern);
94 
96 
99  virtual void SetDataScalarType(int type);
100  virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
101  virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
102  virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
103  virtual void SetDataScalarTypeToUnsignedInt(){this->SetDataScalarType(VTK_UNSIGNED_INT);}
104  virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
105  virtual void SetDataScalarTypeToUnsignedShort()
106  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
107  virtual void SetDataScalarTypeToChar()
108  {this->SetDataScalarType(VTK_CHAR);}
109  virtual void SetDataScalarTypeToSignedChar()
110  {this->SetDataScalarType(VTK_SIGNED_CHAR);}
111  virtual void SetDataScalarTypeToUnsignedChar()
112  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
114 
116 
117  vtkGetMacro(DataScalarType, int);
119 
121 
122  vtkSetMacro(NumberOfScalarComponents,int);
123  vtkGetMacro(NumberOfScalarComponents,int);
125 
127 
128  vtkSetVector6Macro(DataExtent,int);
129  vtkGetVector6Macro(DataExtent,int);
131 
133 
134  vtkSetMacro(FileDimensionality, int);
135  int GetFileDimensionality() {return this->FileDimensionality;}
137 
139 
140  vtkSetVector3Macro(DataSpacing,double);
141  vtkGetVector3Macro(DataSpacing,double);
143 
145 
146  vtkSetVector3Macro(DataOrigin,double);
147  vtkGetVector3Macro(DataOrigin,double);
149 
151 
152  unsigned long GetHeaderSize();
153  unsigned long GetHeaderSize(unsigned long slice);
155 
158  virtual void SetHeaderSize(unsigned long size);
159 
161 
171  virtual void SetDataByteOrderToBigEndian();
172  virtual void SetDataByteOrderToLittleEndian();
173  virtual int GetDataByteOrder();
174  virtual void SetDataByteOrder(int);
175  virtual const char *GetDataByteOrderAsString();
177 
179 
181  vtkSetMacro(FileNameSliceOffset,int);
182  vtkGetMacro(FileNameSliceOffset,int);
184 
186 
189  vtkSetMacro(FileNameSliceSpacing,int);
190  vtkGetMacro(FileNameSliceSpacing,int);
192 
193 
195 
196  vtkSetMacro(SwapBytes,int);
197  virtual int GetSwapBytes() {return this->SwapBytes;}
198  vtkBooleanMacro(SwapBytes,int);
200 
201 //BTX
202  ifstream *GetFile() {return this->File;}
203  vtkGetVectorMacro(DataIncrements,unsigned long,4);
204 //ETX
205 
206  virtual int OpenFile();
207  virtual void SeekFile(int i, int j, int k);
208 
210 
212  vtkBooleanMacro(FileLowerLeft, int);
213  vtkGetMacro(FileLowerLeft, int);
214  vtkSetMacro(FileLowerLeft, int);
216 
218 
219  virtual void ComputeInternalFileName(int slice);
220  vtkGetStringMacro(InternalFileName);
222 
224 
230  virtual int CanReadFile(const char* vtkNotUsed(fname))
231  {
232  return 0;
233  }
235 
237 
239  virtual const char* GetFileExtensions()
240  {
241  return 0;
242  }
244 
246 
248  virtual const char* GetDescriptiveName()
249  {
250  return 0;
251  }
252 protected:
253  vtkImageReader2();
254  ~vtkImageReader2();
256 
258 
260  char *FileName;
261  char *FilePrefix;
262  char *FilePattern;
265 
266  ifstream *File;
267  unsigned long DataIncrements[4];
268  int DataExtent[6];
270 
272  unsigned long HeaderSize;
274  unsigned long ManualHeaderSize;
275 
276  double DataSpacing[3];
277  double DataOrigin[3];
278 
281 
282  virtual int RequestInformation(vtkInformation* request,
283  vtkInformationVector** inputVector,
284  vtkInformationVector* outputVector);
285  virtual void ExecuteInformation();
286  virtual void ExecuteData(vtkDataObject *data);
287  virtual void ComputeDataIncrements();
288 private:
289  vtkImageReader2(const vtkImageReader2&); // Not implemented.
290  void operator=(const vtkImageReader2&); // Not implemented.
291 };
292 
293 #endif