VTK  9.7.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  virtual void SetFilePattern(VTK_FILEPATH const char*);
56  vtkGetFilePathMacro(FilePattern);
58 
60 
65  vtkSetMacro(FileDimensionality, int);
66  vtkGetMacro(FileDimensionality, int);
68 
73 
78  virtual void Write();
79 
80  void DeleteFiles();
81 
82 protected:
84  ~vtkImageWriter() override;
85 
87  char* FilePrefix;
88  char* FilePattern;
89  char* FileName;
94 
95  virtual void RecursiveWrite(int dim, vtkImageData* region, vtkInformation* inInfo, ostream* file);
96  virtual void RecursiveWrite(
97  int dim, vtkImageData* cache, vtkImageData* data, vtkInformation* inInfo, ostream* file);
98  virtual void WriteFile(ostream* file, vtkImageData* data, VTK_FUTURE_CONST int extent[6],
99  VTK_FUTURE_CONST int wExtent[6]);
100  virtual void WriteFileHeader(ostream*, vtkImageData*, VTK_FUTURE_CONST int[6]) {}
101  virtual void WriteFileTrailer(ostream*, vtkImageData*) {}
102 
103  // Required for subclasses that need to prevent the writer
104  // from touching the file system. The getter/setter are only
105  // available in these subclasses.
107 
108  // subclasses that do write to memory can override this
109  // to implement the simple case
110  virtual void MemoryWrite(int, vtkImageData*, VTK_FUTURE_CONST int[6], vtkInformation*) {}
111 
112  // This is called by the superclass.
113  // This is the method you should override.
114  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
115  vtkInformationVector* outputVector) override;
116 
120 
121 private:
122  vtkImageWriter(const vtkImageWriter&) = delete;
123  void operator=(const vtkImageWriter&) = delete;
124 };
125 
126 VTK_ABI_NAMESPACE_END
127 #endif
Store vtkAlgorithm input/output information.
#define VTK_UNBLOCKTHREADS
vtkDataObject * GetInput()
Get a data object for one of the input port connections.
vtkTypeUBool WriteToMemory
virtual void MemoryWrite(int, vtkImageData *, VTK_FUTURE_CONST int[6], vtkInformation *)
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
unsigned int vtkTypeUBool
Definition: vtkABI.h:65
Writes images to files.
#define VTK_FILEPATH
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
virtual void WriteFileHeader(ostream *, vtkImageData *, VTK_FUTURE_CONST int[6])
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