ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBinaryMedianImageFilter.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 __itkBinaryMedianImageFilter_h
00019 #define __itkBinaryMedianImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk
00024 {
00048 template< class TInputImage, class TOutputImage >
00049 class ITK_EXPORT BinaryMedianImageFilter:
00050   public ImageToImageFilter< TInputImage, TOutputImage >
00051 {
00052 public:
00054   itkStaticConstMacro(InputImageDimension, unsigned int,
00055                       TInputImage::ImageDimension);
00056   itkStaticConstMacro(OutputImageDimension, unsigned int,
00057                       TOutputImage::ImageDimension);
00059 
00061   typedef TInputImage  InputImageType;
00062   typedef TOutputImage OutputImageType;
00063 
00065   typedef BinaryMedianImageFilter                               Self;
00066   typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
00067   typedef SmartPointer< Self >                                  Pointer;
00068   typedef SmartPointer< const Self >                            ConstPointer;
00069 
00071   itkNewMacro(Self);
00072 
00074   itkTypeMacro(BinaryMedianImageFilter, ImageToImageFilter);
00075 
00077   typedef typename InputImageType::PixelType  InputPixelType;
00078   typedef typename OutputImageType::PixelType OutputPixelType;
00079 
00080   typedef typename InputImageType::RegionType  InputImageRegionType;
00081   typedef typename OutputImageType::RegionType OutputImageRegionType;
00082 
00083   typedef typename InputImageType::SizeType InputSizeType;
00084 
00086   itkSetMacro(Radius, InputSizeType);
00087 
00089   itkGetConstReferenceMacro(Radius, InputSizeType);
00090 
00093   itkSetMacro(BackgroundValue, InputPixelType);
00094   itkSetMacro(ForegroundValue, InputPixelType);
00096 
00099   itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
00100   itkGetConstReferenceMacro(ForegroundValue, InputPixelType);
00102 
00109   virtual void GenerateInputRequestedRegion()
00110   throw( InvalidRequestedRegionError );
00111 
00112 #ifdef ITK_USE_CONCEPT_CHECKING
00113 
00114   itkConceptMacro( InputEqualityComparableCheck,
00115                    ( Concept::EqualityComparable< typename TInputImage::PixelType > ) );
00116   itkConceptMacro( InputConvertibleToOutputCheck,
00117                    ( Concept::Convertible< typename TInputImage::PixelType,
00118                                            typename TOutputImage::PixelType > ) );
00119   itkConceptMacro( SameDimensionCheck,
00120                    ( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
00121   itkConceptMacro( InputOStreamWritableCheck,
00122                    ( Concept::OStreamWritable< typename TInputImage::PixelType > ) );
00123 
00125 #endif
00126 protected:
00127   BinaryMedianImageFilter();
00128   virtual ~BinaryMedianImageFilter() {}
00129   void PrintSelf(std::ostream & os, Indent indent) const;
00131 
00142   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00143                             ThreadIdType threadId);
00144 
00145 private:
00146   BinaryMedianImageFilter(const Self &); //purposely not implemented
00147   void operator=(const Self &);          //purposely not implemented
00148 
00149   InputSizeType m_Radius;
00150 
00151   InputPixelType m_ForegroundValue;
00152   InputPixelType m_BackgroundValue;
00153 };
00154 } // end namespace itk
00155 
00156 #ifndef ITK_MANUAL_INSTANTIATION
00157 #include "itkBinaryMedianImageFilter.hxx"
00158 #endif
00159 
00160 #endif
00161