VTK  9.3.1
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
17 #ifndef vtkImageWriter_h
18 #define vtkImageWriter_h
19 
20 #include "vtkIOImageModule.h" // For export macro
21 #include "vtkImageAlgorithm.h"
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class VTKIOIMAGE_EXPORT vtkImageWriter : public vtkImageAlgorithm
25 {
26 public:
27  static vtkImageWriter* New();
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
32 
37  vtkSetFilePathMacro(FileName);
38  vtkGetFilePathMacro(FileName);
40 
42 
47  vtkSetFilePathMacro(FilePrefix);
48  vtkGetFilePathMacro(FilePrefix);
50 
52 
55  vtkSetFilePathMacro(FilePattern);
56  vtkGetFilePathMacro(FilePattern);
58 
60 
65  vtkSetMacro(FileDimensionality, int);
66  vtkGetMacro(FileDimensionality, int);
68 
73 
77  virtual void Write();
78 
79  void DeleteFiles();
80 
81 protected:
83  ~vtkImageWriter() override;
84 
86  char* FilePrefix;
87  char* FilePattern;
88  char* FileName;
93 
94  virtual void RecursiveWrite(int dim, vtkImageData* region, vtkInformation* inInfo, ostream* file);
95  virtual void RecursiveWrite(
96  int dim, vtkImageData* cache, vtkImageData* data, vtkInformation* inInfo, ostream* file);
97  virtual void WriteFile(ostream* file, vtkImageData* data, int extent[6], int wExtent[6]);
98  virtual void WriteFileHeader(ostream*, vtkImageData*, int[6]) {}
99  virtual void WriteFileTrailer(ostream*, vtkImageData*) {}
100 
101  // Required for subclasses that need to prevent the writer
102  // from touching the file system. The getter/setter are only
103  // available in these subclasses.
105 
106  // subclasses that do write to memory can override this
107  // to implement the simple case
108  virtual void MemoryWrite(int, vtkImageData*, int[6], vtkInformation*) {}
109 
110  // This is called by the superclass.
111  // This is the method you should override.
112  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
113  vtkInformationVector* outputVector) override;
114 
118 
119 private:
120  vtkImageWriter(const vtkImageWriter&) = delete;
121  void operator=(const vtkImageWriter&) = delete;
122 };
123 
124 VTK_ABI_NAMESPACE_END
125 #endif
Store vtkAlgorithm input/output information.
vtkDataObject * GetInput()
Get a data object for one of the input port connections.
virtual void WriteFileHeader(ostream *, vtkImageData *, int[6])
vtkTypeUBool WriteToMemory
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
unsigned int vtkTypeUBool
Definition: vtkABI.h:65
Writes images to files.
virtual void MemoryWrite(int, vtkImageData *, int[6], vtkInformation *)
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.
char * InternalFileName
virtual void WriteFileTrailer(ostream *, vtkImageData *)
size_t InternalFileNameSize