VTK
dox/Imaging/vtkImageImport.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkImageImport.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00034 #ifndef __vtkImageImport_h
00035 #define __vtkImageImport_h
00036 
00037 #include "vtkImageAlgorithm.h"
00038 
00039 class VTK_IMAGING_EXPORT vtkImageImport : public vtkImageAlgorithm
00040 {
00041 public:
00042   static vtkImageImport *New();
00043   vtkTypeMacro(vtkImageImport,vtkImageAlgorithm);
00044   void PrintSelf(ostream& os, vtkIndent indent);   
00045 
00049   void CopyImportVoidPointer(void *ptr, vtkIdType size);
00050   
00052 
00056   void SetImportVoidPointer(void *ptr);
00057   void *GetImportVoidPointer() {return this->ImportVoidPointer;};
00059 
00065   void SetImportVoidPointer(void *ptr, int save);
00066   
00068 
00070   vtkSetMacro(DataScalarType,int);
00071   void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00072   void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00073   void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00074   void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00075   void SetDataScalarTypeToUnsignedShort()
00076     {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00077   void SetDataScalarTypeToUnsignedChar()
00078     {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00079   vtkGetMacro(DataScalarType, int);
00080   const char *GetDataScalarTypeAsString() { 
00081     return vtkImageScalarTypeNameMacro(this->DataScalarType); }
00083 
00085 
00087   vtkSetMacro(NumberOfScalarComponents,int);
00088   vtkGetMacro(NumberOfScalarComponents,int);
00090   
00092 
00096   vtkSetVector6Macro(DataExtent,int);
00097   vtkGetVector6Macro(DataExtent,int);
00098   void SetDataExtentToWholeExtent()
00099     {this->SetDataExtent(this->GetWholeExtent());}
00101   
00103 
00105   vtkSetVector3Macro(DataSpacing,double);
00106   vtkGetVector3Macro(DataSpacing,double);
00108   
00110 
00112   vtkSetVector3Macro(DataOrigin,double);
00113   vtkGetVector3Macro(DataOrigin,double);  
00115 
00117 
00120   vtkSetVector6Macro(WholeExtent,int);
00121   vtkGetVector6Macro(WholeExtent,int);
00123   
00125 
00126   virtual int RequestUpdateExtent(  vtkInformation* request,
00127                                     vtkInformationVector** inputVector,
00128                                     vtkInformationVector* outputVector);
00130 
00132 
00134   vtkSetStringMacro(ScalarArrayName);
00135   vtkGetStringMacro(ScalarArrayName);
00137 
00138   //BTX
00140 
00142   typedef void (*UpdateInformationCallbackType)(void*);
00143   typedef int (*PipelineModifiedCallbackType)(void*);
00144   typedef int* (*WholeExtentCallbackType)(void*);
00145   typedef double* (*SpacingCallbackType)(void*);
00146   typedef double* (*OriginCallbackType)(void*);
00147   typedef const char* (*ScalarTypeCallbackType)(void*); 
00148   typedef int (*NumberOfComponentsCallbackType)(void*);
00149   typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00150   typedef void (*UpdateDataCallbackType)(void*);
00151   typedef int* (*DataExtentCallbackType)(void*);
00152   typedef void* (*BufferPointerCallbackType)(void*);
00154 
00156 
00159   vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00160   vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00162   
00164 
00168   vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00169   vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00171 
00173 
00177   vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00178   vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00180 
00182 
00185   vtkSetMacro(SpacingCallback, SpacingCallbackType);
00186   vtkGetMacro(SpacingCallback, SpacingCallbackType);
00188 
00190 
00193   vtkSetMacro(OriginCallback, OriginCallbackType);
00194   vtkGetMacro(OriginCallback, OriginCallbackType);
00196 
00198 
00201   vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00202   vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00204   
00206 
00209   vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00210   vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00212   
00214 
00219   vtkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00220   vtkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00222   
00224 
00227   vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00228   vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00230   
00232 
00237   vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
00238   vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
00240   
00242 
00246   vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00247   vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00249 
00251 
00253   vtkSetMacro(CallbackUserData, void*);
00254   vtkGetMacro(CallbackUserData, void*);  
00256   
00257   //ETX
00258 
00260 
00261   int InvokePipelineModifiedCallbacks();
00262   void InvokeUpdateInformationCallbacks();
00263   void InvokeExecuteInformationCallbacks();
00264   void InvokeExecuteDataCallbacks();
00265   void LegacyCheckWholeExtent();
00267 
00268 protected:
00269   vtkImageImport();
00270   ~vtkImageImport();
00271 
00272   virtual int RequestInformation (vtkInformation *, vtkInformationVector **, 
00273                                   vtkInformationVector *);
00274 
00275   
00276   void *ImportVoidPointer;
00277   int SaveUserArray;
00278   
00279   int NumberOfScalarComponents;
00280   int DataScalarType;
00281 
00282   int WholeExtent[6];
00283   int DataExtent[6];
00284   double DataSpacing[3];
00285   double DataOrigin[3];
00286 
00287   char *ScalarArrayName;
00288   void* CallbackUserData;
00289   
00290   //BTX
00291   UpdateInformationCallbackType     UpdateInformationCallback;
00292   PipelineModifiedCallbackType      PipelineModifiedCallback;
00293   WholeExtentCallbackType           WholeExtentCallback;
00294   SpacingCallbackType               SpacingCallback;
00295   OriginCallbackType                OriginCallback;
00296   ScalarTypeCallbackType            ScalarTypeCallback;
00297   NumberOfComponentsCallbackType    NumberOfComponentsCallback;
00298   PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
00299   UpdateDataCallbackType            UpdateDataCallback;
00300   DataExtentCallbackType            DataExtentCallback;
00301   BufferPointerCallbackType         BufferPointerCallback;
00302   //ETX
00303   
00304   virtual void ExecuteData(vtkDataObject *d);
00305 
00306 private:
00307   vtkImageImport(const vtkImageImport&);  // Not implemented.
00308   void operator=(const vtkImageImport&);  // Not implemented.
00309 };
00310 
00311 #endif