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
00081 typedef Image <unsigned short, itkGetStaticConstMacro(ImageDimension)> UShortImage;
00082
00083 typedef typename TInputImage::IndexType IndexType;
00084 typedef typename TInputImage::SizeType SizeType;
00085 typedef typename TInputImage::PixelType PixelType;
00086 typedef UShortImage FuzzySceneType;
00087 typedef typename FuzzySceneType::Pointer FuzzyScenePointer;
00088 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00089 typedef std::queue<IndexType> QueueType;
00090 typedef typename OutputImageType::RegionType RegionType;
00091 typedef typename OutputImageType::PixelType OutputPixelType;
00092 typedef typename OutputImageType::Pointer OutputImagePointer;
00093
00096 itkSetMacro(Weight, double);
00097 itkGetMacro(Weight, double);
00099
00104 itkSetMacro(Threshold, double);
00105 itkGetMacro(Threshold, double);
00107
00110 itkSetMacro(InsideValue, OutputPixelType);
00111 itkGetMacro(InsideValue, OutputPixelType);
00113
00116 itkSetMacro(OutsideValue, OutputPixelType);
00117 itkGetMacro(OutsideValue, OutputPixelType);
00119
00121 itkSetMacro( ObjectSeed, IndexType );
00122 itkGetConstReferenceMacro( ObjectSeed, IndexType );
00124
00126 void MakeSegmentObject();
00127
00129 const FuzzySceneType * GetFuzzyScene(void) const
00130 { return m_FuzzyScene; };
00131
00133 void UpdateThreshold(const double x);
00134
00135 protected:
00136 SimpleFuzzyConnectednessImageFilterBase();
00137 ~SimpleFuzzyConnectednessImageFilterBase();
00138 void PrintSelf(std::ostream& os, Indent indent) const;
00139
00141 void GenerateData();
00142
00143 double m_Weight;
00144 double m_Threshold;
00145 IndexType m_ObjectSeed;
00146 SizeType m_Size;
00147
00148 InputImageConstPointer m_InputImage;
00149 FuzzyScenePointer m_FuzzyScene;
00150 OutputImagePointer m_SegmentObject;
00151
00152 QueueType m_Queue;
00153
00154 void PushNeighbors(const IndexType ¢er);
00155
00157 virtual double FuzzyAffinity(const PixelType, const PixelType)
00158 { return 0; }
00159
00160 double FindStrongPath(const IndexType ¢er);
00161
00162 private:
00163 SimpleFuzzyConnectednessImageFilterBase(const Self&);
00164 void operator=(const Self&);
00165
00166 OutputPixelType m_InsideValue;
00167 OutputPixelType m_OutsideValue;
00168
00169 };
00170
00171
00172 }
00173
00174 #ifndef ITK_MANUAL_INSTANTIATION
00175 #include "itkSimpleFuzzyConnectednessImageFilterBase.txx"
00176 #endif
00177
00178 #endif
00179