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 
57 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
58 {
59 public:
60  static vtkImageImport* New();
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 
355 protected:
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 
391 private:
392  vtkImageImport(const vtkImageImport&) = delete;
393  void operator=(const vtkImageImport&) = delete;
394 };
395 
396 #endif
vtkImageImport::DataScalarType
int DataScalarType
Definition: vtkImageImport.h:365
vtkImageImport::NumberOfScalarComponents
int NumberOfScalarComponents
Definition: vtkImageImport.h:364
vtkImageImport::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageImport::~vtkImageImport
~vtkImageImport() override
vtkImageImport::ScalarTypeCallback
ScalarTypeCallbackType ScalarTypeCallback
Definition: vtkImageImport.h:382
vtkImageImport::BufferPointerCallback
BufferPointerCallbackType BufferPointerCallback
Definition: vtkImageImport.h:387
vtkImageImport::SaveUserArray
int SaveUserArray
Definition: vtkImageImport.h:362
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkImageImport::DataExtentCallback
DataExtentCallbackType DataExtentCallback
Definition: vtkImageImport.h:386
vtkImageImport::UpdateInformationCallback
UpdateInformationCallbackType UpdateInformationCallback
Definition: vtkImageImport.h:376
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
vtkImageImport::SetDataScalarTypeToFloat
void SetDataScalarTypeToFloat()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:98
vtkImageAlgorithm.h
vtkImageImport::SetDataScalarTypeToDouble
void SetDataScalarTypeToDouble()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:97
vtkImageImport::SpacingCallback
SpacingCallbackType SpacingCallback
Definition: vtkImageImport.h:379
vtkImageImport::SetImportVoidPointer
void SetImportVoidPointer(void *ptr, int save)
Set the pointer from which the image data is imported.
vtkImageImport::InvokeExecuteInformationCallbacks
void InvokeExecuteInformationCallbacks()
Invoke the appropriate callbacks.
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:57
vtkImageImport::RequestUpdateExtent
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Propagates the update extent through the callback if it is set.
vtkImageImport::SetDataExtentToWholeExtent
void SetDataExtentToWholeExtent()
Get/Set the extent of the data buffer.
Definition: vtkImageImport.h:128
vtkImageImport::SetDataScalarTypeToUnsignedChar
void SetDataScalarTypeToUnsignedChar()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:102
vtkImageImport::ScalarArrayName
char * ScalarArrayName
Definition: vtkImageImport.h:373
vtkImageImport::ExecuteDataWithInformation
void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
vtkImageImport::NumberOfComponentsCallback
NumberOfComponentsCallbackType NumberOfComponentsCallback
Definition: vtkImageImport.h:383
vtkImageImport::PipelineModifiedCallback
PipelineModifiedCallbackType PipelineModifiedCallback
Definition: vtkImageImport.h:377
vtkImageImport::InvokeUpdateInformationCallbacks
void InvokeUpdateInformationCallbacks()
Invoke the appropriate callbacks.
vtkImageImport::vtkImageImport
vtkImageImport()
vtkImageImport::GetDataScalarTypeAsString
const char * GetDataScalarTypeAsString()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:104
vtkImageImport::ComputePipelineMTime
int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime) override
Override vtkAlgorithm.
vtkImageImport::New
static vtkImageImport * New()
vtkImageImport::SetImportVoidPointer
void SetImportVoidPointer(void *ptr)
Set the pointer from which the image data is imported.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
save
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))
Definition: vtkVariantBoostSerialization.h:64
vtkImageImport::InvokeExecuteDataCallbacks
void InvokeExecuteDataCallbacks()
Invoke the appropriate callbacks.
vtkImageImport::SetDataScalarTypeToShort
void SetDataScalarTypeToShort()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:100
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:54
vtkImageImport::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:55
vtkImageImport::GetImportVoidPointer
void * GetImportVoidPointer()
Set the pointer from which the image data is imported.
Definition: vtkImageImport.h:79
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
vtkImageImport::LegacyCheckWholeExtent
void LegacyCheckWholeExtent()
Invoke the appropriate callbacks.
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkImageImport::CallbackUserData
void * CallbackUserData
Definition: vtkImageImport.h:374
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:48
vtkImageImport::PropagateUpdateExtentCallback
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
Definition: vtkImageImport.h:384
vtkImageImport::UpdateDataCallback
UpdateDataCallbackType UpdateDataCallback
Definition: vtkImageImport.h:385
vtkImageImport::DirectionCallback
DirectionCallbackType DirectionCallback
Definition: vtkImageImport.h:381
vtkImageImport::SetDataScalarTypeToInt
void SetDataScalarTypeToInt()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:99
vtkImageImport::ImportVoidPointer
void * ImportVoidPointer
Definition: vtkImageImport.h:361
vtkImageImport::InvokePipelineModifiedCallbacks
int InvokePipelineModifiedCallbacks()
Invoke the appropriate callbacks.
vtkImageImport::SetDataScalarTypeToUnsignedShort
void SetDataScalarTypeToUnsignedShort()
Set/Get the data type of pixels in the imported data.
Definition: vtkImageImport.h:101
vtkImageImport::WholeExtentCallback
WholeExtentCallbackType WholeExtentCallback
Definition: vtkImageImport.h:378
vtkImageImport::OriginCallback
OriginCallbackType OriginCallback
Definition: vtkImageImport.h:380
vtkImageImport::CopyImportVoidPointer
void CopyImportVoidPointer(void *ptr, vtkIdType size)
Import data and make an internal copy of it.
VTK_INT
#define VTK_INT
Definition: vtkType.h:50
vtkImageImport
Import data from a C array.
Definition: vtkImageImport.h:58
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287