VTK  9.0.1
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 
50  void CopyImportVoidPointer(void* ptr, vtkIdType size);
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 
153  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
154  vtkInformationVector* outputVector) override;
158  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
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 
329  int InvokePipelineModifiedCallbacks();
330  void InvokeUpdateInformationCallbacks();
331  void InvokeExecuteInformationCallbacks();
332  void InvokeExecuteDataCallbacks();
333  void LegacyCheckWholeExtent();
335 
336 protected:
337  vtkImageImport();
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 
370  void ExecuteDataWithInformation(vtkDataObject* d, vtkInformation* outInfo) override;
371 
372 private:
373  vtkImageImport(const vtkImageImport&) = delete;
374  void operator=(const vtkImageImport&) = delete;
375 };
376 
377 #endif
vtkImageImport::DataScalarType
int DataScalarType
Definition: vtkImageImport.h:346
vtkImageImport::NumberOfScalarComponents
int NumberOfScalarComponents
Definition: vtkImageImport.h:345
vtkImageImport::ScalarTypeCallback
ScalarTypeCallbackType ScalarTypeCallback
Definition: vtkImageImport.h:363
vtkImageImport::BufferPointerCallback
BufferPointerCallbackType BufferPointerCallback
Definition: vtkImageImport.h:368
vtkImageImport::SaveUserArray
int SaveUserArray
Definition: vtkImageImport.h:343
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkImageImport::DataExtentCallback
DataExtentCallbackType DataExtentCallback
Definition: vtkImageImport.h:367
vtkImageImport::UpdateInformationCallback
UpdateInformationCallbackType UpdateInformationCallback
Definition: vtkImageImport.h:357
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:47
save
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
Definition: vtkVariantBoostSerialization.h:64
vtkImageAlgorithm::ExecuteDataWithInformation
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation *outInfo)
This is a convenience method that is implemented in many subclasses instead of RequestData.
vtkImageImport::SetDataScalarTypeToFloat
void SetDataScalarTypeToFloat()
Definition: vtkImageImport.h:79
vtkImageAlgorithm.h
vtkImageImport::SetDataScalarTypeToDouble
void SetDataScalarTypeToDouble()
Definition: vtkImageImport.h:78
vtkImageImport::SpacingCallback
SpacingCallbackType SpacingCallback
Definition: vtkImageImport.h:360
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:37
vtkImageImport::SetDataExtentToWholeExtent
void SetDataExtentToWholeExtent()
Definition: vtkImageImport.h:109
vtkImageImport::SetDataScalarTypeToUnsignedChar
void SetDataScalarTypeToUnsignedChar()
Definition: vtkImageImport.h:83
vtkImageImport::ScalarArrayName
char * ScalarArrayName
Definition: vtkImageImport.h:354
vtkImageImport::NumberOfComponentsCallback
NumberOfComponentsCallbackType NumberOfComponentsCallback
Definition: vtkImageImport.h:364
vtkImageAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkImageImport::PipelineModifiedCallback
PipelineModifiedCallbackType PipelineModifiedCallback
Definition: vtkImageImport.h:358
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkImageImport::GetDataScalarTypeAsString
const char * GetDataScalarTypeAsString()
Definition: vtkImageImport.h:85
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkImageImport::SetDataScalarTypeToShort
void SetDataScalarTypeToShort()
Definition: vtkImageImport.h:81
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:52
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:53
vtkImageImport::GetImportVoidPointer
void * GetImportVoidPointer()
Definition: vtkImageImport.h:60
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:45
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkImageImport::CallbackUserData
void * CallbackUserData
Definition: vtkImageImport.h:355
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAlgorithm::New
static vtkAlgorithm * New()
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:46
vtkImageImport::PropagateUpdateExtentCallback
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
Definition: vtkImageImport.h:365
vtkImageImport::UpdateDataCallback
UpdateDataCallbackType UpdateDataCallback
Definition: vtkImageImport.h:366
vtkImageImport::DirectionCallback
DirectionCallbackType DirectionCallback
Definition: vtkImageImport.h:362
vtkImageImport::SetDataScalarTypeToInt
void SetDataScalarTypeToInt()
Definition: vtkImageImport.h:80
vtkImageImport::ImportVoidPointer
void * ImportVoidPointer
Definition: vtkImageImport.h:342
vtkImageImport::SetDataScalarTypeToUnsignedShort
void SetDataScalarTypeToUnsignedShort()
Definition: vtkImageImport.h:82
vtkAlgorithm::ComputePipelineMTime
virtual int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime)
A special version of ProcessRequest meant specifically for the pipeline modified time request.
vtkImageImport::WholeExtentCallback
WholeExtentCallbackType WholeExtentCallback
Definition: vtkImageImport.h:359
vtkImageImport::OriginCallback
OriginCallbackType OriginCallback
Definition: vtkImageImport.h:361
VTK_INT
#define VTK_INT
Definition: vtkType.h:48
vtkImageImport
Import data from a C array.
Definition: vtkImageImport.h:38
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293