ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodInnerProduct.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 __itkNeighborhoodInnerProduct_h
00019 #define __itkNeighborhoodInnerProduct_h
00020 
00021 #include "itkNeighborhoodIterator.h"
00022 #include "itkConstSliceIterator.h"
00023 #include "itkImageBoundaryCondition.h"
00024 
00025 namespace itk
00026 {
00047 template< class TImage, class TOperator = typename TImage::PixelType, class TComputation = TOperator >
00048 class ITK_EXPORT NeighborhoodInnerProduct
00049 {
00050 public:
00052   typedef NeighborhoodInnerProduct Self;
00053 
00055   typedef typename TImage::PixelType ImagePixelType;
00056   typedef TOperator                  OperatorPixelType;
00057   typedef TComputation               OutputPixelType;
00058 
00060   itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
00061 
00063   typedef Neighborhood< OperatorPixelType,
00064                         itkGetStaticConstMacro(ImageDimension) > OperatorType;
00065 
00066   typedef Neighborhood< ImagePixelType,
00067                         itkGetStaticConstMacro(ImageDimension) > NeighborhoodType;
00068 
00070   OutputPixelType operator()(const std::slice & s,
00071                              const ConstNeighborhoodIterator< TImage > & it,
00072                              const OperatorType & op) const;
00073 
00074   OutputPixelType operator()(const ConstNeighborhoodIterator< TImage > & it,
00075                              const OperatorType & op) const
00076   {
00077     return this->operator()(std::slice(0, it.Size(), 1), it, op);
00078   }
00079 
00080   OutputPixelType operator()(const std::slice & s,
00081                              const NeighborhoodType & N,
00082                              const OperatorType & op) const;
00083 
00084   OutputPixelType operator()(const NeighborhoodType & N,
00085                              const OperatorType & op) const
00086   {
00087     return this->operator()(std::slice(0, N.Size(), 1), N, op);
00088   }
00089 };
00090 } // end namespace itk
00091 
00092 // Define instantiation macro for this template.
00093 #define ITK_TEMPLATE_NeighborhoodInnerProduct(_, EXPORT, TypeX, TypeY)     \
00094   namespace itk                                                            \
00095   {                                                                        \
00096   _( 3 ( class EXPORT NeighborhoodInnerProduct< ITK_TEMPLATE_3 TypeX > ) ) \
00097   namespace Templates                                                      \
00098   {                                                                        \
00099   typedef NeighborhoodInnerProduct< ITK_TEMPLATE_3 TypeX >                 \
00100   NeighborhoodInnerProduct##TypeY;                                       \
00101   }                                                                        \
00102   }
00103 
00104 #if ITK_TEMPLATE_EXPLICIT
00105 #include "Templates/itkNeighborhoodInnerProduct+-.h"
00106 #endif
00107 
00108 #if ITK_TEMPLATE_TXX
00109 #include "itkNeighborhoodInnerProduct.hxx"
00110 #endif
00111 
00112 /*
00113 #ifndef ITK_MANUAL_INSTANTIATION
00114 #include "itkNeighborhoodInnerProduct.hxx"
00115 #endif
00116 */
00117 
00118 #endif
00119