00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00029 #ifndef __vtkTransformToGrid_h
00030 #define __vtkTransformToGrid_h
00031 
00032 #include "vtkAlgorithm.h"
00033 #include "vtkImageData.h" 
00034 
00035 class vtkAbstractTransform;
00036 
00037 class VTK_HYBRID_EXPORT vtkTransformToGrid : public vtkAlgorithm
00038 {
00039 public:
00040   static vtkTransformToGrid *New();
00041   vtkTypeRevisionMacro(vtkTransformToGrid,vtkAlgorithm);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043 
00045 
00046   virtual void SetInput(vtkAbstractTransform*);
00047   vtkGetObjectMacro(Input,vtkAbstractTransform);
00049 
00051 
00052   vtkSetVector6Macro(GridExtent,int);
00053   vtkGetVector6Macro(GridExtent,int);
00055 
00057 
00058   vtkSetVector3Macro(GridOrigin,double);
00059   vtkGetVector3Macro(GridOrigin,double);
00061 
00063 
00064   vtkSetVector3Macro(GridSpacing,double);
00065   vtkGetVector3Macro(GridSpacing,double);
00067 
00069 
00070   vtkSetMacro(GridScalarType,int);
00071   vtkGetMacro(GridScalarType,int);
00072   void SetGridScalarTypeToFloat(){this->SetGridScalarType(VTK_DOUBLE);};
00073   void SetGridScalarTypeToShort(){this->SetGridScalarType(VTK_SHORT);};
00074   void SetGridScalarTypeToUnsignedShort()
00075     {this->SetGridScalarType(VTK_UNSIGNED_SHORT);};
00076   void SetGridScalarTypeToUnsignedChar()
00077     {this->SetGridScalarType(VTK_UNSIGNED_CHAR);};
00078   void SetGridScalarTypeToChar()
00079     {this->SetGridScalarType(VTK_CHAR);};
00081 
00083 
00086   double GetDisplacementScale() {
00087     this->UpdateShiftScale(); return this->DisplacementScale; };
00088   double GetDisplacementShift() {
00089     this->UpdateShiftScale(); return this->DisplacementShift; };
00091 
00093   vtkImageData* GetOutput();
00094 
00096 
00097   virtual int ProcessRequest(vtkInformation*,
00098                              vtkInformationVector**,
00099                              vtkInformationVector*);
00101 
00102 protected:
00103   vtkTransformToGrid();
00104   ~vtkTransformToGrid();
00105 
00106   void RequestInformation (vtkInformation *, 
00107                            vtkInformationVector **, vtkInformationVector *);
00108 
00109   void RequestData(vtkInformation *, 
00110                    vtkInformationVector **, vtkInformationVector *);
00111 
00114   void UpdateShiftScale();
00115 
00116   unsigned long GetMTime();
00117 
00118   vtkAbstractTransform *Input;
00119 
00120   int GridScalarType;
00121   int GridExtent[6];
00122   double GridOrigin[3];
00123   double GridSpacing[3];
00124 
00125   double DisplacementScale;
00126   double DisplacementShift;
00127   vtkTimeStamp ShiftScaleTime;
00128 
00129   
00130   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00131 
00132 private:
00133   vtkTransformToGrid(const vtkTransformToGrid&);  
00134   void operator=(const vtkTransformToGrid&);  
00135 };
00136 
00137 #endif