Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkFastChamferDistanceImageFilter_h
00018 #define __itkFastChamferDistanceImageFilter_h
00019
00020 #include <itkImageToImageFilter.h>
00021 #include <itkImageRegionIteratorWithIndex.h>
00022 #include <itkNarrowBand.h>
00023
00024 namespace itk
00025 {
00026
00054 template < class TInputImage, class TOutputImage >
00055 class ITK_EXPORT FastChamferDistanceImageFilter :
00056 public ImageToImageFilter<TInputImage,TOutputImage>
00057 {
00058 public:
00060 typedef FastChamferDistanceImageFilter Self;
00061 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00062 typedef SmartPointer<Self> Pointer;
00063 typedef SmartPointer<const Self> ConstPointer;
00064
00066 itkNewMacro(Self);
00067
00069 itkTypeMacro( FastChamferDistanceImageFilter, ImageToImageFilter );
00070
00072 typedef TInputImage InputImageType;
00073
00075 typedef TOutputImage OutputImageType;
00076
00078 typedef typename InputImageType::RegionType RegionType;
00079
00081 typedef typename InputImageType::PixelType PixelType;
00082
00084 typedef typename RegionType::IndexType IndexType;
00085
00087 typedef typename InputImageType::OffsetType OffsetType;
00088
00090 typedef typename RegionType::SizeType SizeType;
00091
00093 itkStaticConstMacro(ImageDimension, unsigned int,
00094 InputImageType::ImageDimension);
00095 itkStaticConstMacro(OutputImageDimension, unsigned int,
00096 OutputImageType::ImageDimension);
00098
00100 typedef typename InputImageType::ConstPointer InputImagePointer;
00101
00103 typedef BandNode<IndexType,PixelType> BandNodeType;
00104 typedef NarrowBand<BandNodeType> NarrowBandType;
00105 typedef typename NarrowBandType::Pointer NarrowBandPointer;
00106
00107
00109 itkSetVectorMacro( Weights, float, ImageDimension);
00110 itkGetVectorMacro( Weights, const float, ImageDimension);
00112
00113
00115 itkSetMacro( MaximumDistance, float);
00116 itkGetConstMacro( MaximumDistance, float);
00118
00120 void SetRegionToProcess( const RegionType &r)
00121 {
00122 if ( m_RegionToProcess != r)
00123 {
00124 m_RegionToProcess = r;
00125 this->Modified();
00126 }
00127 }
00128 RegionType GetRegionToProcess() const
00129 {
00130 return m_RegionToProcess;
00131 }
00133
00134 void SetNarrowBand( NarrowBandType * ptr)
00135 {
00136 if ( m_NarrowBand != ptr )
00137 {
00138 m_NarrowBand = ptr;
00139 this->Modified();
00140 }
00141 }
00142
00143 NarrowBandPointer GetNarrowBand() const
00144 {
00145 return m_NarrowBand;
00146 }
00147
00148 #ifdef ITK_USE_CONCEPT_CHECKING
00149
00150 itkConceptMacro(SameDimensionCheck,
00151 (Concept::SameDimension<ImageDimension, OutputImageDimension>));
00152 itkConceptMacro(SameTypeCheck,
00153 (Concept::SameType<PixelType, typename TOutputImage::PixelType>));
00154 itkConceptMacro(FloatConvertibleToPixelTypeCheck,
00155 (Concept::Convertible<float, PixelType>));
00156 itkConceptMacro(PixelTypeConvertibleToFloatCheck,
00157 (Concept::Convertible<PixelType, float>));
00158 itkConceptMacro(PixelTypeGreaterThanFloatCheck,
00159 (Concept::GreaterThanComparable<PixelType, float>));
00160 itkConceptMacro(PixelTypeLessThanFloatCheck,
00161 (Concept::LessThanComparable<PixelType, float>));
00162 itkConceptMacro(PixelTypeFloatAdditiveOperatorsCheck,
00163 (Concept::AdditiveOperators<PixelType, float, float>));
00164 itkConceptMacro(FloatGreaterThanPixelTypeCheck,
00165 (Concept::GreaterThanComparable<float, PixelType>));
00166 itkConceptMacro(FloatLessThanPixelTypeCheck,
00167 (Concept::LessThanComparable<float, PixelType>));
00168
00170 #endif
00171
00172 protected:
00173 FastChamferDistanceImageFilter();
00174 virtual ~FastChamferDistanceImageFilter() {};
00175 void PrintSelf(std::ostream& os, Indent indent) const;
00176
00179 void GenerateDataND();
00180
00182 void GenerateData();
00183
00184 private:
00185 FastChamferDistanceImageFilter(const Self&);
00186 void operator=(const Self&);
00187
00188 float m_MaximumDistance;
00189
00191 float m_Weights[ImageDimension];
00192
00193 NarrowBandPointer m_NarrowBand;
00194
00196 typename InputImageType::RegionType m_RegionToProcess;
00197
00198
00199 };
00200
00201 }
00202
00203
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkFastChamferDistanceImageFilter.txx"
00206 #endif
00207
00208 #endif
00209