VTK  9.3.0
vtkImageWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
26 #ifndef vtkImageWriter_h
27 #define vtkImageWriter_h
28 
29 #include "vtkIOImageModule.h" // For export macro
30 #include "vtkImageAlgorithm.h"
31 
32 VTK_ABI_NAMESPACE_BEGIN
33 class VTKIOIMAGE_EXPORT vtkImageWriter : public vtkImageAlgorithm
34 {
35 public:
36  static vtkImageWriter* New();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
49 
51 
56  vtkSetFilePathMacro(FilePrefix);
57  vtkGetFilePathMacro(FilePrefix);
59 
61 
64  vtkSetFilePathMacro(FilePattern);
65  vtkGetFilePathMacro(FilePattern);
67 
69 
74  vtkSetMacro(FileDimensionality, int);
75  vtkGetMacro(FileDimensionality, int);
77 
82 
86  virtual void Write();
87 
88  void DeleteFiles();
89 
90 protected:
92  ~vtkImageWriter() override;
93 
95  char* FilePrefix;
96  char* FilePattern;
97  char* FileName;
102 
103  virtual void RecursiveWrite(int dim, vtkImageData* region, vtkInformation* inInfo, ostream* file);
104  virtual void RecursiveWrite(
105  int dim, vtkImageData* cache, vtkImageData* data, vtkInformation* inInfo, ostream* file);
106  virtual void WriteFile(ostream* file, vtkImageData* data, int extent[6], int wExtent[6]);
107  virtual void WriteFileHeader(ostream*, vtkImageData*, int[6]) {}
108  virtual void WriteFileTrailer(ostream*, vtkImageData*) {}
109 
110  // Required for subclasses that need to prevent the writer
111  // from touching the file system. The getter/setter are only
112  // available in these subclasses.
114 
115  // subclasses that do write to memory can override this
116  // to implement the simple case
117  virtual void MemoryWrite(int, vtkImageData*, int[6], vtkInformation*) {}
118 
119  // This is called by the superclass.
120  // This is the method you should override.
121  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
122  vtkInformationVector* outputVector) override;
123 
127 
128 private:
129  vtkImageWriter(const vtkImageWriter&) = delete;
130  void operator=(const vtkImageWriter&) = delete;
131 };
132 
133 VTK_ABI_NAMESPACE_END
134 #endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
Writes images to files.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
char * InternalFileName
vtkGetFilePathMacro(FilePrefix)
Specify file prefix for the image file(s).You should specify either a FileName or FilePrefix.
vtkGetFilePathMacro(FilePattern)
The snprintf format used to build filename from FilePrefix and number.
static vtkImageWriter * New()
size_t InternalFileNameSize
virtual void MemoryWrite(int, vtkImageData *, int[6], vtkInformation *)
virtual void RecursiveWrite(int dim, vtkImageData *region, vtkInformation *inInfo, ostream *file)
vtkGetFilePathMacro(FileName)
Specify file name for the image file.
virtual void WriteFileHeader(ostream *, vtkImageData *, int[6])
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called in response to a REQUEST_DATA request from the executive.
virtual void Write()
The main interface which triggers the writer to start.
vtkSetFilePathMacro(FilePrefix)
Specify file prefix for the image file(s).You should specify either a FileName or FilePrefix.
vtkTypeUBool WriteToMemory
void DeleteFiles()
vtkSetFilePathMacro(FilePattern)
The snprintf format used to build filename from FilePrefix and number.
~vtkImageWriter() override
virtual void RecursiveWrite(int dim, vtkImageData *cache, vtkImageData *data, vtkInformation *inInfo, ostream *file)
virtual void WriteFileTrailer(ostream *, vtkImageData *)
vtkImageData * GetInput()
Set/Get the input object from the image pipeline.
vtkSetFilePathMacro(FileName)
Specify file name for the image file.
virtual void WriteFile(ostream *file, vtkImageData *data, int extent[6], int wExtent[6])
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ extent
Definition: vtkX3D.h:345
@ data
Definition: vtkX3D.h:315
unsigned int vtkTypeUBool
Definition: vtkABI.h:65