VTK
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) VTK_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);}
83  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
85  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
86  vtkGetMacro(DataScalarType, int);
87  const char *GetDataScalarTypeAsString() {
88  return vtkImageScalarTypeNameMacro(this->DataScalarType); }
90 
92 
96  vtkSetMacro(NumberOfScalarComponents,int);
97  vtkGetMacro(NumberOfScalarComponents,int);
99 
101 
107  vtkSetVector6Macro(DataExtent,int);
108  vtkGetVector6Macro(DataExtent,int);
110  {this->SetDataExtent(this->GetWholeExtent());}
112 
114 
118  vtkSetVector3Macro(DataSpacing,double);
119  vtkGetVector3Macro(DataSpacing,double);
121 
123 
127  vtkSetVector3Macro(DataOrigin,double);
128  vtkGetVector3Macro(DataOrigin,double);
130 
132 
137  vtkSetVector6Macro(WholeExtent,int);
138  vtkGetVector6Macro(WholeExtent,int);
140 
144  int RequestUpdateExtent( vtkInformation* request,
145  vtkInformationVector** inputVector,
146  vtkInformationVector* outputVector) VTK_OVERRIDE;
150  int
152  vtkInformationVector** inInfoVec,
153  vtkInformationVector* outInfoVec,
154  int requestFromOutputPort,
155  vtkMTimeType* mtime) VTK_OVERRIDE;
156 
158 
162  vtkSetStringMacro(ScalarArrayName);
163  vtkGetStringMacro(ScalarArrayName);
165 
167 
171  typedef void (*UpdateInformationCallbackType)(void*);
172  typedef int (*PipelineModifiedCallbackType)(void*);
173  typedef int* (*WholeExtentCallbackType)(void*);
174  typedef double* (*SpacingCallbackType)(void*);
175  typedef double* (*OriginCallbackType)(void*);
176  typedef const char* (*ScalarTypeCallbackType)(void*);
177  typedef int (*NumberOfComponentsCallbackType)(void*);
178  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
179  typedef void (*UpdateDataCallbackType)(void*);
180  typedef int* (*DataExtentCallbackType)(void*);
181  typedef void* (*BufferPointerCallbackType)(void*);
183 
185 
190  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
191  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
193 
195 
201  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
202  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
204 
206 
212  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
213  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
215 
217 
222  vtkSetMacro(SpacingCallback, SpacingCallbackType);
223  vtkGetMacro(SpacingCallback, SpacingCallbackType);
225 
227 
232  vtkSetMacro(OriginCallback, OriginCallbackType);
233  vtkGetMacro(OriginCallback, OriginCallbackType);
235 
237 
242  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
243  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
245 
247 
252  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
253  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
255 
257 
264  vtkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
265  vtkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
267 
269 
274  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
275  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
277 
279 
286  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
287  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
289 
291 
297  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
298  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
300 
302 
306  vtkSetMacro(CallbackUserData, void*);
307  vtkGetMacro(CallbackUserData, void*);
309 
311 
314  int InvokePipelineModifiedCallbacks();
315  void InvokeUpdateInformationCallbacks();
316  void InvokeExecuteInformationCallbacks();
317  void InvokeExecuteDataCallbacks();
318  void LegacyCheckWholeExtent();
320 
321 protected:
322  vtkImageImport();
323  ~vtkImageImport() VTK_OVERRIDE;
324 
325  int RequestInformation (vtkInformation *, vtkInformationVector **,
326  vtkInformationVector *) VTK_OVERRIDE;
327 
328 
329  void *ImportVoidPointer;
330  int SaveUserArray;
331 
332  int NumberOfScalarComponents;
333  int DataScalarType;
334 
335  int WholeExtent[6];
336  int DataExtent[6];
337  double DataSpacing[3];
338  double DataOrigin[3];
339 
340  char *ScalarArrayName;
341  void* CallbackUserData;
342 
343  UpdateInformationCallbackType UpdateInformationCallback;
344  PipelineModifiedCallbackType PipelineModifiedCallback;
345  WholeExtentCallbackType WholeExtentCallback;
346  SpacingCallbackType SpacingCallback;
347  OriginCallbackType OriginCallback;
348  ScalarTypeCallbackType ScalarTypeCallback;
349  NumberOfComponentsCallbackType NumberOfComponentsCallback;
350  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
351  UpdateDataCallbackType UpdateDataCallback;
352  DataExtentCallbackType DataExtentCallback;
353  BufferPointerCallbackType BufferPointerCallback;
354 
355  void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation* outInfo) VTK_OVERRIDE;
356 
357 private:
358  vtkImageImport(const vtkImageImport&) VTK_DELETE_FUNCTION;
359  void operator=(const vtkImageImport&) VTK_DELETE_FUNCTION;
360 };
361 
362 #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:300
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
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...
int vtkIdType
Definition: vtkType.h:345
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:59
#define VTK_FLOAT
Definition: vtkType.h:58
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetDataScalarTypeToUnsignedChar()
Set/Get the data type of pixels in the imported data.
#define VTK_SHORT
Definition: vtkType.h:52
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
void SetDataScalarTypeToUnsignedShort()
Set/Get the data type of pixels in the imported data.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:58
#define VTK_INT
Definition: vtkType.h:54