vtkTensorImplicitFunctionToFunctionSet.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $RCSfile: vtkTensorImplicitFunctionToFunctionSet.h,v $
00010   Date:      $Date: 2006/03/06 21:07:34 $
00011   Version:   $Revision: 1.8 $
00012 
00013 =========================================================================auto=*/
00014 
00018 
00019 
00020 #ifndef __vtkTensorImplicitFunctionToFunctionSet_h
00021 #define __vtkTensorImplicitFunctionToFunctionSet_h
00022 
00023 #define VTK_INTEGRATE_MAJOR_EIGENVECTOR  0
00024 #define VTK_INTEGRATE_MEDIUM_EIGENVECTOR 1
00025 #define VTK_INTEGRATE_MINOR_EIGENVECTOR  2
00026 
00027 #include "vtkTeemConfigure.h"
00028 
00029 #include "vtkImplicitFunction.h"
00030 #include "vtkFunctionSet.h"
00031 #include "vtkImageData.h"
00032 
00033 class VTK_Teem_EXPORT vtkTensorImplicitFunctionToFunctionSet : public vtkFunctionSet
00034 {
00035  public:
00036   static vtkTensorImplicitFunctionToFunctionSet *New();
00037   vtkTypeRevisionMacro(vtkTensorImplicitFunctionToFunctionSet, vtkFunctionSet );
00038   virtual void PrintSelf(ostream& os, vtkIndent indent);
00039   virtual int FunctionValues(vtkFloatingPointType* x, vtkFloatingPointType* f);
00040   int GetTensor(vtkFloatingPointType *x, vtkFloatingPointType * f);
00041   virtual void AddDataSet(vtkDataSet* ) {}
00042   void AddImplicitFunction(vtkImplicitFunction * func, int numcomp ) {
00043     if ( numcomp < 0 || numcomp > 5 )
00044       return;
00045     else {
00046       TensorComponent[numcomp] = func;
00047     }
00048   }
00049   void SetDataBounds(vtkImageData* im) {
00050     im->GetExtent(DataExtent);
00051     im->GetOrigin(DataOrigin);
00052     im->GetSpacing(DataSpacing);
00053   }
00055   void SetIntegrationForward(void);
00056   void SetIntegrationBackward(void);
00057   void SetChangeIntegrationDirection(void);
00058   void SetIntegrationDirection(vtkFloatingPointType dir[3]);
00059 
00063   vtkSetClampMacro(LowerBoundBias,vtkFloatingPointType,0.0,UpperBoundBias);
00064   vtkGetMacro(LowerBoundBias,vtkFloatingPointType);
00065 
00068   vtkSetClampMacro(UpperBoundBias,vtkFloatingPointType,LowerBoundBias,1.0);
00069   vtkGetMacro(UpperBoundBias,vtkFloatingPointType);
00070 
00071   vtkGetMacro(LastFractionalAnisotropy,vtkFloatingPointType);
00072 
00075   vtkSetClampMacro(CorrectionBias,vtkFloatingPointType,0.0,UpperBoundBias);
00076   vtkGetMacro(CorrectionBias,vtkFloatingPointType);
00077   int IsInsideImage(vtkFloatingPointType x[3]);
00078   void GetLastEigenvalues(vtkFloatingPointType v[3]) {
00079     memcpy(v,eigVal,3*sizeof(vtkFloatingPointType));
00080   }
00081   void GetLastEigenvectors(vtkFloatingPointType *v[3]) {
00082     for ( int i = 0 ; i < 3 ; i++ )
00083       memcpy(v[i],eigVec[i],3*sizeof(vtkFloatingPointType));
00084   }
00085  protected:
00086   
00087   vtkFloatingPointType Direction[3];
00088   int DirectionValid;
00089   int IntegrationDirection;
00090   vtkFloatingPointType LastFractionalAnisotropy;
00091   vtkFloatingPointType LowerBoundBias;
00092   vtkFloatingPointType UpperBoundBias;
00093   vtkFloatingPointType CorrectionBias;
00094   int DataExtent[6];
00095   vtkFloatingPointType DataOrigin[3];
00096   vtkFloatingPointType DataSpacing[3];
00097 
00098   vtkFloatingPointType vec[9];
00099   vtkFloatingPointType *eigVec[3];
00100   vtkFloatingPointType eigVal[3];
00101   //BTX
00102 
00103   vtkImplicitFunction* TensorComponent[6];
00104 
00105   vtkTensorImplicitFunctionToFunctionSet()
00106     {
00107     int i;
00108     for (i = 0 ; i < 6 ; i++ ) {
00109     TensorComponent[i]=0;
00110     DataExtent[i]=0;
00111       }
00112     for (i = 0 ; i < 3 ; i++ ) {
00113     DataOrigin[i]=0.0;
00114     DataSpacing[i]=1.0;
00115     eigVec[i] = &(vec[3*i]);
00116       }
00117       DirectionValid=0;
00118       NumFuncs=3;
00119       NumIndepVars=4;
00120       LowerBoundBias=0.0;
00121       UpperBoundBias=0.0;
00122       CorrectionBias=0.0;
00123       IntegrationDirection = VTK_INTEGRATE_MAJOR_EIGENVECTOR;
00124       SetIntegrationForward();
00125     }
00126   ~vtkTensorImplicitFunctionToFunctionSet() {}
00127 
00128   //ETX
00129   
00130 private:
00131   vtkTensorImplicitFunctionToFunctionSet(const vtkTensorImplicitFunctionToFunctionSet&);  
00132   void operator=(const vtkTensorImplicitFunctionToFunctionSet&);  
00133 };
00134 
00135 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1