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=========================================================================*/
41#ifndef vtkImageImport_h
42#define vtkImageImport_h
43
44#include "vtkIOImageModule.h" // For export macro
45#include "vtkImageAlgorithm.h"
46
47class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
48{
49public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
60
62
68 void SetImportVoidPointer(void* ptr);
69 void* GetImportVoidPointer() { return this->ImportVoidPointer; }
71
79 void SetImportVoidPointer(void* ptr, int save);
80
82
86 vtkSetMacro(DataScalarType, int);
87 void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
88 void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
89 void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
90 void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
91 void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
92 void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
93 vtkGetMacro(DataScalarType, int);
95 {
96 return vtkImageScalarTypeNameMacro(this->DataScalarType);
97 }
99
101
105 vtkSetMacro(NumberOfScalarComponents, int);
106 vtkGetMacro(NumberOfScalarComponents, int);
108
110
116 vtkSetVector6Macro(DataExtent, int);
117 vtkGetVector6Macro(DataExtent, int);
118 void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
120
122
126 vtkSetVector3Macro(DataSpacing, double);
127 vtkGetVector3Macro(DataSpacing, double);
129
131
135 vtkSetVector3Macro(DataOrigin, double);
136 vtkGetVector3Macro(DataOrigin, double);
138
140
145 vtkSetVectorMacro(DataDirection, double, 9);
146 vtkGetVectorMacro(DataDirection, double, 9);
148
150
155 vtkSetVector6Macro(WholeExtent, int);
156 vtkGetVector6Macro(WholeExtent, int);
158
163 vtkInformationVector* outputVector) override;
168 vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
169
171
175 vtkSetStringMacro(ScalarArrayName);
176 vtkGetStringMacro(ScalarArrayName);
178
180
184 typedef void (*UpdateInformationCallbackType)(void*);
185 typedef int (*PipelineModifiedCallbackType)(void*);
186 typedef int* (*WholeExtentCallbackType)(void*);
187 typedef double* (*SpacingCallbackType)(void*);
188 typedef double* (*OriginCallbackType)(void*);
189 typedef double* (*DirectionCallbackType)(void*);
190 typedef const char* (*ScalarTypeCallbackType)(void*);
191 typedef int (*NumberOfComponentsCallbackType)(void*);
192 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
193 typedef void (*UpdateDataCallbackType)(void*);
194 typedef int* (*DataExtentCallbackType)(void*);
195 typedef void* (*BufferPointerCallbackType)(void*);
197
199
204 vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
205 vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
207
209
215 vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
216 vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
218
220
226 vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
227 vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
229
231
236 vtkSetMacro(SpacingCallback, SpacingCallbackType);
237 vtkGetMacro(SpacingCallback, SpacingCallbackType);
239
241
246 vtkSetMacro(OriginCallback, OriginCallbackType);
247 vtkGetMacro(OriginCallback, OriginCallbackType);
249
251
256 vtkSetMacro(DirectionCallback, DirectionCallbackType);
257 vtkGetMacro(DirectionCallback, DirectionCallbackType);
259
261
266 vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
267 vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
269
271
276 vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
277 vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
279
281
288 vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
289 vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
291
293
298 vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
299 vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
301
303
310 vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
311 vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
313
315
321 vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
322 vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
324
326
330 vtkSetMacro(CallbackUserData, void*);
331 vtkGetMacro(CallbackUserData, void*);
333
335
344
345protected:
347 ~vtkImageImport() override;
348
350
353
356
357 int WholeExtent[6];
358 int DataExtent[6];
359 double DataSpacing[3];
360 double DataOrigin[3];
361 double DataDirection[9];
362
365
366 UpdateInformationCallbackType UpdateInformationCallback;
367 PipelineModifiedCallbackType PipelineModifiedCallback;
368 WholeExtentCallbackType WholeExtentCallback;
369 SpacingCallbackType SpacingCallback;
370 OriginCallbackType OriginCallback;
371 DirectionCallbackType DirectionCallback;
372 ScalarTypeCallbackType ScalarTypeCallback;
373 NumberOfComponentsCallbackType NumberOfComponentsCallback;
374 PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
375 UpdateDataCallbackType UpdateDataCallback;
376 DataExtentCallbackType DataExtentCallback;
377 BufferPointerCallbackType BufferPointerCallback;
378
380
381private:
382 vtkImageImport(const vtkImageImport&) = delete;
383 void operator=(const vtkImageImport&) = delete;
384};
385
386#endif
general representation of visualization data
Definition: vtkDataObject.h:69
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:43
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))