| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkNeighborhoodInnerProduct.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:42 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
|
#ifndef __itkNeighborhoodInnerProduct_h |
| 18 |
|
#define __itkNeighborhoodInnerProduct_h |
| 19 |
|
|
| 20 |
|
#include "itkNeighborhoodIterator.h" |
| 21 |
|
#include "itkNeighborhood.h" |
| 22 |
|
#include "itkConstSliceIterator.h" |
| 23 |
|
#include "itkImageBoundaryCondition.h" |
| 24 |
|
|
| 25 |
|
namespace itk { |
| 26 |
|
|
| 27 |
|
/** \class NeighborhoodInnerProduct |
| 28 |
|
* |
| 29 |
|
* This class defines the inner product operation between an |
| 30 |
WCM |
* itk::Neighborhood and and itk::NeighborhoodOperator. The |
| 31 |
|
* operator() method is overloaded to support various types of |
| 32 |
|
* neighborhoods as well as inner products with slices of |
| 33 |
|
* neighborhoods. The second template parameter allows you to set the |
| 34 |
|
* value type of the operator. The third templage parameter allows you |
| 35 |
|
* to set the value type used as the return type of the inner product |
| 36 |
|
* calculation. The operator value type defaults to the image pixel |
| 37 |
|
* type and the output value type defaults to the operator type. |
| 38 |
|
* |
| 39 |
|
* \ingroup Operators |
| 40 |
|
*/ |
| 41 |
|
|
| 42 |
LEN |
template<class TImage, class TOperator=ITK_TYPENAME TImage::PixelType, class TComputation=TOperator> |
| 43 |
|
class ITK_EXPORT NeighborhoodInnerProduct |
| 44 |
|
{ |
| 45 |
|
public: |
| 46 |
|
/** Standard typedefs */ |
| 47 |
|
typedef NeighborhoodInnerProduct Self; |
| 48 |
|
|
| 49 |
|
/** Capture some typedefs from the template parameters. */ |
| 50 |
|
typedef typename TImage::PixelType ImagePixelType; |
| 51 |
TDA |
typedef TOperator OperatorPixelType; |
| 52 |
TDA |
typedef TComputation OutputPixelType; |
| 53 |
|
|
| 54 |
|
/** Capture some typedefs from the template parameters. */ |
| 55 |
|
itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension); |
| 56 |
|
|
| 57 |
|
/** Operator typedef */ |
| 58 |
|
typedef Neighborhood<OperatorPixelType, |
| 59 |
|
itkGetStaticConstMacro(ImageDimension)> OperatorType; |
| 60 |
|
|
| 61 |
|
typedef Neighborhood<ImagePixelType, |
| 62 |
|
itkGetStaticConstMacro(ImageDimension)> NeighborhoodType; |
| 63 |
|
|
| 64 |
|
/** Reference oeprator. */ |
| 65 |
|
OutputPixelType operator()(const std::slice &s, |
| 66 |
|
const ConstNeighborhoodIterator<TImage> &it, |
| 67 |
|
const OperatorType &op) const; |
| 68 |
|
OutputPixelType operator()(const ConstNeighborhoodIterator<TImage> &it, |
| 69 |
|
const OperatorType &op) const |
| 70 |
|
{ |
| 71 |
IND |
******return this->operator()(std::slice(0, it.Size(), 1), it, op); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
OutputPixelType operator()(const std::slice &s, |
| 76 |
|
const NeighborhoodType &N, |
| 77 |
|
const OperatorType &op) const; |
| 78 |
|
|
| 79 |
|
OutputPixelType operator()(const NeighborhoodType &N, |
| 80 |
|
const OperatorType &op) const |
| 81 |
|
{ |
| 82 |
IND |
******return this->operator()(std::slice(0, N.Size(), 1), N, op); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
|
| 86 |
EML |
|
| 87 |
|
}; |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
} // end namespace itk |
| 94 |
|
|
| 95 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 96 |
|
#include "itkNeighborhoodInnerProduct.txx" |
| 97 |
|
#endif |
| 98 |
|
|
| 99 |
|
#endif |
| 100 |
|
|