VTK  9.2.6
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 =========================================================================*/
54 #ifndef vtkImageImport_h
55 #define vtkImageImport_h
56 
57 #include "vtkIOImageModule.h" // For export macro
58 #include "vtkImageAlgorithm.h"
59 
60 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
61 {
62 public:
63  static vtkImageImport* New();
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
73 
75 
81  void SetImportVoidPointer(void* ptr);
82  void* GetImportVoidPointer() { return this->ImportVoidPointer; }
84 
92  void SetImportVoidPointer(void* ptr, int save);
93 
95 
99  vtkSetMacro(DataScalarType, int);
100  void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
101  void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
102  void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
103  void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
104  void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
105  void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
106  vtkGetMacro(DataScalarType, int);
108  {
109  return vtkImageScalarTypeNameMacro(this->DataScalarType);
110  }
112 
114 
118  vtkSetMacro(NumberOfScalarComponents, int);
119  vtkGetMacro(NumberOfScalarComponents, int);
121 
123 
129  vtkSetVector6Macro(DataExtent, int);
130  vtkGetVector6Macro(DataExtent, int);
131  void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
133 
135 
139  vtkSetVector3Macro(DataSpacing, double);
140  vtkGetVector3Macro(DataSpacing, double);
142 
144 
148  vtkSetVector3Macro(DataOrigin, double);
149  vtkGetVector3Macro(DataOrigin, double);
151 
153 
158  vtkSetVectorMacro(DataDirection, double, 9);
159  vtkGetVectorMacro(DataDirection, double, 9);
161 
163 
168  vtkSetVector6Macro(WholeExtent, int);
169  vtkGetVector6Macro(WholeExtent, int);
171 
176  vtkInformationVector* outputVector) override;
181  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
182 
184 
188  vtkSetStringMacro(ScalarArrayName);
189  vtkGetStringMacro(ScalarArrayName);
191 
193 
197  typedef void (*UpdateInformationCallbackType)(void*);
198  typedef int (*PipelineModifiedCallbackType)(void*);
199  typedef int* (*WholeExtentCallbackType)(void*);
200  typedef double* (*SpacingCallbackType)(void*);
201  typedef double* (*OriginCallbackType)(void*);
202  typedef double* (*DirectionCallbackType)(void*);
203  typedef const char* (*ScalarTypeCallbackType)(void*);
204  typedef int (*NumberOfComponentsCallbackType)(void*);
205  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
206  typedef void (*UpdateDataCallbackType)(void*);
207  typedef int* (*DataExtentCallbackType)(void*);
208  typedef void* (*BufferPointerCallbackType)(void*);
210 
212 
217  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
218  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
220 
222 
228  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
229  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
231 
233 
239  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
240  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
242 
244 
249  vtkSetMacro(SpacingCallback, SpacingCallbackType);
250  vtkGetMacro(SpacingCallback, SpacingCallbackType);
252 
254 
259  vtkSetMacro(OriginCallback, OriginCallbackType);
260  vtkGetMacro(OriginCallback, OriginCallbackType);
262 
264 
269  vtkSetMacro(DirectionCallback, DirectionCallbackType);
270  vtkGetMacro(DirectionCallback, DirectionCallbackType);
272 
274 
279  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
280  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
282 
284 
289  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
290  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
292 
294 
301  vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
302  vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
304 
306 
311  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
312  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
314 
316 
323  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
324  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
326 
328 
334  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
335  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
337 
339 
343  vtkSetMacro(CallbackUserData, void*);
344  vtkGetMacro(CallbackUserData, void*);
346 
348 
357 
358 protected:
360  ~vtkImageImport() override;
361 
363 
366 
369 
370  int WholeExtent[6];
371  int DataExtent[6];
372  double DataSpacing[3];
373  double DataOrigin[3];
374  double DataDirection[9];
375 
378 
379  UpdateInformationCallbackType UpdateInformationCallback;
380  PipelineModifiedCallbackType PipelineModifiedCallback;
381  WholeExtentCallbackType WholeExtentCallback;
382  SpacingCallbackType SpacingCallback;
383  OriginCallbackType OriginCallback;
384  DirectionCallbackType DirectionCallback;
385  ScalarTypeCallbackType ScalarTypeCallback;
386  NumberOfComponentsCallbackType NumberOfComponentsCallback;
387  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
388  UpdateDataCallbackType UpdateDataCallback;
389  DataExtentCallbackType DataExtentCallback;
390  BufferPointerCallbackType BufferPointerCallback;
391 
393 
394 private:
395  vtkImageImport(const vtkImageImport&) = delete;
396  void operator=(const vtkImageImport&) = delete;
397 };
398 
399 #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
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()
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.
const char * GetDataScalarTypeAsString()
Set/Get the data type of pixels in the imported data.
void InvokeExecuteInformationCallbacks()
Invoke the appropriate callbacks.
PipelineModifiedCallbackType PipelineModifiedCallback
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
void * GetImportVoidPointer()
Set the pointer from which the image data is imported.
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:119
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))