00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkGradientImageFilter_h
00018 #define __itkGradientImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkImage.h"
00022 #include "itkCovariantVector.h"
00023
00024 namespace itk
00025 {
00047 template <class TInputImage, class TOperatorValueType=float, class TOutputValueType=float>
00048 class ITK_EXPORT GradientImageFilter :
00049 public ImageToImageFilter< TInputImage,
00050 Image<CovariantVector<TOutputValueType, ::itk::GetImageDimension<TInputImage>::ImageDimension>, ::itk::GetImageDimension<TInputImage>::ImageDimension> >
00051 {
00052 public:
00054 itkStaticConstMacro(InputImageDimension, unsigned int,
00055 TInputImage::ImageDimension);
00056 itkStaticConstMacro(OutputImageDimension, unsigned int,
00057 TInputImage::ImageDimension);
00059
00061 typedef GradientImageFilter Self;
00062
00064 typedef TInputImage InputImageType;
00065 typedef typename InputImageType::Pointer InputImagePointer;
00066 typedef Image<CovariantVector<
00067 TOutputValueType, itkGetStaticConstMacro(OutputImageDimension)>,
00068 itkGetStaticConstMacro(OutputImageDimension)>
00069 OutputImageType;
00070 typedef typename OutputImageType::Pointer OutputImagePointer;
00072
00074 typedef ImageToImageFilter< InputImageType, OutputImageType> Superclass;
00075 typedef SmartPointer<Self> Pointer;
00076 typedef SmartPointer<const Self> ConstPointer;
00077
00079 itkNewMacro(Self);
00080
00082 itkTypeMacro(GradientImageFilter, ImageToImageFilter);
00083
00085 typedef typename InputImageType::PixelType InputPixelType;
00086 typedef TOperatorValueType OperatorValueType;
00087 typedef TOutputValueType OutputValueType;
00088 typedef CovariantVector<
00089 OutputValueType, itkGetStaticConstMacro(OutputImageDimension)>
00090 OutputPixelType;
00091 typedef typename OutputImageType::RegionType OutputImageRegionType;
00092
00099 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00100
00103 void SetUseImageSpacingOn()
00104 { this->SetUseImageSpacing(true); }
00105
00108 void SetUseImageSpacingOff()
00109 { this->SetUseImageSpacing(false); }
00110
00113 itkSetMacro(UseImageSpacing, bool);
00114 itkGetConstMacro(UseImageSpacing, bool);
00116
00117 #ifdef ITK_USE_CONCEPT_CHECKING
00118
00119 itkConceptMacro(InputConvertibleToOutputCheck,
00120 (Concept::Convertible<InputPixelType, OutputValueType>));
00121 itkConceptMacro(OutputHasNumericTraitsCheck,
00122 (Concept::HasNumericTraits<OutputValueType>));
00123
00125 #endif
00126
00139 itkSetMacro( UseImageDirection, bool );
00140 itkGetConstMacro( UseImageDirection, bool );
00141 itkBooleanMacro( UseImageDirection );
00143
00144 protected:
00145 GradientImageFilter();
00146 virtual ~GradientImageFilter();
00147 void PrintSelf(std::ostream& os, Indent indent) const;
00148
00159 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00160 int threadId );
00161
00162 private:
00163 GradientImageFilter(const Self&);
00164 void operator=(const Self&);
00165
00166 bool m_UseImageSpacing;
00167
00168
00169
00170 bool m_UseImageDirection;
00171
00172 };
00173
00174 }
00175
00176 #ifndef ITK_MANUAL_INSTANTIATION
00177 #include "itkGradientImageFilter.txx"
00178 #endif
00179
00180 #endif
00181