C:/cmcintos/defOrgs/source/geometrical/abc/Geometric.h

00001 #ifndef _INC_GEOMETRIC
00002 #define _INC_GEOMETRIC
00003 
00004 #include "stdafx.h"
00005 #include "itkImage.h"
00006 #include "itkSmartPointer.h"
00007 #include <itkLightObject.h> 
00008 
00009 #define medialNode 0
00010 #define boundaryNode 1
00011 #define internalNode 2
00012 
00013 namespace mial{
00014 
00016 
00027     template < class dType, int nDims, class MType = vnl_matrix<dType>, class VType = vnl_vector<dType> >
00028         class Geometric:public itk::LightObject
00029     {
00030     public:
00031 
00032                 //Smartpointer
00033                 typedef Geometric Self;
00034                 typedef itk::SmartPointer<Self>  Pointer;
00035                 typedef itk::SmartPointer<const Self>  ConstPointer;
00036                 typedef itk::WeakPointer<const Self>  ConstWeakPointer;
00037                 //itkNewMacro(Self);
00038 
00040         typedef VType                                   VectorType;
00041 
00043         typedef MType                                   MatrixType;
00044 
00046         typedef typename itk::Image< unsigned char, nDims>      BinaryImageType;
00047 
00048     protected:
00050                 Geometric(){numNodes =0;numConnections=0; topologyChange = true;nodesChange = true;};
00051 
00053 
00062         MatrixType mNodes;
00063 
00065 
00074         VectorType nodeClass;
00075 
00077 
00086         MatrixType mConnections;
00087 
00089 
00098         VectorType connectionClass;
00099 
00100 
00101 
00103         unsigned int numNodes;
00104 
00106         unsigned int numConnections;
00107 
00109 
00115         bool topologyChange;
00116 
00118 
00124         bool nodesChange;
00125     public:
00126 
00127         struct Error{
00128             std::string msg;
00129         };
00130 
00131                 virtual VectorType getCentroid(){
00132                         VectorType pos = VectorType(nDims);
00133                         pos.fill(0);
00134                         for(int i=0;i<numNodes;i++)
00135                         {
00136                                 pos = pos + mNodes.get_row(i);
00137                         }
00138                         pos = pos/numNodes;
00139                         return pos;};
00140 
00141         
00143 
00148         virtual bool setMatrixNodePositions(MatrixType pos,int* rows)=0;
00149 
00151 
00155         virtual bool setMatrixNodePositions(MatrixType pos)=0;
00156 
00158         unsigned int getNumNodes(){return numNodes;};
00159         
00160 
00162 
00168         virtual bool addNodes(MatrixType nodes,VectorType classes)=0;
00169 
00171 
00177         virtual bool addConnection(int a, int b)=0;
00178 
00179         
00181 
00188         virtual bool removeNode(int index)=0;
00189 
00191 
00194         virtual MatrixType getMatrixNodePositions()=0;
00195 
00197 
00200         virtual MatrixType getMatrixConnections()=0;
00201 
00203 
00206         virtual void writeNodesToFile(std::string fileName) = 0;
00207 
00208 
00210 
00213         virtual void readNodesFromFile(std::string fileName) = 0;
00214 
00216 
00219         virtual void generateTopologyFromBinaryImage( typename BinaryImageType::Pointer binaryInputImage ) = 0;
00220 
00222 
00225                 virtual typename itk::Image< unsigned char, nDims>::Pointer generateBinaryImageFromTopology( typename BinaryImageType::SizeType )=0;
00226 
00228         unsigned int getNumConnections(){return numConnections;};
00229 
00231 
00234         bool didTopologyChange(){if(topologyChange){topologyChange = false;return true;}else{return false;}};
00235 
00237 
00240         bool didNodesChange(){if(nodesChange){nodesChange = false;return true;}else{return false;}};
00241 
00242                 
00243     private:
00244 
00246         virtual void updateMatrixNodePositions()=0;
00247 
00249         virtual void updateMatrixConnections()=0;
00250     };
00251 }//end mial #include "Geometric.cxx"
00252 #endif /*_INC_GEOMETRIC*/

Generated on Wed Jul 19 13:05:17 2006 for IDO by  doxygen 1.4.7