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 =========================================================================*/
35 #ifndef vtkImageImport_h
36 #define vtkImageImport_h
37 
38 #include "vtkIOImageModule.h" // For export macro
39 #include "vtkImageAlgorithm.h"
40 
41 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
42 {
43 public:
44  static vtkImageImport* New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
53  void CopyImportVoidPointer(void* ptr, vtkIdType size);
54 
56 
62  void SetImportVoidPointer(void* ptr);
63  void* GetImportVoidPointer() { return this->ImportVoidPointer; }
65 
73  void SetImportVoidPointer(void* ptr, int save);
74 
76 
80  vtkSetMacro(DataScalarType, int);
81  void SetDataScalarTypeToDouble() { this->SetDataScalarType(VTK_DOUBLE); }
82  void SetDataScalarTypeToFloat() { this->SetDataScalarType(VTK_FLOAT); }
83  void SetDataScalarTypeToInt() { this->SetDataScalarType(VTK_INT); }
84  void SetDataScalarTypeToShort() { this->SetDataScalarType(VTK_SHORT); }
85  void SetDataScalarTypeToUnsignedShort() { this->SetDataScalarType(VTK_UNSIGNED_SHORT); }
86  void SetDataScalarTypeToUnsignedChar() { this->SetDataScalarType(VTK_UNSIGNED_CHAR); }
87  vtkGetMacro(DataScalarType, int);
89  {
90  return vtkImageScalarTypeNameMacro(this->DataScalarType);
91  }
93 
95 
99  vtkSetMacro(NumberOfScalarComponents, int);
100  vtkGetMacro(NumberOfScalarComponents, int);
102 
104 
110  vtkSetVector6Macro(DataExtent, int);
111  vtkGetVector6Macro(DataExtent, int);
112  void SetDataExtentToWholeExtent() { this->SetDataExtent(this->GetWholeExtent()); }
114 
116 
120  vtkSetVector3Macro(DataSpacing, double);
121  vtkGetVector3Macro(DataSpacing, double);
123 
125 
129  vtkSetVector3Macro(DataOrigin, double);
130  vtkGetVector3Macro(DataOrigin, double);
132 
134 
139  vtkSetVectorMacro(DataDirection, double, 9);
140  vtkGetVectorMacro(DataDirection, double, 9);
142 
144 
149  vtkSetVector6Macro(WholeExtent, int);
150  vtkGetVector6Macro(WholeExtent, int);
152 
156  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
157  vtkInformationVector* outputVector) override;
161  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
162  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime) override;
163 
165 
169  vtkSetStringMacro(ScalarArrayName);
170  vtkGetStringMacro(ScalarArrayName);
172 
174 
178  typedef void (*UpdateInformationCallbackType)(void*);
179  typedef int (*PipelineModifiedCallbackType)(void*);
180  typedef int* (*WholeExtentCallbackType)(void*);
181  typedef double* (*SpacingCallbackType)(void*);
182  typedef double* (*OriginCallbackType)(void*);
183  typedef double* (*DirectionCallbackType)(void*);
184  typedef const char* (*ScalarTypeCallbackType)(void*);
185  typedef int (*NumberOfComponentsCallbackType)(void*);
186  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
187  typedef void (*UpdateDataCallbackType)(void*);
188  typedef int* (*DataExtentCallbackType)(void*);
189  typedef void* (*BufferPointerCallbackType)(void*);
191 
193 
198  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
199  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
201 
203 
209  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
210  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
212 
214 
220  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
221  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
223 
225 
230  vtkSetMacro(SpacingCallback, SpacingCallbackType);
231  vtkGetMacro(SpacingCallback, SpacingCallbackType);
233 
235 
240  vtkSetMacro(OriginCallback, OriginCallbackType);
241  vtkGetMacro(OriginCallback, OriginCallbackType);
243 
245 
250  vtkSetMacro(DirectionCallback, DirectionCallbackType);
251  vtkGetMacro(DirectionCallback, DirectionCallbackType);
253 
255 
260  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
261  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
263 
265 
270  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
271  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
273 
275 
282  vtkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
283  vtkGetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
285 
287 
292  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
293  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
295 
297 
304  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
305  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
307 
309 
315  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
316  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
318 
320 
324  vtkSetMacro(CallbackUserData, void*);
325  vtkGetMacro(CallbackUserData, void*);
327 
329 
332  int InvokePipelineModifiedCallbacks();
333  void InvokeUpdateInformationCallbacks();
334  void InvokeExecuteInformationCallbacks();
335  void InvokeExecuteDataCallbacks();
336  void LegacyCheckWholeExtent();
338 
339 protected:
340  vtkImageImport();
341  ~vtkImageImport() override;
342 
344 
347 
350 
351  int WholeExtent[6];
352  int DataExtent[6];
353  double DataSpacing[3];
354  double DataOrigin[3];
355  double DataDirection[9];
356 
359 
360  UpdateInformationCallbackType UpdateInformationCallback;
361  PipelineModifiedCallbackType PipelineModifiedCallback;
362  WholeExtentCallbackType WholeExtentCallback;
363  SpacingCallbackType SpacingCallback;
364  OriginCallbackType OriginCallback;
365  DirectionCallbackType DirectionCallback;
366  ScalarTypeCallbackType ScalarTypeCallback;
367  NumberOfComponentsCallbackType NumberOfComponentsCallback;
368  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
369  UpdateDataCallbackType UpdateDataCallback;
370  DataExtentCallbackType DataExtentCallback;
371  BufferPointerCallbackType BufferPointerCallback;
372 
373  void ExecuteDataWithInformation(vtkDataObject* d, vtkInformation* outInfo) override;
374 
375 private:
376  vtkImageImport(const vtkImageImport&) = delete;
377  void operator=(const vtkImageImport&) = delete;
378 };
379 
380 #endif
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 * GetImportVoidPointer()
Set the pointer from which the image data is imported.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
WholeExtentCallbackType WholeExtentCallback
void * CallbackUserData
DirectionCallbackType DirectionCallback
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...
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation *outInfo)
This is a convenience method that is implemented in many subclasses instead of RequestData.
int vtkIdType
Definition: vtkType.h:332
BufferPointerCallbackType BufferPointerCallback
void SetDataScalarTypeToFloat()
Set/Get the data type of pixels in the imported data.
void SetDataExtentToWholeExtent()
Get/Set the extent of the data buffer.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
void SetDataScalarTypeToInt()
Set/Get the data type of pixels in the imported data.
Import data from a C array.
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_FLOAT
Definition: vtkType.h:54
UpdateDataCallbackType UpdateDataCallback
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetDataScalarTypeToUnsignedChar()
Set/Get the data type of pixels in the imported data.
#define VTK_SHORT
Definition: vtkType.h:48
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))
void SetDataScalarTypeToUnsignedShort()
Set/Get the data type of pixels in the imported data.
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
NumberOfComponentsCallbackType NumberOfComponentsCallback
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
ScalarTypeCallbackType ScalarTypeCallback
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void * ImportVoidPointer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int NumberOfScalarComponents
char * ScalarArrayName
UpdateInformationCallbackType UpdateInformationCallback
OriginCallbackType OriginCallback
general representation of visualization data
Definition: vtkDataObject.h:65
PipelineModifiedCallbackType PipelineModifiedCallback
SpacingCallbackType SpacingCallback
#define VTK_INT
Definition: vtkType.h:50
DataExtentCallbackType DataExtentCallback