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 
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);}
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 
317  int InvokePipelineModifiedCallbacks();
318  void InvokeUpdateInformationCallbacks();
319  void InvokeExecuteInformationCallbacks();
320  void InvokeExecuteDataCallbacks();
321  void LegacyCheckWholeExtent();
323 
324 protected:
325  vtkImageImport();
326  ~vtkImageImport();
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 
358  virtual void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation* outInfo);
359 
360 private:
361  vtkImageImport(const vtkImageImport&) VTK_DELETE_FUNCTION;
362  void operator=(const vtkImageImport&) VTK_DELETE_FUNCTION;
363 };
364 
365 #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.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
WholeExtentCallbackType WholeExtentCallback
void * CallbackUserData
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:287
BufferPointerCallbackType BufferPointerCallback
void SetDataScalarTypeToFloat()
Set/Get the data type of pixels in the imported data.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
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
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: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))
PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback
NumberOfComponentsCallbackType NumberOfComponentsCallback
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
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:64
PipelineModifiedCallbackType PipelineModifiedCallback
SpacingCallbackType SpacingCallback
#define VTK_INT
Definition: vtkType.h:54
DataExtentCallbackType DataExtentCallback