VTK  9.2.6
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=========================================================================*/
40
41#ifndef vtkImageReader2_h
42#define vtkImageReader2_h
43
44#include "vtkIOImageModule.h" // For export macro
45#include "vtkImageAlgorithm.h"
46
47class vtkStringArray;
48
49#define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
50#define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
51
52class VTKIOIMAGE_EXPORT vtkImageReader2 : public vtkImageAlgorithm
53{
54public:
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
60
64 virtual void SetFileName(VTK_FILEPATH const char*);
67
69
77 vtkGetObjectMacro(FileNames, vtkStringArray);
79
81
88 virtual void SetFilePrefix(VTK_FILEPATH const char*);
91
93
97 virtual void SetFilePattern(VTK_FILEPATH const char*);
100
106 virtual void SetMemoryBuffer(const void*);
107 virtual const void* GetMemoryBuffer() { return this->MemoryBuffer; }
108
112 virtual void SetMemoryBufferLength(vtkIdType buflen);
114
120 virtual void SetDataScalarType(int type);
130
132
135 vtkGetMacro(DataScalarType, int);
137
139
142 vtkSetMacro(NumberOfScalarComponents, int);
143 vtkGetMacro(NumberOfScalarComponents, int);
145
147
150 vtkSetVector6Macro(DataExtent, int);
151 vtkGetVector6Macro(DataExtent, int);
153
155
158 vtkSetMacro(FileDimensionality, int);
161
163
166 vtkSetVector3Macro(DataSpacing, double);
167 vtkGetVector3Macro(DataSpacing, double);
169
171
174 vtkSetVector3Macro(DataOrigin, double);
175 vtkGetVector3Macro(DataOrigin, double);
177
179
182 vtkSetVectorMacro(DataDirection, double, 9);
183 vtkGetVectorMacro(DataDirection, double, 9);
185
187
190 unsigned long GetHeaderSize();
191 unsigned long GetHeaderSize(unsigned long slice);
193
198 virtual void SetHeaderSize(unsigned long size);
199
201
216 virtual int GetDataByteOrder();
217 virtual void SetDataByteOrder(int);
218 virtual const char* GetDataByteOrderAsString();
220
222
226 vtkSetMacro(FileNameSliceOffset, int);
227 vtkGetMacro(FileNameSliceOffset, int);
229
231
236 vtkSetMacro(FileNameSliceSpacing, int);
237 vtkGetMacro(FileNameSliceSpacing, int);
239
241
244 vtkSetMacro(SwapBytes, vtkTypeBool);
245 virtual vtkTypeBool GetSwapBytes() { return this->SwapBytes; }
246 vtkBooleanMacro(SwapBytes, vtkTypeBool);
248
249 istream* GetFile() { return this->File; }
250 vtkGetVectorMacro(DataIncrements, unsigned long, 4);
251
252 virtual int OpenFile();
253 void CloseFile();
254 virtual void SeekFile(int i, int j, int k);
255
257
261 vtkBooleanMacro(FileLowerLeft, vtkTypeBool);
265
267
270 virtual void ComputeInternalFileName(int slice);
273
283 virtual int CanReadFile(VTK_FILEPATH const char* vtkNotUsed(fname)) { return 0; }
284
290 virtual const char* GetFileExtensions() { return nullptr; }
291
293
296 virtual const char* GetDescriptiveName() { return nullptr; }
297
298protected:
302
304
306 char* FileName;
311
312 const void* MemoryBuffer;
314
315 istream* File;
316 unsigned long DataIncrements[4];
319
321 unsigned long HeaderSize;
323 unsigned long ManualHeaderSize;
324
325 double DataSpacing[3];
326 double DataOrigin[3];
327 double DataDirection[9];
328
331
333 vtkInformationVector* outputVector) override;
334 virtual void ExecuteInformation();
336 virtual void ComputeDataIncrements();
337
338private:
339 vtkImageReader2(const vtkImageReader2&) = delete;
340 void operator=(const vtkImageReader2&) = delete;
341};
342
343#endif
general representation of visualization data
unsigned long DataIncrements[4]
virtual void ComputeDataIncrements()
vtkGetFilePathMacro(FilePrefix)
Specify file prefix for the image file or files.
vtkTypeBool FileLowerLeft
istream * GetFile()
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
virtual const void * GetMemoryBuffer()
unsigned long GetHeaderSize()
Get the size of the header computed by this object.
virtual int GetDataByteOrder()
These methods should be used instead of the SwapBytes methods.
vtkGetFilePathMacro(InternalFileName)
Set/Get the internal file name.
virtual int OpenFile()
unsigned long GetHeaderSize(unsigned long slice)
Get the size of the header computed by this object.
virtual void SetMemoryBufferLength(vtkIdType buflen)
Specify the in memory image buffer length.
int GetFileDimensionality()
The number of dimensions stored in a file.
vtkTypeBool SwapBytes
virtual void SetMemoryBuffer(const void *)
Specify the in memory image buffer.
virtual void SetDataScalarTypeToSignedChar()
virtual const char * GetDataByteOrderAsString()
These methods should be used instead of the SwapBytes methods.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
virtual void SetFileName(VTK_FILEPATH const char *)
Specify file name for the image file.
virtual int CanReadFile(VTK_FILEPATH const char *vtkNotUsed(fname))
Return non zero if the reader can read the given file name.
virtual void ComputeInternalFileName(int slice)
Set/Get the internal file name.
virtual void SetDataScalarType(int type)
Set the data type of pixels in the file.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetDataScalarTypeToInt()
virtual const char * GetFileExtensions()
Get the file extensions for this format.
vtkGetFilePathMacro(FilePattern)
The snprintf-style format string used to build filename from FilePrefix and slice number.
virtual void SetDataScalarTypeToDouble()
virtual const char * GetDescriptiveName()
Return a descriptive name for the file format that might be useful in a GUI.
vtkGetFilePathMacro(FileName)
Specify file name for the image file.
~vtkImageReader2() override
Return a descriptive name for the file format that might be useful in a GUI.
virtual void SetDataScalarTypeToChar()
unsigned long HeaderSize
vtkImageReader2()
Return a descriptive name for the file format that might be useful in a GUI.
virtual void SetDataByteOrderToLittleEndian()
These methods should be used instead of the SwapBytes methods.
vtkIdType MemoryBufferLength
virtual void SetHeaderSize(unsigned long size)
If there is a tail on the file, you want to explicitly set the header size.
virtual void SetDataScalarTypeToUnsignedChar()
const void * MemoryBuffer
virtual void SetDataByteOrder(int)
These methods should be used instead of the SwapBytes methods.
double DataDirection[9]
static vtkImageReader2 * New()
virtual void SetDataByteOrderToBigEndian()
These methods should be used instead of the SwapBytes methods.
unsigned long ManualHeaderSize
virtual void SetFilePrefix(VTK_FILEPATH const char *)
Specify file prefix for the image file or files.
virtual void SetDataScalarTypeToFloat()
virtual void SetDataScalarTypeToShort()
virtual void SeekFile(int i, int j, int k)
virtual void SetFileNames(vtkStringArray *)
Specify a list of file names.
virtual void SetDataScalarTypeToUnsignedShort()
vtkStringArray * FileNames
vtkIdType GetMemoryBufferLength()
virtual void SetDataScalarTypeToUnsignedInt()
virtual void ExecuteInformation()
virtual void SetFilePattern(VTK_FILEPATH const char *)
The snprintf-style format string used to build filename from FilePrefix and slice number.
virtual vtkTypeBool GetSwapBytes()
Set/Get the byte swapping to explicitly swap the bytes of a file.
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_SHORT
Definition vtkType.h:48
int vtkIdType
Definition vtkType.h:332
#define VTK_UNSIGNED_INT
Definition vtkType.h:51
#define VTK_DOUBLE
Definition vtkType.h:55
#define VTK_UNSIGNED_CHAR
Definition vtkType.h:47
#define VTK_UNSIGNED_SHORT
Definition vtkType.h:49
#define VTK_INT
Definition vtkType.h:50
#define VTK_SIGNED_CHAR
Definition vtkType.h:46
#define VTK_FLOAT
Definition vtkType.h:54
#define VTK_CHAR
Definition vtkType.h:45
#define VTK_FILEPATH