VTK  9.3.1
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
23 #ifndef vtkImageImport_h
24 #define vtkImageImport_h
25 
26 #include "vtkIOImageModule.h" // For export macro
27 #include "vtkImageAlgorithm.h"
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
31 {
32 public:
33  static vtkImageImport* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
42  void CopyImportVoidPointer(void* ptr, vtkIdType size);
43 
45 
51  void SetImportVoidPointer(void* ptr);
52  void* GetImportVoidPointer() { return this->ImportVoidPointer; }
54 
62  void SetImportVoidPointer(void* ptr, int save);
63 
65 
69  vtkSetMacro(DataScalarType, int);
70  void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
71  void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
72  void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
73  void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
74  void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
75  void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
76  vtkGetMacro(DataScalarType, int);
78  {
79  return vtkImageScalarTypeNameMacro(this->DataScalarType);
80  }
82 
84 
88  vtkSetMacro(NumberOfScalarComponents, int);
89  vtkGetMacro(NumberOfScalarComponents, int);
91 
93 
99  vtkSetVector6Macro(DataExtent, int);
100  vtkGetVector6Macro(DataExtent, int);
101  void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
103 
105 
109  vtkSetVector3Macro(DataSpacing, double);
110  vtkGetVector3Macro(DataSpacing, double);
112 
114 
118  vtkSetVector3Macro(DataOrigin, double);
119  vtkGetVector3Macro(DataOrigin, double);
121 
123 
128  vtkSetVectorMacro(DataDirection, double, 9);
129  vtkGetVectorMacro(DataDirection, double, 9);
131 
133 
138  vtkSetVector6Macro(WholeExtent, int);
139  vtkGetVector6Macro(WholeExtent, int);
141 
145  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
146  vtkInformationVector* outputVector) override;
150  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
151  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
152 
154 
158  vtkSetStringMacro(ScalarArrayName);
159  vtkGetStringMacro(ScalarArrayName);
161 
163 
167  typedef void (*UpdateInformationCallbackType)(void*);
168  typedef int (*PipelineModifiedCallbackType)(void*);
169  typedef int* (*WholeExtentCallbackType)(void*);
170  typedef double* (*SpacingCallbackType)(void*);
171  typedef double* (*OriginCallbackType)(void*);
172  typedef double* (*DirectionCallbackType)(void*);
173  typedef const char* (*ScalarTypeCallbackType)(void*);
174  typedef int (*NumberOfComponentsCallbackType)(void*);
175  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
176  typedef void (*UpdateDataCallbackType)(void*);
177  typedef int* (*DataExtentCallbackType)(void*);
178  typedef void* (*BufferPointerCallbackType)(void*);
180 
182 
187  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
188  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
190 
192 
198  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
199  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
201 
203 
209  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
210  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
212 
214 
219  vtkSetMacro(SpacingCallback, SpacingCallbackType);
220  vtkGetMacro(SpacingCallback, SpacingCallbackType);
222 
224 
229  vtkSetMacro(OriginCallback, OriginCallbackType);
230  vtkGetMacro(OriginCallback, OriginCallbackType);
232 
234 
239  vtkSetMacro(DirectionCallback, DirectionCallbackType);
240  vtkGetMacro(DirectionCallback, DirectionCallbackType);
242 
244 
249  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
250  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
252 
254 
259  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
260  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
262 
264 
271  vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
272  vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
274 
276 
281  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
282  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
284 
286 
293  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
294  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
296 
298 
304  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
305  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
307 
309 
313  vtkSetMacro(CallbackUserData, void*);
314  vtkGetMacro(CallbackUserData, void*);
316 
318 
321  int InvokePipelineModifiedCallbacks();
322  void InvokeUpdateInformationCallbacks();
323  void InvokeExecuteInformationCallbacks();
324  void InvokeExecuteDataCallbacks();
325  void LegacyCheckWholeExtent();
327 
328 protected:
329  vtkImageImport();
330  ~vtkImageImport() override;
331 
333 
336 
339 
340  int WholeExtent[6];
341  int DataExtent[6];
342  double DataSpacing[3];
343  double DataOrigin[3];
344  double DataDirection[9];
345 
348 
349  UpdateInformationCallbackType UpdateInformationCallback;
350  PipelineModifiedCallbackType PipelineModifiedCallback;
351  WholeExtentCallbackType WholeExtentCallback;
352  SpacingCallbackType SpacingCallback;
353  OriginCallbackType OriginCallback;
354  DirectionCallbackType DirectionCallback;
355  ScalarTypeCallbackType ScalarTypeCallback;
356  NumberOfComponentsCallbackType NumberOfComponentsCallback;
357  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
358  UpdateDataCallbackType UpdateDataCallback;
359  DataExtentCallbackType DataExtentCallback;
360  BufferPointerCallbackType BufferPointerCallback;
361 
362  void ExecuteDataWithInformation(vtkDataObject* d, vtkInformation* outInfo) override;
363 
364 private:
365  vtkImageImport(const vtkImageImport&) = delete;
366  void operator=(const vtkImageImport&) = delete;
367 };
368 
369 VTK_ABI_NAMESPACE_END
370 #endif
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 * GetImportVoidPointer()
Set the pointer from which the image data is imported.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:37
WholeExtentCallbackType WholeExtentCallback
void * CallbackUserData
DirectionCallbackType DirectionCallback
virtual int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime)
A special version of ProcessRequest meant specifically for the pipeline modified time request...
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation *outInfo)
This is a convenience method that is implemented in many subclasses instead of RequestData.
int vtkIdType
Definition: vtkType.h:315
BufferPointerCallbackType BufferPointerCallback
void SetDataScalarTypeToFloat()
Set/Get the data type of pixels in the imported data.
void SetDataExtentToWholeExtent()
Get/Set the extent of the data buffer.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
void SetDataScalarTypeToInt()
Set/Get the data type of pixels in the imported data.
Import data from a C array.
#define VTK_DOUBLE
Definition: vtkType.h:43
#define VTK_FLOAT
Definition: vtkType.h:42
UpdateDataCallbackType UpdateDataCallback
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetDataScalarTypeToUnsignedChar()
Set/Get the data type of pixels in the imported data.
#define VTK_SHORT
Definition: vtkType.h:36
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))
void SetDataScalarTypeToUnsignedShort()
Set/Get the data type of pixels in the imported data.
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
NumberOfComponentsCallbackType NumberOfComponentsCallback
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:35
ScalarTypeCallbackType ScalarTypeCallback
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void * ImportVoidPointer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int NumberOfScalarComponents
char * ScalarArrayName
UpdateInformationCallbackType UpdateInformationCallback
OriginCallbackType OriginCallback
general representation of visualization data
Definition: vtkDataObject.h:54
PipelineModifiedCallbackType PipelineModifiedCallback
SpacingCallbackType SpacingCallback
#define VTK_INT
Definition: vtkType.h:38
DataExtentCallbackType DataExtentCallback