VTK  9.3.20240328
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
66 #ifndef vtkImageWriter_h
67 #define vtkImageWriter_h
68 
69 #include "vtkIOImageModule.h" // For export macro
70 #include "vtkImageAlgorithm.h"
71 
72 VTK_ABI_NAMESPACE_BEGIN
73 class VTKIOIMAGE_EXPORT vtkImageWriter : public vtkImageAlgorithm
74 {
75 public:
76  static vtkImageWriter* New();
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
89 
91 
96  vtkSetFilePathMacro(FilePrefix);
97  vtkGetFilePathMacro(FilePrefix);
99 
101 
104  vtkSetFilePathMacro(FilePattern);
105  vtkGetFilePathMacro(FilePattern);
107 
109 
114  vtkSetMacro(FileDimensionality, int);
115  vtkGetMacro(FileDimensionality, int);
117 
122 
126  virtual void Write();
127 
128  void DeleteFiles();
129 
130 protected:
132  ~vtkImageWriter() override;
133 
135  char* FilePrefix;
136  char* FilePattern;
137  char* FileName;
142 
143  virtual void RecursiveWrite(int dim, vtkImageData* region, vtkInformation* inInfo, ostream* file);
144  virtual void RecursiveWrite(
145  int dim, vtkImageData* cache, vtkImageData* data, vtkInformation* inInfo, ostream* file);
146  virtual void WriteFile(ostream* file, vtkImageData* data, int extent[6], int wExtent[6]);
147  virtual void WriteFileHeader(ostream*, vtkImageData*, int[6]) {}
148  virtual void WriteFileTrailer(ostream*, vtkImageData*) {}
149 
150  // Required for subclasses that need to prevent the writer
151  // from touching the file system. The getter/setter are only
152  // available in these subclasses.
154 
155  // subclasses that do write to memory can override this
156  // to implement the simple case
157  virtual void MemoryWrite(int, vtkImageData*, int[6], vtkInformation*) {}
158 
159  // This is called by the superclass.
160  // This is the method you should override.
161  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
162  vtkInformationVector* outputVector) override;
163 
167 
168 private:
169  vtkImageWriter(const vtkImageWriter&) = delete;
170  void operator=(const vtkImageWriter&) = delete;
171 };
172 
173 VTK_ABI_NAMESPACE_END
174 #endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
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:108
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