KWStyle - itkVectorNeighborhoodInnerProduct.txx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkVectorNeighborhoodInnerProduct.txx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:49 $
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 DEF #ifndef _itkVectorNeighborhoodInnerProduct_txx
18 DEF #define _itkVectorNeighborhoodInnerProduct_txx
19 #include "itkVectorNeighborhoodInnerProduct.h"
20
21
22 namespace itk {
23
24 template<class TImage>
25 typename VectorNeighborhoodInnerProduct<TImage>::PixelType
26 VectorNeighborhoodInnerProduct<TImage>
27 ::operator()(const std::slice &s,
28              const ConstNeighborhoodIterator<TImage> &it,
29              const OperatorType &op) const
30 {
31   PixelType sum;
32   unsigned int j;
33   
34   typename OperatorType::ConstIterator o_it;
35
36   for (j = 0; j < VectorDimension; ++j)
37     { sum[j] = NumericTraits<ScalarValueType>::Zero; }
38   
39   o_it = op.Begin();
40   const typename OperatorType::ConstIterator op_end = op.End();
41
42   const unsigned int start  = static_cast<unsigned int>( s.start() );
43   const unsigned int stride = static_cast<unsigned int>( s.stride() );
44   for ( unsigned int i = start; o_it < op_end; i+=stride, ++o_it )
45     {
46     for (j = 0; j< VectorDimension; ++j)
47       {  sum[j] += *o_it * (it.GetPixel(i))[j]; }
48     }
49   
50   return sum;
51 }
52
53
54 template<class TImage>
55 typename VectorNeighborhoodInnerProduct<TImage>::PixelType
56 VectorNeighborhoodInnerProduct<TImage>
57 ::operator()(const std::slice &s,
58              const NeighborhoodType &it,
59              const OperatorType &op) const
60 {
61   PixelType sum;
62   unsigned int j;
63   
64   typename OperatorType::ConstIterator o_it;
65
66   for (j = 0; j < VectorDimension; ++j)
67     { sum[j] = NumericTraits<ScalarValueType>::Zero; }
68   
69   o_it = op.Begin();
70   const typename OperatorType::ConstIterator op_end = op.End();
71
72   const unsigned int start  = static_cast<unsigned int>( s.start() );
73   const unsigned int stride = static_cast<unsigned int>( s.stride() );
74   for ( unsigned int i = start; o_it < op_end; i+=stride, ++o_it )
75     {
76     for (j = 0; j< VectorDimension; ++j)
77       {  sum[j] += *o_it * it[i][j]; }
78     }
79   
80   return sum;
81
82
83
84 EML
85 }// end namespace itk
86 #endif
87

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:53PM
© Kitware Inc.