VTK  9.3.20240419
vtkImageImport.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
42 #ifndef vtkImageImport_h
43 #define vtkImageImport_h
44 
45 #include "vtkIOImageModule.h" // For export macro
46 #include "vtkImageAlgorithm.h"
47 
48 VTK_ABI_NAMESPACE_BEGIN
49 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
50 {
51 public:
52  static vtkImageImport* New();
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
62 
64 
70  void SetImportVoidPointer(void* ptr);
71  void* GetImportVoidPointer() { return this->ImportVoidPointer; }
73 
81  void SetImportVoidPointer(void* ptr, int save);
82 
84 
88  vtkSetMacro(DataScalarType, int);
89  void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
90  void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
91  void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
92  void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
93  void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
94  void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
95  vtkGetMacro(DataScalarType, int);
97  {
98  return vtkImageScalarTypeNameMacro(this->DataScalarType);
99  }
101 
103 
107  vtkSetMacro(NumberOfScalarComponents, int);
108  vtkGetMacro(NumberOfScalarComponents, int);
110 
112 
118  vtkSetVector6Macro(DataExtent, int);
119  vtkGetVector6Macro(DataExtent, int);
120  void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
122 
124 
128  vtkSetVector3Macro(DataSpacing, double);
129  vtkGetVector3Macro(DataSpacing, double);
131 
133 
137  vtkSetVector3Macro(DataOrigin, double);
138  vtkGetVector3Macro(DataOrigin, double);
140 
142 
147  vtkSetVectorMacro(DataDirection, double, 9);
148  vtkGetVectorMacro(DataDirection, double, 9);
150 
152 
157  vtkSetVector6Macro(WholeExtent, int);
158  vtkGetVector6Macro(WholeExtent, int);
160 
165  vtkInformationVector* outputVector) override;
170  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
171 
173 
177  vtkSetStringMacro(ScalarArrayName);
178  vtkGetStringMacro(ScalarArrayName);
180 
182 
186  typedef void (*UpdateInformationCallbackType)(void*);
187  typedef int (*PipelineModifiedCallbackType)(void*);
188  typedef int* (*WholeExtentCallbackType)(void*);
189  typedef double* (*SpacingCallbackType)(void*);
190  typedef double* (*OriginCallbackType)(void*);
191  typedef double* (*DirectionCallbackType)(void*);
192  typedef const char* (*ScalarTypeCallbackType)(void*);
193  typedef int (*NumberOfComponentsCallbackType)(void*);
194  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
195  typedef void (*UpdateDataCallbackType)(void*);
196  typedef int* (*DataExtentCallbackType)(void*);
197  typedef void* (*BufferPointerCallbackType)(void*);
199 
201 
206  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
207  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
209 
211 
217  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
218  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
220 
222 
228  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
229  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
231 
233 
238  vtkSetMacro(SpacingCallback, SpacingCallbackType);
239  vtkGetMacro(SpacingCallback, SpacingCallbackType);
241 
243 
248  vtkSetMacro(OriginCallback, OriginCallbackType);
249  vtkGetMacro(OriginCallback, OriginCallbackType);
251 
253 
258  vtkSetMacro(DirectionCallback, DirectionCallbackType);
259  vtkGetMacro(DirectionCallback, DirectionCallbackType);
261 
263 
268  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
269  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
271 
273 
278  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
279  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
281 
283 
290  vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
291  vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
293 
295 
300  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
301  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
303 
305 
312  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
313  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
315 
317 
323  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
324  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
326 
328 
332  vtkSetMacro(CallbackUserData, void*);
333  vtkGetMacro(CallbackUserData, void*);
335 
337 
346 
347 protected:
349  ~vtkImageImport() override;
350 
352 
355 
358 
359  int WholeExtent[6];
360  int DataExtent[6];
361  double DataSpacing[3];
362  double DataOrigin[3];
363  double DataDirection[9];
364 
367 
368  UpdateInformationCallbackType UpdateInformationCallback;
369  PipelineModifiedCallbackType PipelineModifiedCallback;
370  WholeExtentCallbackType WholeExtentCallback;
371  SpacingCallbackType SpacingCallback;
372  OriginCallbackType OriginCallback;
373  DirectionCallbackType DirectionCallback;
374  ScalarTypeCallbackType ScalarTypeCallback;
375  NumberOfComponentsCallbackType NumberOfComponentsCallback;
376  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
377  UpdateDataCallbackType UpdateDataCallback;
378  DataExtentCallbackType DataExtentCallback;
379  BufferPointerCallbackType BufferPointerCallback;
380 
382 
383 private:
384  vtkImageImport(const vtkImageImport&) = delete;
385  void operator=(const vtkImageImport&) = delete;
386 };
387 
388 VTK_ABI_NAMESPACE_END
389 #endif
general representation of visualization data
Generic algorithm superclass for image algs.
Import data from a C array.
void SetDataExtentToWholeExtent()
Get/Set the extent of the data buffer.
void * CallbackUserData
static vtkImageImport * New()
int NumberOfScalarComponents
void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
void SetImportVoidPointer(void *ptr, int save)
Set the pointer from which the image data is imported.
~vtkImageImport() override
NumberOfComponentsCallbackType NumberOfComponentsCallback
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Propagates the update extent through the callback if it is set.
UpdateDataCallbackType UpdateDataCallback
void SetImportVoidPointer(void *ptr)
Set the pointer from which the image data is imported.
void SetDataScalarTypeToUnsignedShort()
Set/Get the data type of pixels in the imported data.
char * ScalarArrayName
void InvokeExecuteDataCallbacks()
Invoke the appropriate callbacks.
void InvokeUpdateInformationCallbacks()
Invoke the appropriate callbacks.
void SetDataScalarTypeToDouble()
Set/Get the data type of pixels in the imported data.
void SetDataScalarTypeToShort()
Set/Get the data type of pixels in the imported data.
const char * GetDataScalarTypeAsString()
Set/Get the data type of pixels in the imported data.
void InvokeExecuteInformationCallbacks()
Invoke the appropriate callbacks.
PipelineModifiedCallbackType PipelineModifiedCallback
void * ImportVoidPointer
void LegacyCheckWholeExtent()
Invoke the appropriate callbacks.
WholeExtentCallbackType WholeExtentCallback
void SetDataScalarTypeToUnsignedChar()
Set/Get the data type of pixels in the imported data.
DirectionCallbackType DirectionCallback
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
int InvokePipelineModifiedCallbacks()
Invoke the appropriate callbacks.
void CopyImportVoidPointer(void *ptr, vtkIdType size)
Import data and make an internal copy of it.
int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime) override
Override vtkAlgorithm.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
SpacingCallbackType SpacingCallback
void * GetImportVoidPointer()
Set the pointer from which the image data is imported.
ScalarTypeCallbackType ScalarTypeCallback
OriginCallbackType OriginCallback
BufferPointerCallbackType BufferPointerCallback
DataExtentCallbackType DataExtentCallback
void SetDataScalarTypeToFloat()
Set/Get the data type of pixels in the imported data.
UpdateInformationCallbackType UpdateInformationCallback
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetDataScalarTypeToInt()
Set/Get the data type of pixels in the imported data.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ size
Definition: vtkX3D.h:253
#define VTK_SHORT
Definition: vtkType.h:36
int vtkIdType
Definition: vtkType.h:315
#define VTK_DOUBLE
Definition: vtkType.h:43
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:35
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:37
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_INT
Definition: vtkType.h:38
#define VTK_FLOAT
Definition: vtkType.h:42
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))