ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkZeroCrossingBasedEdgeDetectionImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkZeroCrossingBasedEdgeDetectionImageFilter_h
00019 #define __itkZeroCrossingBasedEdgeDetectionImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkImage.h"
00023 
00024 namespace itk
00025 {
00069 template< class TInputImage, class TOutputImage >
00070 class ITK_EXPORT ZeroCrossingBasedEdgeDetectionImageFilter:
00071   public ImageToImageFilter< TInputImage, TOutputImage >
00072 {
00073 public:
00075   typedef ZeroCrossingBasedEdgeDetectionImageFilter       Self;
00076   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00077 
00079   typedef TInputImage  InputImageType;
00080   typedef TOutputImage OutputImageType;
00081 
00083   typedef SmartPointer< Self >       Pointer;
00084   typedef SmartPointer< const Self > ConstPointer;
00085 
00087   typedef typename TInputImage::PixelType  InputImagePixelType;
00088   typedef typename TOutputImage::PixelType OutputImagePixelType;
00089 
00091   itkNewMacro(Self);
00092 
00094   typedef typename TOutputImage::RegionType OutputImageRegionType;
00095 
00097   itkTypeMacro(ZeroCrossingBasedEdgeDetectionImageFilter, ImageToImageFilter);
00098 
00100   itkStaticConstMacro(ImageDimension, unsigned int,
00101                       TInputImage::ImageDimension);
00102   itkStaticConstMacro(OutputImageDimension, unsigned int,
00103                       TOutputImage::ImageDimension);
00105 
00107   typedef FixedArray< double, itkGetStaticConstMacro(ImageDimension) > ArrayType;
00108 
00110   itkSetMacro(Variance, ArrayType);
00111   itkGetConstMacro(Variance, const ArrayType);
00112   itkSetMacro(MaximumError, ArrayType);
00113   itkGetConstMacro(MaximumError, const ArrayType);
00115 
00117   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00118   itkSetMacro(BackgroundValue, OutputImagePixelType);
00119   itkGetConstMacro(ForegroundValue, OutputImagePixelType);
00120   itkSetMacro(ForegroundValue, OutputImagePixelType);
00122 
00124   void SetVariance(const typename ArrayType::ValueType v)
00125   {
00126     m_Variance.Fill(v);
00127   }
00128 
00135   void SetMaximumError(const typename ArrayType::ValueType v)
00136   {
00137     m_MaximumError.Fill(v);
00138   }
00139 
00140 #ifdef ITK_USE_CONCEPT_CHECKING
00141 
00142   itkConceptMacro( OutputEqualityComparableCheck,
00143                    ( Concept::EqualityComparable< OutputImagePixelType > ) );
00144   itkConceptMacro( SameDimensionCheck,
00145                    ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
00146   itkConceptMacro( SameTypeCheck,
00147                    ( Concept::SameType< InputImagePixelType, OutputImagePixelType > ) );
00148   itkConceptMacro( OutputOStreamWritableCheck,
00149                    ( Concept::OStreamWritable< OutputImagePixelType > ) );
00150   itkConceptMacro( PixelTypeIsFloatingPointCheck,
00151                    ( Concept::IsFloatingPoint< InputImagePixelType > ) );
00152 
00154 #endif
00155 protected:
00156   ZeroCrossingBasedEdgeDetectionImageFilter()
00157   {
00158     m_Variance.Fill(1.0);
00159     m_MaximumError.Fill(0.01);
00160     m_BackgroundValue = NumericTraits< OutputImagePixelType >::Zero;
00161     m_ForegroundValue = NumericTraits< OutputImagePixelType >::One;
00162   }
00164 
00165   ~ZeroCrossingBasedEdgeDetectionImageFilter(){}
00166   void PrintSelf(std::ostream & os, Indent indent) const;
00167 
00174   void GenerateData();
00175 
00176 private:
00177   ZeroCrossingBasedEdgeDetectionImageFilter(const Self &); //purposely not implemented
00178   void operator=(const Self &); //purposely not implemented
00179 
00181   ArrayType m_Variance;
00182 
00185   ArrayType m_MaximumError;
00186 
00187   OutputImagePixelType m_BackgroundValue;
00188   OutputImagePixelType m_ForegroundValue;
00189 };
00190 } //end of namespace itk
00191 
00192 #ifndef ITK_MANUAL_INSTANTIATION
00193 #include "itkZeroCrossingBasedEdgeDetectionImageFilter.hxx"
00194 #endif
00195 
00196 #endif
00197