Orfeo Toolbox  3.16
itkSegmentationLevelSetFunction.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkSegmentationLevelSetFunction.txx,v $
5  Language: C++
6  Date: $Date: 2009-03-03 15:09:09 $
7  Version: $Revision: 1.14 $
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 __itkSegmentationLevelSetFunction_txx
18 #define __itkSegmentationLevelSetFunction_txx
19 
21 
22 namespace itk {
23 
24 template <class TImageType, class TFeatureImageType>
27 {
28  m_SpeedImage = s;
29  m_Interpolator->SetInputImage(m_SpeedImage);
30 }
31 
32 template <class TImageType, class TFeatureImageType>
35 {
36  m_AdvectionImage = s;
37  m_VectorInterpolator->SetInputImage(m_AdvectionImage);
38 }
39 
40 template <class TImageType, class TFeatureImageType>
43 {
44  this->SetPropagationWeight( -1.0 * this->GetPropagationWeight() );
45  this->SetAdvectionWeight( -1.0 * this->GetAdvectionWeight() );
46 }
47 
48 template <class TImageType, class TFeatureImageType>
51 {
52  Superclass::Initialize(r);
53 }
54 
55 template <class TImageType, class TFeatureImageType>
58 {
59  m_SpeedImage->SetRequestedRegion(m_FeatureImage->GetRequestedRegion());
60  m_SpeedImage->SetBufferedRegion(m_FeatureImage->GetBufferedRegion());
61  m_SpeedImage->SetLargestPossibleRegion(m_FeatureImage->GetLargestPossibleRegion());
62  m_SpeedImage->Allocate();
63  m_Interpolator->SetInputImage(m_SpeedImage);
64 }
65 
66 template <class TImageType, class TFeatureImageType>
69 {
70  m_AdvectionImage->SetRequestedRegion(m_FeatureImage->GetRequestedRegion());
71  m_AdvectionImage->SetBufferedRegion(m_FeatureImage->GetBufferedRegion());
72  m_AdvectionImage->SetLargestPossibleRegion(m_FeatureImage->GetLargestPossibleRegion());
73  m_AdvectionImage->Allocate();
74  m_VectorInterpolator->SetInputImage(m_AdvectionImage);
75 }
76 
77 template <class TImageType, class TFeatureImageType>
81  const FloatOffsetType &offset, GlobalDataStruct *) const
82 {
83  IndexType idx = neighborhood.GetIndex();
84 
86  for (unsigned i = 0; i < ImageDimension; ++i)
87  {
88  cdx[i] = static_cast<double>(idx[i]) - offset[i];
89  }
90 
91  if ( m_Interpolator->IsInsideBuffer(cdx) )
92  {
93  return (static_cast<ScalarValueType>(
94  m_Interpolator->EvaluateAtContinuousIndex(cdx)));
95  }
96  else return ( static_cast<ScalarValueType>(m_SpeedImage->GetPixel(idx)) );
97 }
98 
99 template <class TImageType, class TFeatureImageType>
102 ::AdvectionField(const NeighborhoodType &neighborhood,
103  const FloatOffsetType &offset, GlobalDataStruct *) const
104 {
105  IndexType idx = neighborhood.GetIndex();
107  for (unsigned i = 0; i < ImageDimension; ++i)
108  {
109  cdx[i] = static_cast<double>(idx[i]) - offset[i];
110  }
111  if ( m_VectorInterpolator->IsInsideBuffer(cdx) )
112  {
113  return ( m_VectorCast(m_VectorInterpolator->EvaluateAtContinuousIndex(cdx)));
114  }
115  //Just return the default else
116  return ( m_AdvectionImage->GetPixel(idx) );
117 
118 }
119 
120 } // end namespace itk
121 
122 #endif

Generated at Sun Feb 3 2013 00:05:22 for Orfeo Toolbox with doxygen 1.8.1.1