00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef _itkGaussianBlurImageFunction_h
00018
#define _itkGaussianBlurImageFunction_h
00019
00020
#include "itkNeighborhoodOperatorImageFunction.h"
00021
#include "itkGaussianOperator.h"
00022
#include "itkGaussianSpatialFunction.h"
00023
#include "itkImageFunction.h"
00024
#include "itkCastImageFilter.h"
00025
00026
namespace itk
00027 {
00028
00038
template <
class TInputImage,
class TOutput=
double>
00039 class ITK_EXPORT GaussianBlurImageFunction :
00040
public ImageFunction< TInputImage, TOutput >
00041 {
00042
public:
00043
00045 typedef GaussianBlurImageFunction
Self;
00046
00048 typedef ImageFunction<TInputImage, TOutput> Superclass;
00049
00051 typedef SmartPointer<Self> Pointer;
00052 typedef SmartPointer<const Self> ConstPointer;
00053
00055
itkNewMacro(
Self);
00056
00058
itkTypeMacro( GaussianBlurImageFunction,
ImageFunction );
00059
00061 typedef TInputImage
InputImageType;
00062 typedef typename InputImageType::PixelType
InputPixelType;
00063 typedef typename Superclass::IndexType
IndexType;
00064 typedef typename Superclass::ContinuousIndexType
ContinuousIndexType;
00065
00066
00068
itkStaticConstMacro(ImageDimension,
unsigned int,
00069 InputImageType::ImageDimension);
00070
00071
typedef GaussianOperator<TOutput,
00072
itkGetStaticConstMacro(ImageDimension)>
00073 GaussianOperatorType;
00074 typedef Neighborhood<TOutput, itkGetStaticConstMacro(ImageDimension)> NeighborhoodType;
00075 typedef FixedArray<NeighborhoodType,itkGetStaticConstMacro(ImageDimension)> OperatorArrayType;
00076
00077 typedef GaussianSpatialFunction<TOutput,1> GaussianFunctionType;
00078 typedef typename GaussianFunctionType::Pointer
GaussianFunctionPointer;
00079 typedef itk::Image<double,itkGetStaticConstMacro(ImageDimension)> InternalImageType;
00080 typedef typename InternalImageType::Pointer
InternalImagePointer;
00081
00082
typedef NeighborhoodOperatorImageFunction<
InternalImageType,
00083 TOutput>
OperatorImageFunctionType;
00084 typedef typename OperatorImageFunctionType::Pointer
OperatorImageFunctionPointer;
00085
00086 typedef itk::CastImageFilter<InputImageType,InternalImageType> CastImageFilterType;
00087 typedef typename CastImageFilterType::Pointer
CastImageFilterPointer;
00088
00089
typedef itk::FixedArray<
double,
00090 itkGetStaticConstMacro(ImageDimension) >
ErrorArrayType;
00091
00092
typedef itk::FixedArray<
double,
00093 itkGetStaticConstMacro(ImageDimension) >
ExtentArrayType;
00094
00095
typedef itk::FixedArray<
double,
00096 itkGetStaticConstMacro(ImageDimension) >
SigmaArrayType;
00097
00099 typedef typename Superclass::PointType
PointType;
00100
00102
virtual TOutput Evaluate(
const PointType& point)
const;
00103
00104
00106
virtual TOutput EvaluateAtIndex(
const IndexType & index )
const;
00107
00109
virtual TOutput EvaluateAtContinuousIndex(
00110
const ContinuousIndexType & index )
const;
00111
00118
void SetSigma(
const double sigma[ImageDimension] );
00119
void SetSigma(
const float sigma[ImageDimension] );
00120
void SetSigma(
const double sigma);
00121
itkSetMacro( Sigma,
SigmaArrayType );
00122
itkGetConstReferenceMacro( Sigma,
SigmaArrayType );
00123
00128
virtual void SetInputImage(
const InputImageType * ptr );
00129
00133
itkSetMacro( Extent,
ExtentArrayType );
00134
itkGetConstReferenceMacro( Extent,
ExtentArrayType );
00135
void SetExtent(
const double extent[ImageDimension] );
00136
void SetExtent(
const double extent);
00137
00141
itkSetMacro( MaximumError,
ErrorArrayType );
00142
itkGetConstReferenceMacro( MaximumError,
ErrorArrayType );
00143
00148
itkSetMacro( MaximumKernelWidth,
int );
00149
itkGetMacro( MaximumKernelWidth,
int );
00150
00156
itkSetMacro( UseImageSpacing,
bool );
00157
itkGetMacro( UseImageSpacing,
bool );
00158
itkBooleanMacro( UseImageSpacing );
00159
00160
00161
protected:
00162 GaussianBlurImageFunction();
00163 GaussianBlurImageFunction(
const Self& ){};
00164
00165 ~GaussianBlurImageFunction(){};
00166
00167
void operator=(
const Self& ){};
00168 void PrintSelf(std::ostream& os,
Indent indent)
const;
00169
00170 void RecomputeGaussianKernel();
00171
void RecomputeContinuousGaussianKernel(
00172 const double offset[ImageDimension] )
const;
00173
00174
private:
00175
00176
SigmaArrayType m_Sigma;
00177
OperatorImageFunctionPointer m_OperatorImageFunction;
00178
mutable OperatorArrayType m_OperatorArray;
00179
mutable OperatorArrayType m_ContinuousOperatorArray;
00180
InternalImagePointer m_InternalImage;
00181
CastImageFilterPointer m_Caster;
00182
00186
ErrorArrayType m_MaximumError;
00187
ExtentArrayType m_Extent;
00188
00191
int m_MaximumKernelWidth;
00192
00194
unsigned int m_FilterDimensionality;
00195
00197
bool m_UseImageSpacing;
00198
00200
GaussianFunctionPointer m_GaussianFunction;
00201 };
00202
00203 }
00204
00205
#ifndef ITK_MANUAL_INSTANTIATION
00206
#include "itkGaussianBlurImageFunction.txx"
00207
#endif
00208
00209
#endif
00210