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 typename InputImageType::RegionType
RegionType;
00076
00078 typedef typename InputImageType::PixelType
PixelType;
00079
00081 typedef typename RegionType::IndexType
IndexType;
00082
00084 typedef typename InputImageType::OffsetType
OffsetType;
00085
00087 typedef typename RegionType::SizeType
SizeType;
00088
00090
itkStaticConstMacro(ImageDimension,
unsigned int,
00091 InputImageType::ImageDimension);
00092
00094 typedef typename InputImageType::ConstPointer
InputImagePointer;
00095
00097 typedef BandNode<IndexType,PixelType> BandNodeType;
00098 typedef NarrowBand<BandNodeType> NarrowBandType;
00099 typedef typename NarrowBandType::Pointer
NarrowBandPointer;
00100
00101
00103
itkSetVectorMacro( Weights,
float, ImageDimension);
00104
itkGetVectorMacro( Weights,
const float, ImageDimension);
00105
00106
00108
itkSetMacro( MaximumDistance,
float);
00109
itkGetMacro( MaximumDistance,
float);
00110
00112
void SetRegionToProcess(
const RegionType &r)
00113 {
00114 if ( m_RegionToProcess != r)
00115 {
00116 m_RegionToProcess = r;
00117 this->Modified();
00118 }
00119 }
00120 RegionType GetRegionToProcess()
const
00121
{
00122 return m_RegionToProcess;
00123 }
00124
00125
00126
void SetNarrowBand( NarrowBandType * ptr)
00127 {
00128
if ( m_NarrowBand != ptr )
00129 {
00130 m_NarrowBand = ptr;
00131 this->Modified();
00132 }
00133 }
00134
00135 NarrowBandPointer GetNarrowBand()
const
00136
{
return m_NarrowBand; }
00137
00138 protected:
00139 FastChamferDistanceImageFilter();
00140
virtual ~FastChamferDistanceImageFilter() {};
00141
void PrintSelf(std::ostream& os,
Indent indent)
const;
00142
00145
void GenerateDataND();
00146
00148
void GenerateData();
00149
00150
private:
00151 FastChamferDistanceImageFilter(
const Self&);
00152
void operator=(
const Self&);
00153
00154
float m_MaximumDistance;
00155
00157
float m_Weights[ImageDimension];
00158
00159 NarrowBandPointer m_NarrowBand;
00160
00162
typename InputImageType::RegionType m_RegionToProcess;
00163
00164
00165 };
00166
00167 }
00168
00169
00170
#ifndef ITK_MANUAL_INSTANTIATION
00171
#include "itkFastChamferDistanceImageFilter.txx"
00172
#endif
00173
00174
#endif