vtk-dicom  0.8.17
vtkImageReader2.h
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 =========================================================================*/
41 #ifndef vtkImageReader2_h
42 #define vtkImageReader2_h
43 
44 #include "vtkIOImageModule.h" // For export macro
45 #include "vtkImageAlgorithm.h"
46 
47 class vtkStringArray;
48 
49 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
50 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
51 
52 class VTKIOIMAGE_EXPORT vtkImageReader2 : public vtkImageAlgorithm
53 {
54 public:
55  static vtkImageReader2 *New();
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
60 
64  virtual void SetFileName(const char *);
65  vtkGetStringMacro(FileName);
67 
69 
76  virtual void SetFileNames(vtkStringArray *);
77  vtkGetObjectMacro(FileNames, vtkStringArray);
79 
81 
88  virtual void SetFilePrefix(const char *);
89  vtkGetStringMacro(FilePrefix);
91 
93 
97  virtual void SetFilePattern(const char *);
98  vtkGetStringMacro(FilePattern);
100 
106  virtual void SetMemoryBuffer(void *);
107  virtual void *GetMemoryBuffer() { return this->MemoryBuffer; }
108 
112  virtual void SetMemoryBufferLength(vtkIdType buflen);
113  vtkIdType GetMemoryBufferLength() { return this->MemoryBufferLength; }
114 
120  virtual void SetDataScalarType(int type);
121  virtual void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
122  virtual void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
123  virtual void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
124  virtual void SetDataScalarTypeToUnsignedInt(){this->SetDataScalarType(VTK_UNSIGNED_INT);}
125  virtual void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
126  virtual void SetDataScalarTypeToUnsignedShort()
127  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
128  virtual void SetDataScalarTypeToChar()
129  {this->SetDataScalarType(VTK_CHAR);}
130  virtual void SetDataScalarTypeToSignedChar()
131  {this->SetDataScalarType(VTK_SIGNED_CHAR);}
132  virtual void SetDataScalarTypeToUnsignedChar()
133  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
134 
136 
139  vtkGetMacro(DataScalarType, int);
141 
143 
146  vtkSetMacro(NumberOfScalarComponents,int);
147  vtkGetMacro(NumberOfScalarComponents,int);
149 
151 
154  vtkSetVector6Macro(DataExtent,int);
155  vtkGetVector6Macro(DataExtent,int);
157 
159 
162  vtkSetMacro(FileDimensionality, int);
163  int GetFileDimensionality() {return this->FileDimensionality;}
165 
167 
170  vtkSetVector3Macro(DataSpacing,double);
171  vtkGetVector3Macro(DataSpacing,double);
173 
175 
178  vtkSetVector3Macro(DataOrigin,double);
179  vtkGetVector3Macro(DataOrigin,double);
181 
183 
186  unsigned long GetHeaderSize();
187  unsigned long GetHeaderSize(unsigned long slice);
189 
194  virtual void SetHeaderSize(unsigned long size);
195 
197 
211  virtual void SetDataByteOrderToLittleEndian();
212  virtual int GetDataByteOrder();
213  virtual void SetDataByteOrder(int);
214  virtual const char *GetDataByteOrderAsString();
216 
218 
222  vtkSetMacro(FileNameSliceOffset,int);
223  vtkGetMacro(FileNameSliceOffset,int);
225 
227 
232  vtkSetMacro(FileNameSliceSpacing,int);
233  vtkGetMacro(FileNameSliceSpacing,int);
235 
236 
238 
241  vtkSetMacro(SwapBytes,int);
242  virtual int GetSwapBytes() {return this->SwapBytes;}
243  vtkBooleanMacro(SwapBytes,int);
245 
246  ifstream *GetFile() {return this->File;}
247  vtkGetVectorMacro(DataIncrements,unsigned long,4);
248 
249  virtual int OpenFile();
250  virtual void SeekFile(int i, int j, int k);
251 
253 
257  vtkBooleanMacro(FileLowerLeft, int);
258  vtkGetMacro(FileLowerLeft, int);
259  vtkSetMacro(FileLowerLeft, int);
261 
263 
266  virtual void ComputeInternalFileName(int slice);
267  vtkGetStringMacro(InternalFileName);
269 
279  virtual int CanReadFile(const char* vtkNotUsed(fname))
280  {
281  return 0;
282  }
283 
289  virtual const char* GetFileExtensions()
290  {
291  return 0;
292  }
293 
295 
298  virtual const char* GetDescriptiveName()
299  {
300  return 0;
301  }
302 protected:
303  vtkImageReader2();
304  ~vtkImageReader2();
306 
307  vtkStringArray *FileNames;
308 
309  char *InternalFileName;
310  char *FileName;
311  char *FilePrefix;
312  char *FilePattern;
313  int NumberOfScalarComponents;
314  int FileLowerLeft;
315 
316  void *MemoryBuffer;
317  vtkIdType MemoryBufferLength;
318 
319  ifstream *File;
320  unsigned long DataIncrements[4];
321  int DataExtent[6];
322  int SwapBytes;
323 
324  int FileDimensionality;
325  unsigned long HeaderSize;
326  int DataScalarType;
327  unsigned long ManualHeaderSize;
328 
329  double DataSpacing[3];
330  double DataOrigin[3];
331 
332  int FileNameSliceOffset;
333  int FileNameSliceSpacing;
334 
335  virtual int RequestInformation(vtkInformation* request,
336  vtkInformationVector** inputVector,
337  vtkInformationVector* outputVector);
338  virtual void ExecuteInformation();
339  virtual void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo);
340  virtual void ComputeDataIncrements();
341 private:
342  vtkImageReader2(const vtkImageReader2&) VTK_DELETE_FUNCTION;
343  void operator=(const vtkImageReader2&) VTK_DELETE_FUNCTION;
344 };
345 
346 #endif
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:38
Superclass of binary file readers.
Definition: vtkImageReader2.h:53
virtual int CanReadFile(const char *vtkNotUsed(fname))
Definition: vtkImageReader2.h:279
unsigned long GetHeaderSize()
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual void SetFilePrefix(const char *)
virtual void SetMemoryBufferLength(vtkIdType buflen)
virtual const char * GetFileExtensions()
Definition: vtkImageReader2.h:289
virtual void SetMemoryBuffer(void *)
virtual void ComputeInternalFileName(int slice)
virtual void SetDataScalarType(int type)
virtual void SetFileName(const char *)
void PrintSelf(ostream &os, vtkIndent indent)
virtual void SetHeaderSize(unsigned long size)
virtual void SetFilePattern(const char *)
virtual void SetDataByteOrderToBigEndian()
virtual void SetFileNames(vtkStringArray *)
virtual void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo)
virtual const char * GetDescriptiveName()
Definition: vtkImageReader2.h:298