VTK
dox/IO/Image/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 "vtkIOImageModule.h" // For export macro
00038 #include "vtkImageAlgorithm.h"
00039 
00040 class VTKIOIMAGE_EXPORT vtkImageImport : public vtkImageAlgorithm
00041 {
00042 public:
00043   static vtkImageImport *New();
00044   vtkTypeMacro(vtkImageImport,vtkImageAlgorithm);
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046 
00050   void CopyImportVoidPointer(void *ptr, vtkIdType size);
00051 
00053 
00057   void SetImportVoidPointer(void *ptr);
00058   void *GetImportVoidPointer() {return this->ImportVoidPointer;};
00060 
00066   void SetImportVoidPointer(void *ptr, int save);
00067 
00069 
00071   vtkSetMacro(DataScalarType,int);
00072   void SetDataScalarTypeToDouble(){this->SetDataScalarType(VTK_DOUBLE);}
00073   void SetDataScalarTypeToFloat(){this->SetDataScalarType(VTK_FLOAT);}
00074   void SetDataScalarTypeToInt(){this->SetDataScalarType(VTK_INT);}
00075   void SetDataScalarTypeToShort(){this->SetDataScalarType(VTK_SHORT);}
00076   void SetDataScalarTypeToUnsignedShort()
00077     {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
00078   void SetDataScalarTypeToUnsignedChar()
00079     {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
00080   vtkGetMacro(DataScalarType, int);
00081   const char *GetDataScalarTypeAsString() {
00082     return vtkImageScalarTypeNameMacro(this->DataScalarType); }
00084 
00086 
00088   vtkSetMacro(NumberOfScalarComponents,int);
00089   vtkGetMacro(NumberOfScalarComponents,int);
00091 
00093 
00097   vtkSetVector6Macro(DataExtent,int);
00098   vtkGetVector6Macro(DataExtent,int);
00099   void SetDataExtentToWholeExtent()
00100     {this->SetDataExtent(this->GetWholeExtent());}
00102 
00104 
00106   vtkSetVector3Macro(DataSpacing,double);
00107   vtkGetVector3Macro(DataSpacing,double);
00109 
00111 
00113   vtkSetVector3Macro(DataOrigin,double);
00114   vtkGetVector3Macro(DataOrigin,double);
00116 
00118 
00121   vtkSetVector6Macro(WholeExtent,int);
00122   vtkGetVector6Macro(WholeExtent,int);
00124 
00126 
00127   virtual int RequestUpdateExtent(  vtkInformation* request,
00128                                     vtkInformationVector** inputVector,
00129                                     vtkInformationVector* outputVector);
00131 
00133 
00135   vtkSetStringMacro(ScalarArrayName);
00136   vtkGetStringMacro(ScalarArrayName);
00138 
00139   //BTX
00141 
00143   typedef void (*UpdateInformationCallbackType)(void*);
00144   typedef int (*PipelineModifiedCallbackType)(void*);
00145   typedef int* (*WholeExtentCallbackType)(void*);
00146   typedef double* (*SpacingCallbackType)(void*);
00147   typedef double* (*OriginCallbackType)(void*);
00148   typedef const char* (*ScalarTypeCallbackType)(void*);
00149   typedef int (*NumberOfComponentsCallbackType)(void*);
00150   typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00151   typedef void (*UpdateDataCallbackType)(void*);
00152   typedef int* (*DataExtentCallbackType)(void*);
00153   typedef void* (*BufferPointerCallbackType)(void*);
00155 
00157 
00160   vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00161   vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00163 
00165 
00169   vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00170   vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00172 
00174 
00178   vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00179   vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00181 
00183 
00186   vtkSetMacro(SpacingCallback, SpacingCallbackType);
00187   vtkGetMacro(SpacingCallback, SpacingCallbackType);
00189 
00191 
00194   vtkSetMacro(OriginCallback, OriginCallbackType);
00195   vtkGetMacro(OriginCallback, OriginCallbackType);
00197 
00199 
00202   vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00203   vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00205 
00207 
00210   vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00211   vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00213 
00215 
00220   vtkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00221   vtkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00223 
00225 
00228   vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00229   vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00231 
00233 
00238   vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
00239   vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
00241 
00243 
00247   vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00248   vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00250 
00252 
00254   vtkSetMacro(CallbackUserData, void*);
00255   vtkGetMacro(CallbackUserData, void*);
00257 
00258   //ETX
00259 
00261 
00262   int InvokePipelineModifiedCallbacks();
00263   void InvokeUpdateInformationCallbacks();
00264   void InvokeExecuteInformationCallbacks();
00265   void InvokeExecuteDataCallbacks();
00266   void LegacyCheckWholeExtent();
00268 
00269 protected:
00270   vtkImageImport();
00271   ~vtkImageImport();
00272 
00273   virtual int RequestInformation (vtkInformation *, vtkInformationVector **,
00274                                   vtkInformationVector *);
00275 
00276 
00277   void *ImportVoidPointer;
00278   int SaveUserArray;
00279 
00280   int NumberOfScalarComponents;
00281   int DataScalarType;
00282 
00283   int WholeExtent[6];
00284   int DataExtent[6];
00285   double DataSpacing[3];
00286   double DataOrigin[3];
00287 
00288   char *ScalarArrayName;
00289   void* CallbackUserData;
00290 
00291   //BTX
00292   UpdateInformationCallbackType     UpdateInformationCallback;
00293   PipelineModifiedCallbackType      PipelineModifiedCallback;
00294   WholeExtentCallbackType           WholeExtentCallback;
00295   SpacingCallbackType               SpacingCallback;
00296   OriginCallbackType                OriginCallback;
00297   ScalarTypeCallbackType            ScalarTypeCallback;
00298   NumberOfComponentsCallbackType    NumberOfComponentsCallback;
00299   PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
00300   UpdateDataCallbackType            UpdateDataCallback;
00301   DataExtentCallbackType            DataExtentCallback;
00302   BufferPointerCallbackType         BufferPointerCallback;
00303   //ETX
00304 
00305   virtual void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation* outInfo);
00306 
00307 private:
00308   vtkImageImport(const vtkImageImport&);  // Not implemented.
00309   void operator=(const vtkImageImport&);  // Not implemented.
00310 };
00311 
00312 #endif