VTK  9.1.20211230
vtkImageWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageWriter.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 =========================================================================*/
55 #ifndef vtkImageWriter_h
56 #define vtkImageWriter_h
57 
58 #include "vtkIOImageModule.h" // For export macro
59 #include "vtkImageAlgorithm.h"
60 
61 class VTKIOIMAGE_EXPORT vtkImageWriter : public vtkImageAlgorithm
62 {
63 public:
64  static vtkImageWriter* New();
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
77 
79 
84  vtkSetFilePathMacro(FilePrefix);
85  vtkGetFilePathMacro(FilePrefix);
87 
89 
92  vtkSetFilePathMacro(FilePattern);
93  vtkGetFilePathMacro(FilePattern);
95 
97 
102  vtkSetMacro(FileDimensionality, int);
103  vtkGetMacro(FileDimensionality, int);
105 
110 
114  virtual void Write();
115 
116  void DeleteFiles();
117 
118 protected:
120  ~vtkImageWriter() override;
121 
123  char* FilePrefix;
124  char* FilePattern;
125  char* FileName;
130 
131  virtual void RecursiveWrite(int dim, vtkImageData* region, vtkInformation* inInfo, ostream* file);
132  virtual void RecursiveWrite(
133  int dim, vtkImageData* cache, vtkImageData* data, vtkInformation* inInfo, ostream* file);
134  virtual void WriteFile(ostream* file, vtkImageData* data, int extent[6], int wExtent[6]);
135  virtual void WriteFileHeader(ostream*, vtkImageData*, int[6]) {}
136  virtual void WriteFileTrailer(ostream*, vtkImageData*) {}
137 
138  // Required for subclasses that need to prevent the writer
139  // from touching the file system. The getter/setter are only
140  // available in these subclasses.
142 
143  // subclasses that do write to memory can override this
144  // to implement the simple case
145  virtual void MemoryWrite(int, vtkImageData*, int[6], vtkInformation*) {}
146 
147  // This is called by the superclass.
148  // This is the method you should override.
149  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
150  vtkInformationVector* outputVector) override;
151 
155 
156 private:
157  vtkImageWriter(const vtkImageWriter&) = delete;
158  void operator=(const vtkImageWriter&) = delete;
159 };
160 
161 #endif
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
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:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ extent
Definition: vtkX3D.h:351
@ data
Definition: vtkX3D.h:321
unsigned int vtkTypeUBool
Definition: vtkABI.h:70