00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkBilateralImageFilter_h
00018
#define __itkBilateralImageFilter_h
00019
00020
#include "itkImageToImageFilter.h"
00021
#include "itkImage.h"
00022
#include "itkNeighborhoodIterator.h"
00023
#include "itkConstNeighborhoodIterator.h"
00024
#include "itkNeighborhood.h"
00025
00026
namespace itk
00027 {
00067
template <
class TInputImage,
class TOutputImage >
00068 class ITK_EXPORT BilateralImageFilter :
00069
public ImageToImageFilter< TInputImage, TOutputImage >
00070 {
00071
public:
00073 typedef BilateralImageFilter
Self;
00074 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00075 typedef SmartPointer<Self> Pointer;
00076 typedef SmartPointer<const Self> ConstPointer;
00077
00079
itkNewMacro(
Self);
00080
00082
itkTypeMacro(BilateralImageFilter,
ImageToImageFilter);
00083
00085 typedef TInputImage
InputImageType;
00086 typedef TOutputImage
OutputImageType;
00087
00089 typedef typename Superclass::OutputImageRegionType
OutputImageRegionType;
00090
00093 typedef typename TOutputImage::PixelType
OutputPixelType;
00094 typedef typename TOutputImage::InternalPixelType
OutputInternalPixelType;
00095 typedef typename NumericTraits<OutputPixelType>::RealType
OutputPixelRealType;
00096 typedef typename TInputImage::PixelType
InputPixelType;
00097 typedef typename TInputImage::InternalPixelType
InputInternalPixelType;
00098
00101
itkStaticConstMacro(ImageDimension,
unsigned int,
00102 TOutputImage::ImageDimension);
00103
00105
typedef ConstNeighborhoodIterator<TInputImage>
00106 NeighborhoodIteratorType ;
00107
00109
typedef
00110 Neighborhood<double, itkGetStaticConstMacro(ImageDimension)> KernelType;
00111
00113 typedef typename KernelType::Iterator
KernelIteratorType ;
00114 typedef typename KernelType::ConstIterator
KernelConstIteratorType ;
00115
00117
typedef
00118 Image<double, itkGetStaticConstMacro(ImageDimension)> GaussianImageType;
00119
00123
itkSetVectorMacro(DomainSigma,
double, ImageDimension);
00124
itkSetVectorMacro(DomainSigma,
float, ImageDimension);
00125
itkGetVectorMacro(DomainSigma,
const double, ImageDimension);
00126
itkSetMacro(RangeSigma,
double);
00127
itkGetMacro(RangeSigma,
double);
00128
itkGetMacro(FilterDimensionality,
unsigned int);
00129
itkSetMacro(FilterDimensionality,
unsigned int);
00130
00133
void SetDomainSigma(
const double v)
00134 {
00135
double vArray[ImageDimension];
00136
for (
unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00137 this->SetDomainSigma(vArray);
00138 }
00139
00142
void SetDomainSigma(
const float v)
00143 {
00144 double vArray[ImageDimension];
00145
for (
unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = static_cast<double>(v); }
00146 this->SetDomainSigma(vArray);
00147 }
00148
00152
itkSetMacro(NumberOfRangeGaussianSamples,
unsigned long);
00153
itkGetMacro(NumberOfRangeGaussianSamples,
unsigned long);
00154
00155
protected:
00158 BilateralImageFilter()
00159 {
00160
unsigned int i;
00161
for (i = 0; i < ImageDimension; i++)
00162 {
00163 m_DomainSigma[i] = 4.0f;
00164 }
00165 m_RangeSigma = 50.0f;
00166 m_FilterDimensionality = ImageDimension;
00167 m_NumberOfRangeGaussianSamples = 100;
00168 m_DynamicRange = 0.0;
00169 m_DynamicRangeUsed = 0.0;
00170 m_DomainMu = 2.5;
00171 m_RangeMu = 4.0;
00172
00173
00174 }
00175
virtual ~BilateralImageFilter() {}
00176
void PrintSelf(std::ostream& os, Indent indent)
const;
00177
00179
void BeforeThreadedGenerateData();
00180
00183
void ThreadedGenerateData(
const OutputImageRegionType& outputRegionForThread,
00184
int threadId);
00185
00192
virtual void GenerateInputRequestedRegion() throw(
InvalidRequestedRegionError);
00193
00194
00195 private:
00196 BilateralImageFilter(const
Self&);
00197
void operator=(const Self&);
00198
00201
double m_RangeSigma;
00202
00205
double m_DomainSigma[ImageDimension];
00206
00209
double m_DomainMu;
00210
double m_RangeMu;
00211
00213
unsigned int m_FilterDimensionality;
00214
00216
KernelType m_GaussianKernel;
00217
00219
unsigned long m_NumberOfRangeGaussianSamples;
00220
double m_DynamicRange;
00221
double m_DynamicRangeUsed;
00222 std::
vector<
double> m_RangeGaussianTable;
00223 };
00224
00225 }
00226
00227 #ifndef ITK_MANUAL_INSTANTIATION
00228 #include "itkBilateralImageFilter.txx"
00229 #endif
00230
00231 #endif