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
32#ifndef vtkImageImport_h
33#define vtkImageImport_h
34
35#include "vtkIOImageModule.h" // For export macro
36#include "vtkImageAlgorithm.h"
37
38VTK_ABI_NAMESPACE_BEGIN
39class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
51 void CopyImportVoidPointer(void* ptr, vtkIdType size);
52
54
60 void SetImportVoidPointer(void* ptr);
61 void* GetImportVoidPointer() { return this->ImportVoidPointer; }
63
71 void SetImportVoidPointer(void* ptr, int save);
72
74
78 vtkSetMacro(DataScalarType, int);
79 void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
80 void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
81 void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
82 void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
83 void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
84 void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
85 vtkGetMacro(DataScalarType, int);
87 {
88 return vtkImageScalarTypeNameMacro(this->DataScalarType);
89 }
91
93
97 vtkSetMacro(NumberOfScalarComponents, int);
98 vtkGetMacro(NumberOfScalarComponents, int);
100
102
108 vtkSetVector6Macro(DataExtent, int);
109 vtkGetVector6Macro(DataExtent, int);
110 void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
112
114
118 vtkSetVector3Macro(DataSpacing, double);
119 vtkGetVector3Macro(DataSpacing, double);
121
123
127 vtkSetVector3Macro(DataOrigin, double);
128 vtkGetVector3Macro(DataOrigin, double);
130
132
137 vtkSetVectorMacro(DataDirection, double, 9);
138 vtkGetVectorMacro(DataDirection, double, 9);
140
142
147 vtkSetVector6Macro(WholeExtent, int);
148 vtkGetVector6Macro(WholeExtent, int);
150
155 vtkInformationVector* outputVector) override;
160 vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
161
163
167 vtkSetStringMacro(ScalarArrayName);
168 vtkGetStringMacro(ScalarArrayName);
170
172
176 typedef void (*UpdateInformationCallbackType)(void*);
177 typedef int (*PipelineModifiedCallbackType)(void*);
178 typedef int* (*WholeExtentCallbackType)(void*);
179 typedef double* (*SpacingCallbackType)(void*);
180 typedef double* (*OriginCallbackType)(void*);
181 typedef double* (*DirectionCallbackType)(void*);
182 typedef const char* (*ScalarTypeCallbackType)(void*);
183 typedef int (*NumberOfComponentsCallbackType)(void*);
184 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
185 typedef void (*UpdateDataCallbackType)(void*);
186 typedef int* (*DataExtentCallbackType)(void*);
187 typedef void* (*BufferPointerCallbackType)(void*);
189
191
196 vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
197 vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
199
201
207 vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
208 vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
210
212
218 vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
219 vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
221
223
228 vtkSetMacro(SpacingCallback, SpacingCallbackType);
229 vtkGetMacro(SpacingCallback, SpacingCallbackType);
231
233
238 vtkSetMacro(OriginCallback, OriginCallbackType);
239 vtkGetMacro(OriginCallback, OriginCallbackType);
241
243
248 vtkSetMacro(DirectionCallback, DirectionCallbackType);
249 vtkGetMacro(DirectionCallback, DirectionCallbackType);
251
253
258 vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
259 vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
261
263
268 vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
269 vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
271
273
280 vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
281 vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
283
285
290 vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
291 vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
293
295
302 vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
303 vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
305
307
313 vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
314 vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
316
318
322 vtkSetMacro(CallbackUserData, void*);
323 vtkGetMacro(CallbackUserData, void*);
325
327
336
337protected:
339 ~vtkImageImport() override;
340
342
345
348
349 int WholeExtent[6];
350 int DataExtent[6];
351 double DataSpacing[3];
352 double DataOrigin[3];
353 double DataDirection[9];
354
357
358 UpdateInformationCallbackType UpdateInformationCallback;
359 PipelineModifiedCallbackType PipelineModifiedCallback;
360 WholeExtentCallbackType WholeExtentCallback;
361 SpacingCallbackType SpacingCallback;
362 OriginCallbackType OriginCallback;
363 DirectionCallbackType DirectionCallback;
364 ScalarTypeCallbackType ScalarTypeCallback;
365 NumberOfComponentsCallbackType NumberOfComponentsCallback;
366 PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
367 UpdateDataCallbackType UpdateDataCallback;
368 DataExtentCallbackType DataExtentCallback;
369 BufferPointerCallbackType BufferPointerCallback;
370
372
373private:
374 vtkImageImport(const vtkImageImport&) = delete;
375 void operator=(const vtkImageImport&) = delete;
376};
377
378VTK_ABI_NAMESPACE_END
379#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:38
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))