VTK  9.3.0
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
29VTK_ABI_NAMESPACE_BEGIN
30class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
31{
32public:
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
146 vtkInformationVector* outputVector) override;
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
327
328protected:
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
363
364private:
365 vtkImageImport(const vtkImageImport&) = delete;
366 void operator=(const vtkImageImport&) = delete;
367};
368
369VTK_ABI_NAMESPACE_END
370#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 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.
static vtkImageImport * New()
~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 * GetImportVoidPointer()
Set the pointer from which the image data is imported.
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.
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.
void InvokeExecuteInformationCallbacks()
Invoke the appropriate callbacks.
PipelineModifiedCallbackType PipelineModifiedCallback
const char * GetDataScalarTypeAsString()
Set/Get the data type of pixels in the imported data.
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
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:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
#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))