00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSignedMaurerDistanceMapImageFilter_h
00018 #define __itkSignedMaurerDistanceMapImageFilter_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022
00059 namespace itk
00060 {
00061
00062 template <class TInputImage, class TOutputImage>
00063 class SignedMaurerDistanceMapImageFilter :
00064 public ImageToImageFilter< TInputImage, TOutputImage >
00065 {
00066 public:
00067
00069 itkStaticConstMacro(InputImageDimension, unsigned int,
00070 TInputImage::ImageDimension);
00071 itkStaticConstMacro(OutputImageDimension, unsigned int,
00072 TOutputImage::ImageDimension);
00073 itkStaticConstMacro(ImageDimension, unsigned int,
00074 TOutputImage::ImageDimension);
00076
00077
00079 typedef TInputImage InputImageType;
00080 typedef TOutputImage OutputImageType;
00081
00083 typedef SignedMaurerDistanceMapImageFilter Self;
00084 typedef ImageToImageFilter<
00085 InputImageType,
00086 OutputImageType> Superclass;
00087
00088 typedef SmartPointer<Self> Pointer;
00089 typedef SmartPointer<const Self> ConstPointer;
00090
00092 itkNewMacro(Self);
00093
00095 itkTypeMacro(SignedMaurerDistanceMapImageFilter,
00096 ImageToImageFilter);
00097
00099 typedef typename InputImageType::PixelType InputPixelType;
00100 typedef typename OutputImageType::PixelType OutputPixelType;
00101
00102 typedef typename InputImageType::SizeType InputSizeType;
00103 typedef typename OutputImageType::SizeType OutputSizeType;
00104
00105 typedef typename InputImageType::IndexType InputIndexType;
00106 typedef typename OutputImageType::IndexType OutputIndexType;
00107
00108 typedef typename InputImageType::SpacingType InputSpacingType;
00109 typedef typename OutputImageType::SpacingType OutputSpacingType;
00110 typedef typename OutputImageType::RegionType OutputImageRegionType;
00111
00113 itkSetMacro(SquaredDistance, bool);
00114
00116 itkGetConstReferenceMacro(SquaredDistance, bool);
00117
00119 itkBooleanMacro(SquaredDistance);
00120
00123 itkSetMacro(InsideIsPositive, bool);
00124
00127 itkGetConstReferenceMacro(InsideIsPositive, bool);
00128
00132 itkBooleanMacro(InsideIsPositive);
00133
00135 itkSetMacro(UseImageSpacing, bool);
00136
00138 itkGetConstReferenceMacro(UseImageSpacing, bool);
00139
00141 itkBooleanMacro(UseImageSpacing);
00142
00147 itkSetMacro(BackgroundValue, InputPixelType);
00148 itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
00150
00151 protected:
00152
00153 SignedMaurerDistanceMapImageFilter();
00154
00155 virtual ~SignedMaurerDistanceMapImageFilter();
00156
00157 void PrintSelf(std::ostream& os, Indent indent) const;
00158
00159 void GenerateData();
00160
00161 int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion);
00162
00163 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
00164
00165
00166 private:
00167
00168 SignedMaurerDistanceMapImageFilter(const Self&);
00169 void operator=(const Self&);
00170
00171 void Voronoi( unsigned int, OutputIndexType );
00172 bool Remove( OutputPixelType, OutputPixelType, OutputPixelType,
00173 OutputPixelType, OutputPixelType, OutputPixelType );
00174
00175 InputPixelType m_BackgroundValue;
00176 InputSpacingType m_Spacing;
00177
00178 bool m_InsideIsPositive;
00179 bool m_UseImageSpacing;
00180 bool m_SquaredDistance;
00181
00182 unsigned int m_CurrentDimension;
00183
00184 };
00185
00186 }
00187
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkSignedMaurerDistanceMapImageFilter.txx"
00190 #endif
00191
00192 #endif
00193