00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSimpleFuzzyConnectednessImageFilterBase_h
00018 #define __itkSimpleFuzzyConnectednessImageFilterBase_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022 #include <vnl/vnl_matrix_fixed.h>
00023
00024 #include <queue>
00025
00026 namespace itk{
00027
00056 template <class TInputImage, class TOutputImage>
00057 class ITK_EXPORT SimpleFuzzyConnectednessImageFilterBase:
00058 public ImageToImageFilter<TInputImage,TOutputImage>
00059 {
00060 public:
00062 typedef SimpleFuzzyConnectednessImageFilterBase Self;
00063 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00064 typedef SmartPointer <Self> Pointer;
00065 typedef SmartPointer<const Self> ConstPointer;
00066
00068 itkNewMacro(Self);
00069
00071 itkTypeMacro(SimpleFuzzyConnectednessImageFilterBase,ImageToImageFilter);
00072
00074 itkStaticConstMacro(ImageDimension, unsigned int,
00075 TInputImage::ImageDimension);
00076
00078 typedef TInputImage InputImageType;
00079 typedef TOutputImage OutputImageType;
00080 typedef Image <unsigned short, itkGetStaticConstMacro(ImageDimension)> UShortImage;
00081 typedef typename TInputImage::IndexType IndexType;
00082 typedef typename TInputImage::SizeType SizeType;
00083 typedef typename TInputImage::PixelType PixelType;
00084 typedef UShortImage FuzzySceneType;
00085 typedef typename FuzzySceneType::Pointer FuzzyScenePointer;
00086 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00087 typedef std::queue<IndexType> QueueType;
00088 typedef typename OutputImageType::RegionType RegionType;
00089 typedef typename OutputImageType::PixelType OutputPixelType;
00090 typedef typename OutputImageType::Pointer OutputImagePointer;
00091
00094 itkSetMacro(Weight, double);
00095 itkGetMacro(Weight, double);
00097
00102 itkSetMacro(Threshold, double);
00103 itkGetMacro(Threshold, double);
00105
00108 itkSetMacro(InsideValue, OutputPixelType);
00109 itkGetMacro(InsideValue, OutputPixelType);
00111
00114 itkSetMacro(OutsideValue, OutputPixelType);
00115 itkGetMacro(OutsideValue, OutputPixelType);
00117
00119 itkSetMacro( ObjectSeed, IndexType );
00120 itkGetConstReferenceMacro( ObjectSeed, IndexType );
00122
00124 void MakeSegmentObject();
00125
00127 const FuzzySceneType * GetFuzzyScene(void) const
00128 { return m_FuzzyScene; };
00129
00131 void UpdateThreshold(const double x);
00132
00133 protected:
00134 SimpleFuzzyConnectednessImageFilterBase();
00135 ~SimpleFuzzyConnectednessImageFilterBase();
00136 void PrintSelf(std::ostream& os, Indent indent) const;
00137
00139 void GenerateData();
00140
00141 double m_Weight;
00142 double m_Threshold;
00143 IndexType m_ObjectSeed;
00144 SizeType m_Size;
00145
00146 InputImageConstPointer m_InputImage;
00147 FuzzyScenePointer m_FuzzyScene;
00148 OutputImagePointer m_SegmentObject;
00149
00150 QueueType m_Queue;
00151
00152 void PushNeighbors(const IndexType ¢er);
00153
00155 virtual double FuzzyAffinity(const PixelType, const PixelType)
00156 { return 0; }
00157
00158 double FindStrongPath(const IndexType ¢er);
00159
00160 private:
00161 SimpleFuzzyConnectednessImageFilterBase(const Self&);
00162 void operator=(const Self&);
00163
00164 OutputPixelType m_InsideValue;
00165 OutputPixelType m_OutsideValue;
00166
00167 };
00168
00169
00170 }
00171
00172 #ifndef ITK_MANUAL_INSTANTIATION
00173 #include "itkSimpleFuzzyConnectednessImageFilterBase.txx"
00174 #endif
00175
00176 #endif
00177