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 
00132 
00133   virtual int
00134   ComputePipelineMTime(vtkInformation* request,
00135                        vtkInformationVector** inInfoVec,
00136                        vtkInformationVector* outInfoVec,
00137                        int requestFromOutputPort,
00138                        unsigned long* mtime);
00140 
00142 
00144   vtkSetStringMacro(ScalarArrayName);
00145   vtkGetStringMacro(ScalarArrayName);
00147 
00148   //BTX
00150 
00152   typedef void (*UpdateInformationCallbackType)(void*);
00153   typedef int (*PipelineModifiedCallbackType)(void*);
00154   typedef int* (*WholeExtentCallbackType)(void*);
00155   typedef double* (*SpacingCallbackType)(void*);
00156   typedef double* (*OriginCallbackType)(void*);
00157   typedef const char* (*ScalarTypeCallbackType)(void*);
00158   typedef int (*NumberOfComponentsCallbackType)(void*);
00159   typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00160   typedef void (*UpdateDataCallbackType)(void*);
00161   typedef int* (*DataExtentCallbackType)(void*);
00162   typedef void* (*BufferPointerCallbackType)(void*);
00164 
00166 
00169   vtkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00170   vtkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00172 
00174 
00178   vtkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00179   vtkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00181 
00183 
00187   vtkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00188   vtkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00190 
00192 
00195   vtkSetMacro(SpacingCallback, SpacingCallbackType);
00196   vtkGetMacro(SpacingCallback, SpacingCallbackType);
00198 
00200 
00203   vtkSetMacro(OriginCallback, OriginCallbackType);
00204   vtkGetMacro(OriginCallback, OriginCallbackType);
00206 
00208 
00211   vtkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00212   vtkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00214 
00216 
00219   vtkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00220   vtkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00222 
00224 
00229   vtkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00230   vtkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00232 
00234 
00237   vtkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00238   vtkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00240 
00242 
00247   vtkSetMacro(DataExtentCallback, DataExtentCallbackType);
00248   vtkGetMacro(DataExtentCallback, DataExtentCallbackType);
00250 
00252 
00256   vtkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00257   vtkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00259 
00261 
00263   vtkSetMacro(CallbackUserData, void*);
00264   vtkGetMacro(CallbackUserData, void*);
00266 
00267   //ETX
00268 
00270 
00271   int InvokePipelineModifiedCallbacks();
00272   void InvokeUpdateInformationCallbacks();
00273   void InvokeExecuteInformationCallbacks();
00274   void InvokeExecuteDataCallbacks();
00275   void LegacyCheckWholeExtent();
00277 
00278 protected:
00279   vtkImageImport();
00280   ~vtkImageImport();
00281 
00282   virtual int RequestInformation (vtkInformation *, vtkInformationVector **,
00283                                   vtkInformationVector *);
00284 
00285 
00286   void *ImportVoidPointer;
00287   int SaveUserArray;
00288 
00289   int NumberOfScalarComponents;
00290   int DataScalarType;
00291 
00292   int WholeExtent[6];
00293   int DataExtent[6];
00294   double DataSpacing[3];
00295   double DataOrigin[3];
00296 
00297   char *ScalarArrayName;
00298   void* CallbackUserData;
00299 
00300   //BTX
00301   UpdateInformationCallbackType     UpdateInformationCallback;
00302   PipelineModifiedCallbackType      PipelineModifiedCallback;
00303   WholeExtentCallbackType           WholeExtentCallback;
00304   SpacingCallbackType               SpacingCallback;
00305   OriginCallbackType                OriginCallback;
00306   ScalarTypeCallbackType            ScalarTypeCallback;
00307   NumberOfComponentsCallbackType    NumberOfComponentsCallback;
00308   PropagateUpdateExtentCallbackType PropagateUpdateExtentCallback;
00309   UpdateDataCallbackType            UpdateDataCallback;
00310   DataExtentCallbackType            DataExtentCallback;
00311   BufferPointerCallbackType         BufferPointerCallback;
00312   //ETX
00313 
00314   virtual void ExecuteDataWithInformation(vtkDataObject *d, vtkInformation* outInfo);
00315 
00316 private:
00317   vtkImageImport(const vtkImageImport&);  // Not implemented.
00318   void operator=(const vtkImageImport&);  // Not implemented.
00319 };
00320 
00321 #endif