VTK  9.0.2
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 =========================================================================*/
32 #ifndef vtkImageImport_h
33 #define vtkImageImport_h
34 
35 #include "vtkIOImageModule.h" // For export macro
36 #include "vtkImageAlgorithm.h"
37 
38 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
39 {
40 public:
41  static vtkImageImport* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
51 
53 
59  void SetImportVoidPointer(void* ptr);
60  void* GetImportVoidPointer() { return this->ImportVoidPointer; }
62 
70  void SetImportVoidPointer(void* ptr, int save);
71 
73 
77  vtkSetMacro(DataScalarType, int);
78  void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
79  void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
80  void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
81  void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
82  void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
83  void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
84  vtkGetMacro(DataScalarType, int);
86  {
87  return vtkImageScalarTypeNameMacro(this->DataScalarType);
88  }
90 
92 
96  vtkSetMacro(NumberOfScalarComponents, int);
97  vtkGetMacro(NumberOfScalarComponents, int);
99 
101 
107  vtkSetVector6Macro(DataExtent, int);
108  vtkGetVector6Macro(DataExtent, int);
109  void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
111 
113 
117  vtkSetVector3Macro(DataSpacing, double);
118  vtkGetVector3Macro(DataSpacing, double);
120 
122 
126  vtkSetVector3Macro(DataOrigin, double);
127  vtkGetVector3Macro(DataOrigin, double);
129 
131 
136  vtkSetVectorMacro(DataDirection, double, 9);
137  vtkGetVectorMacro(DataDirection, double, 9);
139 
141 
146  vtkSetVector6Macro(WholeExtent, int);
147  vtkGetVector6Macro(WholeExtent, int);
149 
154  vtkInformationVector* outputVector) override;
159  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
160 
162 
166  vtkSetStringMacro(ScalarArrayName);
167  vtkGetStringMacro(ScalarArrayName);
169 
171 
175  typedef void (*UpdateInformationCallbackType)(void*);
176  typedef int (*PipelineModifiedCallbackType)(void*);
177  typedef int* (*WholeExtentCallbackType)(void*);
178  typedef double* (*SpacingCallbackType)(void*);
179  typedef double* (*OriginCallbackType)(void*);
180  typedef double* (*DirectionCallbackType)(void*);
181  typedef const char* (*ScalarTypeCallbackType)(void*);
182  typedef int (*NumberOfComponentsCallbackType)(void*);
183  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
184  typedef void (*UpdateDataCallbackType)(void*);
185  typedef int* (*DataExtentCallbackType)(void*);
186  typedef void* (*BufferPointerCallbackType)(void*);
188 
190 
195  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
196  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
198 
200 
206  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
207  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
209 
211 
217  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
218  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
220 
222 
227  vtkSetMacro(SpacingCallback, SpacingCallbackType);
228  vtkGetMacro(SpacingCallback, SpacingCallbackType);
230 
232 
237  vtkSetMacro(OriginCallback, OriginCallbackType);
238  vtkGetMacro(OriginCallback, OriginCallbackType);
240 
242 
247  vtkSetMacro(DirectionCallback, DirectionCallbackType);
248  vtkGetMacro(DirectionCallback, DirectionCallbackType);
250 
252 
257  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
258  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
260 
262 
267  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
268  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
270 
272 
279  vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
280  vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
282 
284 
289  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
290  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
292 
294 
301  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
302  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
304 
306 
312  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
313  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
315 
317 
321  vtkSetMacro(CallbackUserData, void*);
322  vtkGetMacro(CallbackUserData, void*);
324 
326 
335 
336 protected:
338  ~vtkImageImport() override;
339 
341 
344 
347 
348  int WholeExtent[6];
349  int DataExtent[6];
350  double DataSpacing[3];
351  double DataOrigin[3];
352  double DataDirection[9];
353 
356 
357  UpdateInformationCallbackType UpdateInformationCallback;
358  PipelineModifiedCallbackType PipelineModifiedCallback;
359  WholeExtentCallbackType WholeExtentCallback;
360  SpacingCallbackType SpacingCallback;
361  OriginCallbackType OriginCallback;
362  DirectionCallbackType DirectionCallback;
363  ScalarTypeCallbackType ScalarTypeCallback;
364  NumberOfComponentsCallbackType NumberOfComponentsCallback;
365  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
366  UpdateDataCallbackType UpdateDataCallback;
367  DataExtentCallbackType DataExtentCallback;
368  BufferPointerCallbackType BufferPointerCallback;
369 
371 
372 private:
373  vtkImageImport(const vtkImageImport&) = delete;
374  void operator=(const vtkImageImport&) = delete;
375 };
376 
377 #endif
general representation of visualization data
Definition: vtkDataObject.h:60
Generic algorithm superclass for image algs.
Import data from a C array.
void SetDataExtentToWholeExtent()
void * CallbackUserData
static vtkImageImport * New()
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.
~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 SetImportVoidPointer(void *ptr)
Set the pointer from which the image data is imported.
void SetDataScalarTypeToUnsignedShort()
char * ScalarArrayName
void InvokeExecuteDataCallbacks()
void InvokeUpdateInformationCallbacks()
void SetDataScalarTypeToDouble()
void SetDataScalarTypeToShort()
const char * GetDataScalarTypeAsString()
void InvokeExecuteInformationCallbacks()
PipelineModifiedCallbackType PipelineModifiedCallback
void * ImportVoidPointer
void LegacyCheckWholeExtent()
WholeExtentCallbackType WholeExtentCallback
void SetDataScalarTypeToUnsignedChar()
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
void * GetImportVoidPointer()
ScalarTypeCallbackType ScalarTypeCallback
OriginCallbackType OriginCallback
BufferPointerCallbackType BufferPointerCallback
DataExtentCallbackType DataExtentCallback
void SetDataScalarTypeToFloat()
UpdateInformationCallbackType UpdateInformationCallback
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetDataScalarTypeToInt()
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ size
Definition: vtkX3D.h:259
#define VTK_SHORT
Definition: vtkType.h:46
int vtkIdType
Definition: vtkType.h:338
#define VTK_DOUBLE
Definition: vtkType.h:53
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:45
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:47
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
#define VTK_INT
Definition: vtkType.h:48
#define VTK_FLOAT
Definition: vtkType.h:52
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))