VTK  9.2.5
vtkImageImport.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImageImport.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 vtkImageImport_h
36#define vtkImageImport_h
37
38#include "vtkIOImageModule.h" // For export macro
39#include "vtkImageAlgorithm.h"
40
41class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
42{
43public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
53 void CopyImportVoidPointer(void* ptr, vtkIdType size);
54
56
62 void SetImportVoidPointer(void* ptr);
63 void* GetImportVoidPointer() { return this->ImportVoidPointer; }
65
73 void SetImportVoidPointer(void* ptr, int save);
74
76
80 vtkSetMacro(DataScalarType, int);
81 void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
82 void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
83 void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
84 void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
85 void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
86 void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
87 vtkGetMacro(DataScalarType, int);
89 {
90 return vtkImageScalarTypeNameMacro(this->DataScalarType);
91 }
93
95
99 vtkSetMacro(NumberOfScalarComponents, int);
100 vtkGetMacro(NumberOfScalarComponents, int);
102
104
110 vtkSetVector6Macro(DataExtent, int);
111 vtkGetVector6Macro(DataExtent, int);
112 void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
114
116
120 vtkSetVector3Macro(DataSpacing, double);
121 vtkGetVector3Macro(DataSpacing, double);
123
125
129 vtkSetVector3Macro(DataOrigin, double);
130 vtkGetVector3Macro(DataOrigin, double);
132
134
139 vtkSetVectorMacro(DataDirection, double, 9);
140 vtkGetVectorMacro(DataDirection, double, 9);
142
144
149 vtkSetVector6Macro(WholeExtent, int);
150 vtkGetVector6Macro(WholeExtent, int);
152
157 vtkInformationVector* outputVector) override;
162 vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
163
165
169 vtkSetStringMacro(ScalarArrayName);
170 vtkGetStringMacro(ScalarArrayName);
172
174
178 typedef void (*UpdateInformationCallbackType)(void*);
179 typedef int (*PipelineModifiedCallbackType)(void*);
180 typedef int* (*WholeExtentCallbackType)(void*);
181 typedef double* (*SpacingCallbackType)(void*);
182 typedef double* (*OriginCallbackType)(void*);
183 typedef double* (*DirectionCallbackType)(void*);
184 typedef const char* (*ScalarTypeCallbackType)(void*);
185 typedef int (*NumberOfComponentsCallbackType)(void*);
186 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
187 typedef void (*UpdateDataCallbackType)(void*);
188 typedef int* (*DataExtentCallbackType)(void*);
189 typedef void* (*BufferPointerCallbackType)(void*);
191
193
198 vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
199 vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
201
203
209 vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
210 vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
212
214
220 vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
221 vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
223
225
230 vtkSetMacro(SpacingCallback, SpacingCallbackType);
231 vtkGetMacro(SpacingCallback, SpacingCallbackType);
233
235
240 vtkSetMacro(OriginCallback, OriginCallbackType);
241 vtkGetMacro(OriginCallback, OriginCallbackType);
243
245
250 vtkSetMacro(DirectionCallback, DirectionCallbackType);
251 vtkGetMacro(DirectionCallback, DirectionCallbackType);
253
255
260 vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
261 vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
263
265
270 vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
271 vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
273
275
282 vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
283 vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
285
287
292 vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
293 vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
295
297
304 vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
305 vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
307
309
315 vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
316 vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
318
320
324 vtkSetMacro(CallbackUserData, void*);
325 vtkGetMacro(CallbackUserData, void*);
327
329
338
339protected:
341 ~vtkImageImport() override;
342
344
347
350
351 int WholeExtent[6];
352 int DataExtent[6];
353 double DataSpacing[3];
354 double DataOrigin[3];
355 double DataDirection[9];
356
359
360 UpdateInformationCallbackType UpdateInformationCallback;
361 PipelineModifiedCallbackType PipelineModifiedCallback;
362 WholeExtentCallbackType WholeExtentCallback;
363 SpacingCallbackType SpacingCallback;
364 OriginCallbackType OriginCallback;
365 DirectionCallbackType DirectionCallback;
366 ScalarTypeCallbackType ScalarTypeCallback;
367 NumberOfComponentsCallbackType NumberOfComponentsCallback;
368 PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
369 UpdateDataCallbackType UpdateDataCallback;
370 DataExtentCallbackType DataExtentCallback;
371 BufferPointerCallbackType BufferPointerCallback;
372
374
375private:
376 vtkImageImport(const vtkImageImport&) = delete;
377 void operator=(const vtkImageImport&) = delete;
378};
379
380#endif
general representation of visualization data
Definition: vtkDataObject.h:66
Generic algorithm superclass for image algs.
Import data from a C array.
void SetDataExtentToWholeExtent()
Get/Set the extent of the data buffer.
void * CallbackUserData
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.
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.
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.
void InvokeExecuteInformationCallbacks()
Invoke the appropriate callbacks.
PipelineModifiedCallbackType PipelineModifiedCallback
const char * GetDataScalarTypeAsString()
Set/Get the data type of pixels in the imported data.
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
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:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
#define VTK_SHORT
Definition: vtkType.h:48
int vtkIdType
Definition: vtkType.h:332
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_INT
Definition: vtkType.h:50
#define VTK_FLOAT
Definition: vtkType.h:54
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))