ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodBinaryThresholdImageFunction.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 __itkNeighborhoodBinaryThresholdImageFunction_h
00019 #define __itkNeighborhoodBinaryThresholdImageFunction_h
00020 
00021 #include "itkBinaryThresholdImageFunction.h"
00022 
00023 namespace itk
00024 {
00041 template< class TInputImage, class TCoordRep = float >
00042 class ITK_EXPORT NeighborhoodBinaryThresholdImageFunction:
00043   public BinaryThresholdImageFunction< TInputImage, TCoordRep >
00044 {
00045 public:
00046 
00048   typedef NeighborhoodBinaryThresholdImageFunction               Self;
00049   typedef BinaryThresholdImageFunction< TInputImage, TCoordRep > Superclass;
00050   typedef SmartPointer< Self >                                   Pointer;
00051   typedef SmartPointer< const Self >                             ConstPointer;
00052 
00054   itkTypeMacro(NeighborhoodBinaryThresholdImageFunction, BinaryThresholdImageFunction);
00055 
00057   itkNewMacro(Self);
00058 
00060   typedef TInputImage InputImageType;
00061 
00063   typedef typename Superclass::OutputType OutputType;
00064 
00066   typedef typename Superclass::IndexType IndexType;
00067 
00069   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00070 
00072   typedef typename Superclass::PointType PointType;
00073 
00075   typedef typename Superclass::PixelType PixelType;
00076 
00078   itkStaticConstMacro(ImageDimension, unsigned int,
00079                       InputImageType::ImageDimension);
00080 
00082   typedef typename InputImageType::SizeType InputSizeType;
00083 
00085   itkSetMacro(Radius, InputSizeType);
00086 
00088   itkGetConstReferenceMacro(Radius, InputSizeType);
00089 
00091   virtual bool EvaluateAtIndex(const IndexType & index) const;
00092 
00094   virtual bool Evaluate(const PointType & point) const
00095   {
00096     IndexType index;
00097 
00098     this->ConvertPointToNearestIndex(point, index);
00099     return this->EvaluateAtIndex(index);
00100   }
00101 
00102   virtual bool EvaluateAtContinuousIndex(
00103     const ContinuousIndexType & cindex) const
00104   {
00105     IndexType index;
00106 
00107     this->ConvertContinuousIndexToNearestIndex(cindex, index);
00108     return this->EvaluateAtIndex(index);
00109   }
00110 
00111 protected:
00112   NeighborhoodBinaryThresholdImageFunction();
00113   ~NeighborhoodBinaryThresholdImageFunction(){}
00114   void PrintSelf(std::ostream & os, Indent indent) const;
00115 
00116 private:
00117   NeighborhoodBinaryThresholdImageFunction(const Self &); //purposely not
00118                                                           // implemented
00119   void operator=(const Self &);                           //purposely not
00120 
00121   // implemented
00122 
00123   InputSizeType m_Radius;
00124 };
00125 } // end namespace itk
00126 
00127 // Define instantiation macro for this template.
00128 #define ITK_TEMPLATE_NeighborhoodBinaryThresholdImageFunction(_, EXPORT, TypeX, TypeY)     \
00129   namespace itk                                                                            \
00130   {                                                                                        \
00131   _( 2 ( class EXPORT NeighborhoodBinaryThresholdImageFunction< ITK_TEMPLATE_2 TypeX > ) ) \
00132   namespace Templates                                                                      \
00133   {                                                                                        \
00134   typedef NeighborhoodBinaryThresholdImageFunction< ITK_TEMPLATE_2 TypeX >                 \
00135   NeighborhoodBinaryThresholdImageFunction##TypeY;                                       \
00136   }                                                                                        \
00137   }
00138 
00139 #if ITK_TEMPLATE_EXPLICIT
00140 #include "Templates/itkNeighborhoodBinaryThresholdImageFunction+-.h"
00141 #endif
00142 
00143 #if ITK_TEMPLATE_TXX
00144 #include "itkNeighborhoodBinaryThresholdImageFunction.hxx"
00145 #endif
00146 
00147 /*
00148 #ifndef ITK_MANUAL_INSTANTIATION
00149 #include "itkNeighborhoodBinaryThresholdImageFunction.hxx"
00150 #endif
00151 */
00152 
00153 #endif
00154