ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodOperatorImageFunction.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 __itkNeighborhoodOperatorImageFunction_h
00019 #define __itkNeighborhoodOperatorImageFunction_h
00020 
00021 #include "itkImageFunction.h"
00022 #include "itkNeighborhood.h"
00023 
00024 namespace itk
00025 {
00040 template< class TInputImage, class TOutput >
00041 class ITK_EXPORT NeighborhoodOperatorImageFunction:
00042   public ImageFunction< TInputImage, TOutput >
00043 {
00044 public:
00045 
00047   typedef NeighborhoodOperatorImageFunction Self;
00048 
00050   typedef ImageFunction< TInputImage, TOutput > Superclass;
00051 
00053   typedef SmartPointer< Self >       Pointer;
00054   typedef SmartPointer< const Self > ConstPointer;
00055 
00057   itkNewMacro(Self);
00058 
00060   typedef TInputImage                              InputImageType;
00061   typedef typename InputImageType::PixelType       InputPixelType;
00062   typedef typename Superclass::IndexType           IndexType;
00063   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00064 
00066   itkTypeMacro(NeighborhoodOperatorImageFunction, ImageFunction);
00067 
00069   itkStaticConstMacro(ImageDimension, unsigned int,
00070                       InputImageType::ImageDimension);
00071 
00072   typedef Neighborhood< TOutput, itkGetStaticConstMacro(ImageDimension) > NeighborhoodType;
00073 
00075   typedef typename Superclass::PointType PointType;
00076 
00078   //virtual void SetInputImage( InputImageType * ptr );
00079 
00083   void SetOperator(const NeighborhoodType & p) const
00084   {
00085     m_Operator = p;
00086     this->Modified();
00087   }
00089 
00092   virtual TOutput Evaluate(const PointType &) const
00093   {
00094     std::cout << "NeighborhoodOperatorImageFunction::Evaluate(): Not implemented!" << std::endl;
00095     TOutput out;
00096     out = 0;
00097     return out;
00098   }
00100 
00102   virtual TOutput EvaluateAtIndex(const IndexType & index) const;
00103 
00106   virtual TOutput EvaluateAtContinuousIndex(
00107     const ContinuousIndexType &) const
00108   {
00109     std::cout << "NeighborhoodOperatorImageFunction::EvaluateAtContinuousIndex():Not implemented!" << std::endl;
00110     TOutput out;
00111     out = 0;
00112     return out;
00113   }
00115 
00116 protected:
00117   NeighborhoodOperatorImageFunction();
00118   NeighborhoodOperatorImageFunction(const Self &){}
00119 
00120   ~NeighborhoodOperatorImageFunction(){}
00121 
00122   void operator=(const Self &){}
00123   void PrintSelf(std::ostream & os, Indent indent) const;
00124 
00125 private:
00126 
00127   mutable NeighborhoodType m_Operator;
00128 };
00129 } // end namespace itk
00130 
00131 // Define instantiation macro for this template.
00132 #define ITK_TEMPLATE_NeighborhoodOperatorImageFunction(_, EXPORT, TypeX, TypeY)     \
00133   namespace itk                                                                     \
00134   {                                                                                 \
00135   _( 2 ( class EXPORT NeighborhoodOperatorImageFunction< ITK_TEMPLATE_2 TypeX > ) ) \
00136   namespace Templates                                                               \
00137   {                                                                                 \
00138   typedef NeighborhoodOperatorImageFunction< ITK_TEMPLATE_2 TypeX >                 \
00139   NeighborhoodOperatorImageFunction##TypeY;                                       \
00140   }                                                                                 \
00141   }
00142 
00143 #if ITK_TEMPLATE_EXPLICIT
00144 #include "Templates/itkNeighborhoodOperatorImageFunction+-.h"
00145 #endif
00146 
00147 #if ITK_TEMPLATE_TXX
00148 #include "itkNeighborhoodOperatorImageFunction.hxx"
00149 #endif
00150 
00151 /*
00152 #ifndef ITK_MANUAL_INSTANTIATION
00153 #include "itkNeighborhoodOperatorImageFunction.hxx"
00154 #endif
00155 */
00156 
00157 #endif
00158