ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkVotingBinaryImageFilter.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 __itkVotingBinaryImageFilter_h
00019 #define __itkVotingBinaryImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk
00024 {
00037 template< class TInputImage, class TOutputImage >
00038 class ITK_EXPORT VotingBinaryImageFilter:
00039   public ImageToImageFilter< TInputImage, TOutputImage >
00040 {
00041 public:
00043   itkStaticConstMacro(InputImageDimension, unsigned int,
00044                       TInputImage::ImageDimension);
00045   itkStaticConstMacro(OutputImageDimension, unsigned int,
00046                       TOutputImage::ImageDimension);
00048 
00050   typedef TInputImage  InputImageType;
00051   typedef TOutputImage OutputImageType;
00052 
00054   typedef VotingBinaryImageFilter                               Self;
00055   typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
00056   typedef SmartPointer< Self >                                  Pointer;
00057   typedef SmartPointer< const Self >                            ConstPointer;
00058 
00060   itkNewMacro(Self);
00061 
00063   itkTypeMacro(VotingBinaryImageFilter, ImageToImageFilter);
00064 
00066   typedef typename InputImageType::PixelType  InputPixelType;
00067   typedef typename OutputImageType::PixelType OutputPixelType;
00068 
00069   typedef typename InputImageType::RegionType  InputImageRegionType;
00070   typedef typename OutputImageType::RegionType OutputImageRegionType;
00071 
00072   typedef typename InputImageType::SizeType InputSizeType;
00073 
00075   itkSetMacro(Radius, InputSizeType);
00076 
00078   itkGetConstReferenceMacro(Radius, InputSizeType);
00079 
00082   itkSetMacro(BackgroundValue, InputPixelType);
00083   itkSetMacro(ForegroundValue, InputPixelType);
00085 
00088   itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
00089   itkGetConstReferenceMacro(ForegroundValue, InputPixelType);
00091 
00094   itkGetConstReferenceMacro(BirthThreshold, unsigned int);
00095   itkSetMacro(BirthThreshold, unsigned int);
00097 
00100   itkGetConstReferenceMacro(SurvivalThreshold, unsigned int);
00101   itkSetMacro(SurvivalThreshold, unsigned int);
00103 
00110   virtual void GenerateInputRequestedRegion()
00111   throw( InvalidRequestedRegionError );
00112 
00113 #ifdef ITK_USE_CONCEPT_CHECKING
00114 
00115   itkConceptMacro( InputEqualityComparableCheck,
00116                    ( Concept::EqualityComparable< InputPixelType > ) );
00117   itkConceptMacro( IntConvertibleToInputCheck,
00118                    ( Concept::Convertible< int, InputPixelType > ) );
00119   itkConceptMacro( InputConvertibleToOutputCheck,
00120                    ( Concept::Convertible< InputPixelType, OutputPixelType > ) );
00121   itkConceptMacro( SameDimensionCheck,
00122                    ( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
00123   itkConceptMacro( InputOStreamWritableCheck,
00124                    ( Concept::OStreamWritable< InputPixelType > ) );
00125 
00127 #endif
00128 protected:
00129   VotingBinaryImageFilter();
00130   virtual ~VotingBinaryImageFilter() {}
00131   void PrintSelf(std::ostream & os, Indent indent) const;
00133 
00144   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00145                             ThreadIdType threadId);
00146 
00147 private:
00148   VotingBinaryImageFilter(const Self &); //purposely not implemented
00149   void operator=(const Self &);          //purposely not implemented
00150 
00151   InputSizeType m_Radius;
00152 
00153   InputPixelType m_ForegroundValue;
00154   InputPixelType m_BackgroundValue;
00155 
00156   unsigned int m_BirthThreshold;
00157   unsigned int m_SurvivalThreshold;
00158 };
00159 } // end namespace itk
00160 
00161 #ifndef ITK_MANUAL_INSTANTIATION
00162 #include "itkVotingBinaryImageFilter.hxx"
00163 #endif
00164 
00165 #endif
00166