ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkZeroCrossingImageFilter.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 __itkZeroCrossingImageFilter_h
00019 #define __itkZeroCrossingImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 namespace itk
00023 {
00062 template< class TInputImage, class TOutputImage >
00063 class ITK_EXPORT ZeroCrossingImageFilter:
00064   public ImageToImageFilter< TInputImage, TOutputImage >
00065 {
00066 public:
00068   typedef ZeroCrossingImageFilter                         Self;
00069   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00070 
00072   typedef TInputImage  InputImageType;
00073   typedef TOutputImage OutputImageType;
00074 
00076   typedef SmartPointer< Self >       Pointer;
00077   typedef SmartPointer< const Self > ConstPointer;
00078 
00080   typedef typename TInputImage::PixelType  InputImagePixelType;
00081   typedef typename TOutputImage::PixelType OutputImagePixelType;
00082 
00084   itkNewMacro(Self);
00085 
00087   typedef typename TOutputImage::RegionType OutputImageRegionType;
00088 
00090   itkTypeMacro(ZeroCrossingImageFilter, ImageToImageFilter);
00091 
00093   itkStaticConstMacro(ImageDimension, unsigned int,
00094                       TInputImage::ImageDimension);
00095   itkStaticConstMacro(OutputImageDimension, unsigned int,
00096                       TOutputImage::ImageDimension);
00098 
00107   virtual void GenerateInputRequestedRegion()
00108   throw( InvalidRequestedRegionError );
00109 
00111   itkSetMacro(ForegroundValue, OutputImagePixelType);
00112   itkGetConstMacro(ForegroundValue, OutputImagePixelType);
00114 
00116   itkSetMacro(BackgroundValue, OutputImagePixelType);
00117   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00119 
00120 #ifdef ITK_USE_CONCEPT_CHECKING
00121 
00122   itkConceptMacro( OutputEqualityComparableCheck,
00123                    ( Concept::EqualityComparable< OutputImagePixelType > ) );
00124   itkConceptMacro( SameDimensionCheck,
00125                    ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
00126   itkConceptMacro( InputComparableCheck,
00127                    ( Concept::Comparable< InputImagePixelType > ) );
00128   itkConceptMacro( OutputOStreamWritableCheck,
00129                    ( Concept::OStreamWritable< OutputImagePixelType > ) );
00130 
00132 #endif
00133 protected:
00134   ZeroCrossingImageFilter()
00135   {
00136     m_ForegroundValue = NumericTraits< OutputImagePixelType >::One;
00137     m_BackgroundValue = NumericTraits< OutputImagePixelType >::Zero;
00138   }
00139 
00140   ~ZeroCrossingImageFilter(){}
00141   void PrintSelf(std::ostream & os, Indent indent) const;
00142 
00143   OutputImagePixelType m_BackgroundValue;
00144   OutputImagePixelType m_ForegroundValue;
00145 
00157   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00158                             ThreadIdType threadId);
00159 private:
00160   ZeroCrossingImageFilter(const Self &); //purposely not implemented
00161   void operator=(const Self &); //purposely not implemented
00163 
00164 };
00165 } //end of namespace itk
00166 
00167 #ifndef ITK_MANUAL_INSTANTIATION
00168 #include "itkZeroCrossingImageFilter.hxx"
00169 #endif
00170 
00171 #endif
00172