ITK  4.1.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 {
00038 template< class TInputImage, class TOutputImage >
00039 class ITK_EXPORT VotingBinaryImageFilter:
00040   public ImageToImageFilter< TInputImage, TOutputImage >
00041 {
00042 public:
00044   itkStaticConstMacro(InputImageDimension, unsigned int,
00045                       TInputImage::ImageDimension);
00046   itkStaticConstMacro(OutputImageDimension, unsigned int,
00047                       TOutputImage::ImageDimension);
00049 
00051   typedef TInputImage  InputImageType;
00052   typedef TOutputImage OutputImageType;
00053 
00055   typedef VotingBinaryImageFilter                               Self;
00056   typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
00057   typedef SmartPointer< Self >                                  Pointer;
00058   typedef SmartPointer< const Self >                            ConstPointer;
00059 
00061   itkNewMacro(Self);
00062 
00064   itkTypeMacro(VotingBinaryImageFilter, ImageToImageFilter);
00065 
00067   typedef typename InputImageType::PixelType  InputPixelType;
00068   typedef typename OutputImageType::PixelType OutputPixelType;
00069 
00070   typedef typename InputImageType::RegionType  InputImageRegionType;
00071   typedef typename OutputImageType::RegionType OutputImageRegionType;
00072 
00073   typedef typename InputImageType::SizeType InputSizeType;
00074 
00076   itkSetMacro(Radius, InputSizeType);
00077 
00079   itkGetConstReferenceMacro(Radius, InputSizeType);
00080 
00083   itkSetMacro(BackgroundValue, InputPixelType);
00084   itkSetMacro(ForegroundValue, InputPixelType);
00086 
00089   itkGetConstReferenceMacro(BackgroundValue, InputPixelType);
00090   itkGetConstReferenceMacro(ForegroundValue, InputPixelType);
00092 
00095   itkGetConstReferenceMacro(BirthThreshold, unsigned int);
00096   itkSetMacro(BirthThreshold, unsigned int);
00098 
00101   itkGetConstReferenceMacro(SurvivalThreshold, unsigned int);
00102   itkSetMacro(SurvivalThreshold, unsigned int);
00104 
00111   virtual void GenerateInputRequestedRegion()
00112   throw( InvalidRequestedRegionError );
00113 
00114 #ifdef ITK_USE_CONCEPT_CHECKING
00115 
00116   itkConceptMacro( InputEqualityComparableCheck,
00117                    ( Concept::EqualityComparable< InputPixelType > ) );
00118   itkConceptMacro( IntConvertibleToInputCheck,
00119                    ( Concept::Convertible< int, InputPixelType > ) );
00120   itkConceptMacro( InputConvertibleToOutputCheck,
00121                    ( Concept::Convertible< InputPixelType, OutputPixelType > ) );
00122   itkConceptMacro( SameDimensionCheck,
00123                    ( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
00124   itkConceptMacro( InputOStreamWritableCheck,
00125                    ( Concept::OStreamWritable< InputPixelType > ) );
00126 
00128 #endif
00129 protected:
00130   VotingBinaryImageFilter();
00131   virtual ~VotingBinaryImageFilter() {}
00132   void PrintSelf(std::ostream & os, Indent indent) const;
00134 
00145   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00146                             ThreadIdType threadId);
00147 
00148 private:
00149   VotingBinaryImageFilter(const Self &); //purposely not implemented
00150   void operator=(const Self &);          //purposely not implemented
00151 
00152   InputSizeType m_Radius;
00153 
00154   InputPixelType m_ForegroundValue;
00155   InputPixelType m_BackgroundValue;
00156 
00157   unsigned int m_BirthThreshold;
00158   unsigned int m_SurvivalThreshold;
00159 };
00160 } // end namespace itk
00161 
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkVotingBinaryImageFilter.hxx"
00164 #endif
00165 
00166 #endif
00167