VTK  9.1.0
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=========================================================================*/
51#ifndef vtkImageImport_h
52#define vtkImageImport_h
53
54#include "vtkIOImageModule.h" // For export macro
55#include "vtkImageAlgorithm.h"
56
57class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
58{
59public:
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
70
72
78 void SetImportVoidPointer(void* ptr);
79 void* GetImportVoidPointer() { return this->ImportVoidPointer; }
81
89 void SetImportVoidPointer(void* ptr, int save);
90
92
96 vtkSetMacro(DataScalarType, int);
97 void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
98 void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
99 void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
100 void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
101 void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
102 void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
103 vtkGetMacro(DataScalarType, int);
105 {
106 return vtkImageScalarTypeNameMacro(this->DataScalarType);
107 }
109
111
115 vtkSetMacro(NumberOfScalarComponents, int);
116 vtkGetMacro(NumberOfScalarComponents, int);
118
120
126 vtkSetVector6Macro(DataExtent, int);
127 vtkGetVector6Macro(DataExtent, int);
128 void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
130
132
136 vtkSetVector3Macro(DataSpacing, double);
137 vtkGetVector3Macro(DataSpacing, double);
139
141
145 vtkSetVector3Macro(DataOrigin, double);
146 vtkGetVector3Macro(DataOrigin, double);
148
150
155 vtkSetVectorMacro(DataDirection, double, 9);
156 vtkGetVectorMacro(DataDirection, double, 9);
158
160
165 vtkSetVector6Macro(WholeExtent, int);
166 vtkGetVector6Macro(WholeExtent, int);
168
173 vtkInformationVector* outputVector) override;
178 vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
179
181
185 vtkSetStringMacro(ScalarArrayName);
186 vtkGetStringMacro(ScalarArrayName);
188
190
194 typedef void (*UpdateInformationCallbackType)(void*);
195 typedef int (*PipelineModifiedCallbackType)(void*);
196 typedef int* (*WholeExtentCallbackType)(void*);
197 typedef double* (*SpacingCallbackType)(void*);
198 typedef double* (*OriginCallbackType)(void*);
199 typedef double* (*DirectionCallbackType)(void*);
200 typedef const char* (*ScalarTypeCallbackType)(void*);
201 typedef int (*NumberOfComponentsCallbackType)(void*);
202 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
203 typedef void (*UpdateDataCallbackType)(void*);
204 typedef int* (*DataExtentCallbackType)(void*);
205 typedef void* (*BufferPointerCallbackType)(void*);
207
209
214 vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
215 vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
217
219
225 vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
226 vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
228
230
236 vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
237 vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
239
241
246 vtkSetMacro(SpacingCallback, SpacingCallbackType);
247 vtkGetMacro(SpacingCallback, SpacingCallbackType);
249
251
256 vtkSetMacro(OriginCallback, OriginCallbackType);
257 vtkGetMacro(OriginCallback, OriginCallbackType);
259
261
266 vtkSetMacro(DirectionCallback, DirectionCallbackType);
267 vtkGetMacro(DirectionCallback, DirectionCallbackType);
269
271
276 vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
277 vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
279
281
286 vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
287 vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
289
291
298 vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
299 vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
301
303
308 vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
309 vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
311
313
320 vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
321 vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
323
325
331 vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
332 vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
334
336
340 vtkSetMacro(CallbackUserData, void*);
341 vtkGetMacro(CallbackUserData, void*);
343
345
354
355protected:
357 ~vtkImageImport() override;
358
360
363
366
367 int WholeExtent[6];
368 int DataExtent[6];
369 double DataSpacing[3];
370 double DataOrigin[3];
371 double DataDirection[9];
372
375
376 UpdateInformationCallbackType UpdateInformationCallback;
377 PipelineModifiedCallbackType PipelineModifiedCallback;
378 WholeExtentCallbackType WholeExtentCallback;
379 SpacingCallbackType SpacingCallback;
380 OriginCallbackType OriginCallback;
381 DirectionCallbackType DirectionCallback;
382 ScalarTypeCallbackType ScalarTypeCallback;
383 NumberOfComponentsCallbackType NumberOfComponentsCallback;
384 PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
385 UpdateDataCallbackType UpdateDataCallback;
386 DataExtentCallbackType DataExtentCallback;
387 BufferPointerCallbackType BufferPointerCallback;
388
390
391private:
392 vtkImageImport(const vtkImageImport&) = delete;
393 void operator=(const vtkImageImport&) = delete;
394};
395
396#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
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:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ size
Definition: vtkX3D.h:259
#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))