VTK
vtkImageExport.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageExport.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 =========================================================================*/
35 #ifndef vtkImageExport_h
36 #define vtkImageExport_h
37 
38 #include "vtkIOImageModule.h" // For export macro
39 #include "vtkImageAlgorithm.h"
40 
41 class VTKIOIMAGE_EXPORT vtkImageExport : public vtkImageAlgorithm
42 {
43 public:
44  static vtkImageExport *New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  vtkIdType GetDataMemorySize();
52 
54 
58  void GetDataDimensions(int *ptr);
60  this->GetDataDimensions(this->DataDimensions);
61  return this->DataDimensions; }
63 
69  int GetDataNumberOfScalarComponents();
70 
75  int GetDataScalarType();
76  const char *GetDataScalarTypeAsString() {
77  return vtkImageScalarTypeNameMacro(this->GetDataScalarType()); }
78 
80 
83  int *GetDataExtent() VTK_SIZEHINT(6);
84  void GetDataExtent(int *ptr);
85  double *GetDataSpacing() VTK_SIZEHINT(3);
86  void GetDataSpacing(double *ptr);
87  double *GetDataOrigin() VTK_SIZEHINT(3);
88  void GetDataOrigin(double *ptr);
90 
95 
97 
105  vtkBooleanMacro(ImageLowerLeft, vtkTypeBool);
106  vtkGetMacro(ImageLowerLeft, vtkTypeBool);
107  vtkSetMacro(ImageLowerLeft, vtkTypeBool);
109 
111 
116  void SetExportVoidPointer(void *);
117  void *GetExportVoidPointer() { return this->ExportVoidPointer; };
119 
121 
126  void Export() { this->Export(this->ExportVoidPointer); };
127  virtual void Export(void *);
129 
137  void *GetPointerToData();
138 
142  void* GetCallbackUserData();
143 
145 
149  typedef void (*UpdateInformationCallbackType)(void*);
150  typedef int (*PipelineModifiedCallbackType)(void*);
151  typedef int* (*WholeExtentCallbackType)(void*);
152  typedef double* (*SpacingCallbackType)(void*);
153  typedef double* (*OriginCallbackType)(void*);
154  typedef const char* (*ScalarTypeCallbackType)(void*);
155  typedef int (*NumberOfComponentsCallbackType)(void*);
156  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
157  typedef void (*UpdateDataCallbackType)(void*);
158  typedef int* (*DataExtentCallbackType)(void*);
159  typedef void* (*BufferPointerCallbackType)(void*);
161 
163 
166  UpdateInformationCallbackType GetUpdateInformationCallback() const;
167  PipelineModifiedCallbackType GetPipelineModifiedCallback() const;
168  WholeExtentCallbackType GetWholeExtentCallback() const;
169  SpacingCallbackType GetSpacingCallback() const;
170  OriginCallbackType GetOriginCallback() const;
171  ScalarTypeCallbackType GetScalarTypeCallback() const;
172  NumberOfComponentsCallbackType GetNumberOfComponentsCallback() const;
173  PropagateUpdateExtentCallbackType GetPropagateUpdateExtentCallback() const;
174  UpdateDataCallbackType GetUpdateDataCallback() const;
175  DataExtentCallbackType GetDataExtentCallback() const;
176  BufferPointerCallbackType GetBufferPointerCallback() const;
178 
179 protected:
180  vtkImageExport();
181  ~vtkImageExport() override;
182 
183  // This is called by the superclass.
184  int RequestData(vtkInformation *request,
185  vtkInformationVector** inputVector,
186  vtkInformationVector* outputVector) override;
187 
188  virtual void UpdateInformationCallback();
189  virtual int PipelineModifiedCallback();
190  virtual void UpdateDataCallback();
191  virtual int* WholeExtentCallback();
192  virtual double* SpacingCallback();
193  virtual double* OriginCallback();
194  virtual const char* ScalarTypeCallback();
195  virtual int NumberOfComponentsCallback();
196  virtual void PropagateUpdateExtentCallback(int*);
197  virtual int* DataExtentCallback();
198  virtual void* BufferPointerCallback();
199 
201  int DataDimensions[3];
203 
205 
206 private:
207  vtkImageExport(const vtkImageExport&) = delete;
208  void operator=(const vtkImageExport&) = delete;
209 
210  static void UpdateInformationCallbackFunction(void*);
211  static int PipelineModifiedCallbackFunction(void*);
212  static int* WholeExtentCallbackFunction(void*);
213  static double* SpacingCallbackFunction(void*);
214  static double* OriginCallbackFunction(void*);
215  static const char* ScalarTypeCallbackFunction(void*);
216  static int NumberOfComponentsCallbackFunction(void*);
217  static void PropagateUpdateExtentCallbackFunction(void*, int*);
218  static void UpdateDataCallbackFunction(void*);
219  static int* DataExtentCallbackFunction(void*);
220  static void* BufferPointerCallbackFunction(void*);
221 
224 };
225 
226 #endif
227 
228 
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkAlgorithm * GetInputAlgorithm()
Equivalent to GetInputAlgorithm(0, 0).
Definition: vtkAlgorithm.h:492
vtkInformation * GetInputInformation()
Equivalent to GetInputInformation(0, 0)
Definition: vtkAlgorithm.h:524
vtkDataObject * GetInput()
Get a data object for one of the input port connections.
vtkTypeBool ImageLowerLeft
int vtkIdType
Definition: vtkType.h:347
Export VTK images to third-party systems.
int vtkTypeBool
Definition: vtkABI.h:69
int * GetDataDimensions()
Get the (x,y,z) index dimensions of the data.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:59
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void Export()
The main interface: update the pipeline and export the image to the memory pointed to by SetExportVoi...
const char * GetDataScalarTypeAsString()
#define VTK_SIZEHINT(...)
void * GetExportVoidPointer()
Set the void pointer of the C array to export the data to.
vtkMTimeType LastPipelineMTime
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.
void * ExportVoidPointer