Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkVectorFuzzyConnectednessImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorFuzzyConnectednessImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-31 17:23:45 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkVectorFuzzyConnectednessImageFilter_h
00018 #define __itkVectorFuzzyConnectednessImageFilter_h
00019 
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022 #include "itkVector.h"
00023 #include "itkMatrix.h"
00024 #include <vector>
00025 #include <list>
00026 
00027 #define MAX_SCALE 8
00028 
00029 
00030 namespace itk {
00031 
00160 template <class TInputImage, class TOutputImage>
00161 class ITK_EXPORT VectorFuzzyConnectednessImageFilter:
00162     public ImageToImageFilter<TInputImage,TOutputImage>
00163 {
00164 public:
00166   typedef VectorFuzzyConnectednessImageFilter            Self;
00167   typedef ImageToImageFilter<TInputImage,TOutputImage>   Superclass;
00168   typedef SmartPointer <Self>                            Pointer;
00169   typedef SmartPointer<const Self>                       ConstPointer;
00170 
00172   itkNewMacro(Self);
00173 
00175   itkTypeMacro(VectorFuzzyConnectednessImageFilter,ImageToImageFilter);
00176 
00178   typedef typename TInputImage::PixelType     InputPixelType;
00179   typedef typename TOutputImage::PixelType    OutputPixelType;
00180   typedef typename InputPixelType::VectorType InputVectorType;
00181 
00183   itkStaticConstMacro(VectorDimension, unsigned int,
00184                       InputPixelType::Dimension);
00185   itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00187 
00189   typedef   Matrix<double, itkGetStaticConstMacro(VectorDimension), 
00190                    itkGetStaticConstMacro(VectorDimension)> DoubleMatrixType;
00191 
00193   typedef std::vector<DoubleMatrixType>            DoubleMatrixArrayType;
00194 
00196   typedef   Vector<unsigned short,itkGetStaticConstMacro(ImageDimension)>  AffinityVector;
00197 
00199   typedef   Vector<double, itkGetStaticConstMacro(VectorDimension)> DoubleVectorType;
00200 
00202   typedef std::vector<DoubleVectorType>            DoubleVectorArrayType;
00203 
00204   typedef   Vector<int,2>                          TDVector;
00205 
00207   typedef   TInputImage                            InputImageType;
00208   typedef   TOutputImage                           OutputImageType;
00209   typedef   Image <unsigned short,itkGetStaticConstMacro(ImageDimension)>  UShortImageType;
00210   typedef   Image <AffinityVector, itkGetStaticConstMacro(ImageDimension)> AffinityImageType;
00212 
00213   typedef   typename TInputImage::IndexType        IndexType;
00214   typedef   typename TInputImage::SizeType         SizeType;
00215   typedef   typename TOutputImage::RegionType      OutRegionType;
00216 
00218   typedef   std::list<IndexType>                   ListSeedType;
00219 
00221   typedef   std::vector<ListSeedType>              ListSeedArrayType;
00222 
00223   typedef   std::vector<TDVector>                  OffsetType;
00224   
00226   itkSetMacro(NumberOfObjects, int);
00227   itkGetMacro(NumberOfObjects, int);
00229 
00231   void SetHomogeneityMatrix(const DoubleMatrixType homo_max);
00232 
00234   void SetObjectsMatrix(const DoubleMatrixType object_max,const int object_num);
00235 
00237   void SetObjectsSeed( const IndexType &seed, const int object_num);
00238 
00240   void SetObjectsMean(const DoubleVectorType, const int object_num);
00241 
00243   void SetSuppressBckgFlag(const int flag)
00244     {
00245     m_SuppressBckgFlag = flag;
00246     }
00247 
00251   void SetThreshold(const float threshold)
00252     {
00253     m_Threshold = threshold;
00254     }
00255 
00257   void Initialization();
00258 
00259 protected:
00260   VectorFuzzyConnectednessImageFilter();
00261   ~VectorFuzzyConnectednessImageFilter();
00262 
00263   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00264 
00266   void GenerateData();
00267 
00268 private:
00269   SizeType                       m_Size;
00270   std::vector<OffsetType>        m_CirclePointsLoc;
00271   std::vector<int>               m_CirclePointsNum;
00272 
00273   InputPixelType                 m_Mean;
00274   int                            m_SuppressBckgFlag;
00275   float                          m_Threshold;
00276 
00277   DoubleMatrixType               m_HomoCovariance;
00278 
00279   int                            m_NumberOfObjects;
00280   DoubleMatrixArrayType          m_ObjectCovariances;
00281   DoubleVectorArrayType          m_ObjectMeans;
00282   ListSeedArrayType              m_ObjectSeeds;
00283 
00284   std::vector<char>              m_ScaleArray;
00285 
00286   typename InputImageType::ConstPointer   m_InputImage;
00287   typename InputImageType::Pointer        m_FilterImage;
00288   typename OutputImageType::Pointer       m_SegmentObject;
00289   typename AffinityImageType::Pointer     m_AffinityImage;
00290   typename UShortImageType::Pointer       m_FuzzyConnImage;
00291 
00292   void ScalePrepare();
00293   void Compute_Scale();
00294   void Compute_Filter();
00295   void Compute_Affinity(const int);
00296   double FuzzyAffinity(const InputVectorType , const InputVectorType, const int);
00297   void Fast_Tracking(const int);
00298   
00299 private:
00300   VectorFuzzyConnectednessImageFilter(const Self&); //purposely not implemented
00301   void operator=(const Self&); //purposely not implemented  
00302 };
00303 
00304 
00305 } // end namespace itk
00306 
00307 #ifndef ITK_MANUAL_INSTANTIATION
00308 #include "itkVectorFuzzyConnectednessImageFilter.txx"
00309 #endif
00310 
00311 #endif
00312 

Generated at Thu May 28 11:55:07 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000