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 =========================================================================*/
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);
47 
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);}
86  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
88  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
89  vtkGetMacro(DataScalarType, int);
90  const char *GetDataScalarTypeAsString() {
91  return vtkImageScalarTypeNameMacro(this->DataScalarType); }
93 
95 
99  vtkSetMacro(NumberOfScalarComponents,int);
100  vtkGetMacro(NumberOfScalarComponents,int);
102 
104 
110  vtkSetVector6Macro(DataExtent,int);
111  vtkGetVector6Macro(DataExtent,int);
113  {this->SetDataExtent(this->GetWholeExtent());}
115 
117 
121  vtkSetVector3Macro(DataSpacing,double);
122  vtkGetVector3Macro(DataSpacing,double);
124 
126 
130  vtkSetVector3Macro(DataOrigin,double);
131  vtkGetVector3Macro(DataOrigin,double);
133 
135 
140  vtkSetVector6Macro(WholeExtent,int);
141  vtkGetVector6Macro(WholeExtent,int);
143 
147  virtual int RequestUpdateExtent( vtkInformation* request,
148  vtkInformationVector** inputVector,
149  vtkInformationVector* outputVector);
153  virtual int
155  vtkInformationVector** inInfoVec,
156  vtkInformationVector* outInfoVec,
157  int requestFromOutputPort,
158  vtkMTimeType* mtime);
159 
161 
165  vtkSetStringMacro(ScalarArrayName);
166  vtkGetStringMacro(ScalarArrayName);
168 
170 
174  typedef void (*UpdateInformationCallbackType)(void*);
175  typedef int (*PipelineModifiedCallbackType)(void*);
176  typedef int* (*WholeExtentCallbackType)(void*);
177  typedef double* (*SpacingCallbackType)(void*);
178  typedef double* (*OriginCallbackType)(void*);
179  typedef const char* (*ScalarTypeCallbackType)(void*);
180  typedef int (*NumberOfComponentsCallbackType)(void*);
181  typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
182  typedef void (*UpdateDataCallbackType)(void*);
183  typedef int* (*DataExtentCallbackType)(void*);
184  typedef void* (*BufferPointerCallbackType)(void*);
186 
188 
193  vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
194  vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
196 
198 
204  vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
205  vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
207 
209 
215  vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
216  vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
218 
220 
225  vtkSetMacro(SpacingCallback, SpacingCallbackType);
226  vtkGetMacro(SpacingCallback, SpacingCallbackType);
228 
230 
235  vtkSetMacro(OriginCallback, OriginCallbackType);
236  vtkGetMacro(OriginCallback, OriginCallbackType);
238 
240 
245  vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
246  vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
248 
250 
255  vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
256  vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
258 
260 
267  vtkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
268  vtkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
270 
272 
277  vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
278  vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
280 
282 
289  vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
290  vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
292 
294 
300  vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
301  vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
303 
305 
309  vtkSetMacro(CallbackUserData, void*);
310  vtkGetMacro(CallbackUserData, void*);
312 
314 
323 
324 protected:
327 
330 
331 
334 
337 
338  int WholeExtent[6];
339  int DataExtent[6];
340  double DataSpacing[3];
341  double DataOrigin[3];
342 
345 
346  UpdateInformationCallbackType UpdateInformationCallback;
347  PipelineModifiedCallbackType PipelineModifiedCallback;
348  WholeExtentCallbackType WholeExtentCallback;
349  SpacingCallbackType SpacingCallback;
350  OriginCallbackType OriginCallback;
351  ScalarTypeCallbackType ScalarTypeCallback;
352  NumberOfComponentsCallbackType NumberOfComponentsCallback;
353  PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
354  UpdateDataCallbackType UpdateDataCallback;
355  DataExtentCallbackType DataExtentCallback;
356  BufferPointerCallbackType BufferPointerCallback;
357 
359 
360 private:
361  vtkImageImport(const vtkImageImport&) VTK_DELETE_FUNCTION;
362  void operator=(const vtkImageImport&) VTK_DELETE_FUNCTION;
363 };
364 
365 #endif
general representation of visualization data
Definition: vtkDataObject.h:65
Generic algorithm superclass for image algs.
Import data from a C array.
void SetDataExtentToWholeExtent()
void * CallbackUserData
static vtkImageImport * New()
int NumberOfScalarComponents
virtual void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation *outInfo)
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.
NumberOfComponentsCallbackType NumberOfComponentsCallback
UpdateDataCallbackType UpdateDataCallback
void SetImportVoidPointer(void *ptr)
Set the pointer from which the image data is imported.
void SetDataScalarTypeToUnsignedShort()
char * ScalarArrayName
void InvokeExecuteDataCallbacks()
void InvokeUpdateInformationCallbacks()
void SetDataScalarTypeToDouble()
void SetDataScalarTypeToShort()
const char * GetDataScalarTypeAsString()
void InvokeExecuteInformationCallbacks()
PipelineModifiedCallbackType PipelineModifiedCallback
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime)
Override vtkAlgorithm.
void * ImportVoidPointer
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Propagates the update extent through the callback if it is set.
void LegacyCheckWholeExtent()
WholeExtentCallbackType WholeExtentCallback
void SetDataScalarTypeToUnsignedChar()
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
int InvokePipelineModifiedCallbacks()
Invoke the appropriate callbacks.
void CopyImportVoidPointer(void *ptr, vtkIdType size)
Import data and make an internal copy of it.
SpacingCallbackType SpacingCallback
void * GetImportVoidPointer()
ScalarTypeCallbackType ScalarTypeCallback
OriginCallbackType OriginCallback
BufferPointerCallbackType BufferPointerCallback
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to collect information from their inputs and set information f...
DataExtentCallbackType DataExtentCallback
void SetDataScalarTypeToFloat()
UpdateInformationCallbackType UpdateInformationCallback
void SetDataScalarTypeToInt()
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ size
Definition: vtkX3D.h:253
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTK_SHORT
Definition: vtkType.h:52
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
#define VTK_DOUBLE
Definition: vtkType.h:59
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
#define VTK_INT
Definition: vtkType.h:54
#define VTK_FLOAT
Definition: vtkType.h:58
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))