VTK
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 =========================================================================*/
29 #ifndef vtkImageWriter_h
30 #define vtkImageWriter_h
31 
32 #include "vtkIOImageModule.h" // For export macro
33 #include "vtkImageAlgorithm.h"
34 
35 class VTKIOIMAGE_EXPORT vtkImageWriter : public vtkImageAlgorithm
36 {
37 public:
38  static vtkImageWriter *New();
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
48  vtkSetStringMacro(FileName);
49  vtkGetStringMacro(FileName);
51 
53 
58  vtkSetStringMacro(FilePrefix);
59  vtkGetStringMacro(FilePrefix);
61 
63 
66  vtkSetStringMacro(FilePattern);
67  vtkGetStringMacro(FilePattern);
69 
71 
76  vtkSetMacro(FileDimensionality, int);
77  vtkGetMacro(FileDimensionality, int);
79 
84 
88  virtual void Write();
89 
90  void DeleteFiles();
91 
92 protected:
94  ~vtkImageWriter() override;
95 
97  char *FilePrefix;
98  char *FilePattern;
99  char *FileName;
104 
105  virtual void RecursiveWrite(int dim,
106  vtkImageData *region,
107  vtkInformation*inInfo,
108  ostream *file);
109  virtual void RecursiveWrite(int dim,
110  vtkImageData *cache,
112  vtkInformation* inInfo,
113  ostream *file);
114  virtual void WriteFile(ostream *file, vtkImageData *data,
115  int extent[6], int wExtent[6]);
116  virtual void WriteFileHeader(ostream *, vtkImageData *, int [6]) {}
117  virtual void WriteFileTrailer(ostream *, vtkImageData *) {}
118 
119 
120  // Required for subclasses that need to prevent the writer
121  // from touching the file system. The getter/setter are only
122  // available in these subclasses.
124 
125  // subclasses that do write to memory can override this
126  // to implement the simple case
127  virtual void MemoryWrite(int,
128  vtkImageData *,
129  int [6],
130  vtkInformation*) {};
131 
132  // This is called by the superclass.
133  // This is the method you should override.
134  int RequestData(vtkInformation *request,
135  vtkInformationVector** inputVector,
136  vtkInformationVector* outputVector) override;
137 
141 
142 private:
143  vtkImageWriter(const vtkImageWriter&) = delete;
144  void operator=(const vtkImageWriter&) = delete;
145 };
146 
147 #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:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
unsigned int vtkTypeUBool
Definition: vtkABI.h:70
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