vtkPichonFastMarching.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 =========================================================================auto=*/
00009 #ifndef __vtkPichonFastMarching_h
00010 #define __vtkPichonFastMarching_h
00011 
00012 #include "vtkImageData.h"
00013 #include "vtkImageToImageFilter.h"
00014 #include "vtkSlicerBaseLogic.h"
00015 
00016 #include <vector>
00017 #include <algorithm>
00018 
00019 #include "vtkPichonFastMarchingPDF.h"
00020 
00021 #define MAJOR_VERSION 3
00022 #define MINOR_VERSION 1
00023 #define DATE_VERSION "2003-1-27/20:00EST"
00024 
00027 
00029 #define INF 1e20 
00030 
00032 #define BAND_OUT 3
00033 
00034 #define GRANULARITY_PROGRESS 20
00035 
00038 
00039 typedef enum fmstatus { fmsDONE, fmsKNOWN, fmsTRIAL, fmsFAR, fmsOUT } FMstatus;
00040 #define MASK_BIT 256
00041 
00042 struct FMnode {
00043   FMstatus status;
00044   float T;
00045   int leafIndex;
00046 };
00047 
00048 struct FMleaf {
00049   int nodeIndex;
00050 };
00051 
00053 typedef std::vector<FMleaf> VecFMleaf;
00054 typedef std::vector<int> VecInt;
00055 
00058 class VTK_SLICER_BASE_LOGIC_EXPORT vtkPichonFastMarching : public vtkImageToImageFilter
00059 {
00060 public:
00061   static vtkPichonFastMarching *New();
00062   vtkTypeRevisionMacro(vtkPichonFastMarching,vtkImageToImageFilter);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064   
00065   void vtkErrorWrapper( const char* s)
00066     {
00067       vtkErrorMacro( << s );
00068     };
00069 
00070   void unInit( void );
00071 
00072   void init(int dimX, int dimY, int dimZ, double depth, double dx, double dy, double dz);
00073 
00074   void setActiveLabel(int label);
00075 
00076   void initNewExpansion( void );
00077 
00078   int nValidSeeds( void );
00079   int nKnownPoints(void);
00080 
00081   void setNPointsEvolution( int n );
00082 
00083   void setInData(short* data);
00084   void setOutData(short* data);
00085 
00086   void setRAStoIJKmatrix(float m11, float m12, float m13, float m14,
00087              float m21, float m22, float m23, float m24,
00088              float m31, float m32, float m33, float m34,
00089              float m41, float m42, float m43, float m44);
00090 
00091   int addSeed( float r, float a, float s );
00092   int addSeedIJK( int, int, int );
00093 
00094   void show(float r);
00095 
00096   char * cxxVersionString(void);
00097   int cxxMajorVersion(void);
00098   void tweak(char *name, double value);
00099 
00100 protected:
00101   vtkPichonFastMarching();
00102   ~vtkPichonFastMarching();
00103   
00104   void ExecuteData(vtkDataObject *);
00105 
00106 
00107   friend void vtkPichonFastMarchingExecute(vtkPichonFastMarching *self,
00108                      vtkImageData *inData, short *inPtr,
00109                      vtkImageData *outData, short *outPtr, 
00110                      int outExt[6]);
00111                      
00112 private:
00113   //pb wrap  vtkPichonFastMarching()(const vtkPichonFastMarching&);
00114   //pb wrap  void operator=(const vtkPichonFastMarching&);
00115   
00116   bool somethingReallyWrong;
00117 
00118   double powerSpeed;
00119 
00120   int nNeighbors; 
00121   int arrayShiftNeighbor[27];
00122   double arrayDistanceNeighbor[27];
00123   int tmpNeighborhood[125]; 
00124 
00125 
00126   float dx; 
00127   float dy;
00128   float dz;
00129 
00130   float invDx2;
00131   float invDy2;
00132   float invDz2;
00133 
00134   bool initialized;
00135   bool firstCall;
00136 
00137   FMnode *node;  
00138   int *inhomo; 
00139   int *median; 
00140 
00141   short* outdata; 
00142   short* indata;  
00143 
00145   int dimX;
00146   int dimY;
00147   int dimZ;
00148   int dimXY; 
00149   int dimXYZ; 
00150 
00151   float m11;
00152   float m12;
00153   float m13;
00154   float m14;
00155 
00156   float m21;
00157   float m22;
00158   float m23;
00159   float m24;
00160 
00161   float m31;
00162   float m32;
00163   float m33;
00164   float m34;
00165 
00166   float m41;
00167   float m42;
00168   float m43;
00169   float m44;
00170 
00171   int label;
00172   int depth;
00173   
00174   int nPointsEvolution;
00175   int nPointsBeforeLeakEvolution;
00176   int nEvolutions;
00177 
00178   VecInt knownPoints;
00180 
00181   VecInt seedPoints;
00183 
00185   VecFMleaf tree;
00187 
00188   vtkPichonFastMarchingPDF *pdfIntensityIn;
00189   vtkPichonFastMarchingPDF *pdfInhomoIn;
00190 
00191   bool firstPassThroughShow;
00192 
00194   bool emptyTree(void);
00195   void insert(const FMleaf leaf);
00196   FMleaf removeSmallest( void );
00197   void downTree(int index);
00198   void upTree(int index);
00199 
00200   int indexFather(int index );
00201 
00202   void getMedianInhomo(int index, int &median, int &inhomo );
00203 
00204   int shiftNeighbor(int n);
00205   double distanceNeighbor(int n);
00206   float computeT(int index );
00207   
00208   void setSeed(int index );
00209 
00210   void collectInfoSeed(int index );
00211   void collectInfoAll( void );
00212   
00213   float speed(int index );
00214 
00215   bool minHeapIsSorted( void );
00216 
00217   /* perform one step of fast marching
00218      return the leaf which has just been added to fmsKNOWN */
00219   float step( void );
00220 };
00221 
00222 #endif
00223 
00224 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1