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 "vtkIOImageModule.h" // For export macro
50 #include "vtkImageAlgorithm.h"
51 
52 class vtkStringArray;
53 
54 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
55 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
56 
58 {
59 public:
60  static vtkImageReader2 *New();
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
65 
67  virtual void SetFileName(const char *);
68  vtkGetStringMacro(FileName);
70 
72 
76  virtual void SetFileNames(vtkStringArray *);
77  vtkGetObjectMacro(FileNames, vtkStringArray);
79 
81 
85  virtual void SetFilePrefix(const char *);
86  vtkGetStringMacro(FilePrefix);
88 
90 
92  virtual void SetFilePattern(const char *);
93  vtkGetStringMacro(FilePattern);
95 
97 
99  virtual void SetMemoryBuffer(void *);
100  virtual void *GetMemoryBuffer() { return this->MemoryBuffer; }
102 
104 
105  virtual void SetMemoryBufferLength(vtkIdType buflen);
106  vtkIdType GetMemoryBufferLength() { return this->MemoryBufferLength; }
108 
110 
113  virtual void SetDataScalarType(int type);
114  virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
115  virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
116  virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
117  virtual void SetDataScalarTypeToUnsignedInt(){this->SetDataScalarType(VTK_UNSIGNED_INT);}
118  virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
120  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
121  virtual void SetDataScalarTypeToChar()
122  {this->SetDataScalarType(VTK_CHAR);}
124  {this->SetDataScalarType(VTK_SIGNED_CHAR);}
126  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
128 
130 
131  vtkGetMacro(DataScalarType, int);
133 
135 
136  vtkSetMacro(NumberOfScalarComponents,int);
137  vtkGetMacro(NumberOfScalarComponents,int);
139 
141 
142  vtkSetVector6Macro(DataExtent,int);
143  vtkGetVector6Macro(DataExtent,int);
145 
147 
148  vtkSetMacro(FileDimensionality, int);
149  int GetFileDimensionality() {return this->FileDimensionality;}
151 
153 
154  vtkSetVector3Macro(DataSpacing,double);
155  vtkGetVector3Macro(DataSpacing,double);
157 
159 
160  vtkSetVector3Macro(DataOrigin,double);
161  vtkGetVector3Macro(DataOrigin,double);
163 
165 
166  unsigned long GetHeaderSize();
167  unsigned long GetHeaderSize(unsigned long slice);
169 
172  virtual void SetHeaderSize(unsigned long size);
173 
175 
185  virtual void SetDataByteOrderToBigEndian();
186  virtual void SetDataByteOrderToLittleEndian();
187  virtual int GetDataByteOrder();
188  virtual void SetDataByteOrder(int);
189  virtual const char *GetDataByteOrderAsString();
191 
193 
195  vtkSetMacro(FileNameSliceOffset,int);
196  vtkGetMacro(FileNameSliceOffset,int);
198 
200 
203  vtkSetMacro(FileNameSliceSpacing,int);
204  vtkGetMacro(FileNameSliceSpacing,int);
206 
207 
209 
210  vtkSetMacro(SwapBytes,int);
211  virtual int GetSwapBytes() {return this->SwapBytes;}
212  vtkBooleanMacro(SwapBytes,int);
214 
215 //BTX
216  ifstream *GetFile() {return this->File;}
217  vtkGetVectorMacro(DataIncrements,unsigned long,4);
218 //ETX
219 
220  virtual int OpenFile();
221  virtual void SeekFile(int i, int j, int k);
222 
224 
226  vtkBooleanMacro(FileLowerLeft, int);
227  vtkGetMacro(FileLowerLeft, int);
228  vtkSetMacro(FileLowerLeft, int);
230 
232 
233  virtual void ComputeInternalFileName(int slice);
234  vtkGetStringMacro(InternalFileName);
236 
238 
244  virtual int CanReadFile(const char* vtkNotUsed(fname))
245  {
246  return 0;
247  }
249 
251 
253  virtual const char* GetFileExtensions()
254  {
255  return 0;
256  }
258 
260 
262  virtual const char* GetDescriptiveName()
263  {
264  return 0;
265  }
266 protected:
267  vtkImageReader2();
268  ~vtkImageReader2();
270 
272 
274  char *FileName;
275  char *FilePrefix;
276  char *FilePattern;
279 
282 
283  ifstream *File;
284  unsigned long DataIncrements[4];
285  int DataExtent[6];
287 
289  unsigned long HeaderSize;
291  unsigned long ManualHeaderSize;
292 
293  double DataSpacing[3];
294  double DataOrigin[3];
295 
298 
299  virtual int RequestInformation(vtkInformation* request,
300  vtkInformationVector** inputVector,
301  vtkInformationVector* outputVector);
302  virtual void ExecuteInformation();
304  virtual void ComputeDataIncrements();
305 private:
306  vtkImageReader2(const vtkImageReader2&); // Not implemented.
307  void operator=(const vtkImageReader2&); // Not implemented.
308 };
309 
310 #endif
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
vtkIdType MemoryBufferLength
virtual void SetDataScalarTypeToUnsignedChar()
a vtkAbstractArray subclass for strings
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation *outInfo)
int vtkIdType
Definition: vtkType.h:275
vtkIdType GetMemoryBufferLength()
#define VTK_DOUBLE
Definition: vtkType.h:36
unsigned long ManualHeaderSize
#define VTK_FLOAT
Definition: vtkType.h:35
virtual int CanReadFile(const char *vtkNotUsed(fname))
virtual void SetDataScalarTypeToChar()
virtual void SetDataScalarTypeToShort()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void SetDataScalarTypeToSignedChar()
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual void SetDataScalarTypeToUnsignedShort()
#define VTK_SHORT
Definition: vtkType.h:29
#define VTK_CHAR
Definition: vtkType.h:26
ifstream * GetFile()
virtual void SetDataScalarTypeToUnsignedInt()
unsigned long HeaderSize
Superclass of binary file readers.
virtual void SetDataScalarTypeToInt()
#define VTK_SIGNED_CHAR
Definition: vtkType.h:27
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
virtual void SetDataScalarTypeToDouble()
virtual void SetDataScalarTypeToFloat()
virtual const char * GetFileExtensions()
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
static vtkAlgorithm * New()
#define VTKIOIMAGE_EXPORT
virtual const char * GetDescriptiveName()
general representation of visualization data
Definition: vtkDataObject.h:64
#define VTK_INT
Definition: vtkType.h:31
vtkStringArray * FileNames
virtual int GetSwapBytes()
virtual void * GetMemoryBuffer()