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 =========================================================================*/
44 #ifndef vtkImageImport_h
45 #define vtkImageImport_h
46 
47 #include "vtkIOImageModule.h" // For export macro
48 #include "vtkImageAlgorithm.h"
49 
50 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
51 {
52 public:
53  static vtkImageImport* New();
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
63 
65 
71  void SetImportVoidPointer(void* ptr);
72  void* GetImportVoidPointer() { return this->ImportVoidPointer; }
74 
82  void SetImportVoidPointer(void* ptr, int save);
83 
85 
89  vtkSetMacro(DataScalarType, int);
90  void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
91  void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
92  void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
93  void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
94  void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
95  void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
96  vtkGetMacro(DataScalarType, int);
98  {
99  return vtkImageScalarTypeNameMacro(this->DataScalarType);
100  }
102 
104 
108  vtkSetMacro(NumberOfScalarComponents, int);
109  vtkGetMacro(NumberOfScalarComponents, int);
111 
113 
119  vtkSetVector6Macro(DataExtent, int);
120  vtkGetVector6Macro(DataExtent, int);
121  void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
123 
125 
129  vtkSetVector3Macro(DataSpacing, double);
130  vtkGetVector3Macro(DataSpacing, double);
132 
134 
138  vtkSetVector3Macro(DataOrigin, double);
139  vtkGetVector3Macro(DataOrigin, double);
141 
143 
148  vtkSetVectorMacro(DataDirection, double, 9);
149  vtkGetVectorMacro(DataDirection, double, 9);
151 
153 
158  vtkSetVector6Macro(WholeExtent, int);
159  vtkGetVector6Macro(WholeExtent, int);
161 
166  vtkInformationVector* outputVector) override;
171  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
172 
174 
178  vtkSetStringMacro(ScalarArrayName);
179  vtkGetStringMacro(ScalarArrayName);
181 
183 
187  typedef void (*UpdateInformationCallbackType)(void*);
188  typedef int (*PipelineModifiedCallbackType)(void*);
189  typedef int* (*WholeExtentCallbackType)(void*);
190  typedef double* (*SpacingCallbackType)(void*);
191  typedef double* (*OriginCallbackType)(void*);
192  typedef double* (*DirectionCallbackType)(void*);
193  typedef const char* (*ScalarTypeCallbackType)(void*);
194  typedef int (*NumberOfComponentsCallbackType)(void*);
195  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
196  typedef void (*UpdateDataCallbackType)(void*);
197  typedef int* (*DataExtentCallbackType)(void*);
198  typedef void* (*BufferPointerCallbackType)(void*);
200 
202 
207  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
208  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
210 
212 
218  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
219  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
221 
223 
229  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
230  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
232 
234 
239  vtkSetMacro(SpacingCallback, SpacingCallbackType);
240  vtkGetMacro(SpacingCallback, SpacingCallbackType);
242 
244 
249  vtkSetMacro(OriginCallback, OriginCallbackType);
250  vtkGetMacro(OriginCallback, OriginCallbackType);
252 
254 
259  vtkSetMacro(DirectionCallback, DirectionCallbackType);
260  vtkGetMacro(DirectionCallback, DirectionCallbackType);
262 
264 
269  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
270  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
272 
274 
279  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
280  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
282 
284 
291  vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
292  vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
294 
296 
301  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
302  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
304 
306 
313  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
314  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
316 
318 
324  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
325  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
327 
329 
333  vtkSetMacro(CallbackUserData, void*);
334  vtkGetMacro(CallbackUserData, void*);
336 
338 
347 
348 protected:
350  ~vtkImageImport() override;
351 
353 
356 
359 
360  int WholeExtent[6];
361  int DataExtent[6];
362  double DataSpacing[3];
363  double DataOrigin[3];
364  double DataDirection[9];
365 
368 
369  UpdateInformationCallbackType UpdateInformationCallback;
370  PipelineModifiedCallbackType PipelineModifiedCallback;
371  WholeExtentCallbackType WholeExtentCallback;
372  SpacingCallbackType SpacingCallback;
373  OriginCallbackType OriginCallback;
374  DirectionCallbackType DirectionCallback;
375  ScalarTypeCallbackType ScalarTypeCallback;
376  NumberOfComponentsCallbackType NumberOfComponentsCallback;
377  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
378  UpdateDataCallbackType UpdateDataCallback;
379  DataExtentCallbackType DataExtentCallback;
380  BufferPointerCallbackType BufferPointerCallback;
381 
383 
384 private:
385  vtkImageImport(const vtkImageImport&) = delete;
386  void operator=(const vtkImageImport&) = delete;
387 };
388 
389 #endif
general representation of visualization data
Definition: vtkDataObject.h:75
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:49
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))