21 #ifndef otbLineRatioDetectorImageFilter_hxx
22 #define otbLineRatioDetectorImageFilter_hxx
27 #include "itkDataObject.h"
28 #include "itkConstNeighborhoodIterator.h"
29 #include "itkNeighborhoodInnerProduct.h"
30 #include "itkImageRegionIterator.h"
31 #include "itkNeighborhoodAlgorithm.h"
32 #include "itkProgressReporter.h"
41 template <
class TInputImage,
class TOutputImage,
class TOutputImageDirection,
class TInterpolator>
44 this->m_Radius.Fill(1);
45 this->m_LengthLine = 1;
46 this->m_WidthLine = 0;
47 this->m_FaceList.Fill(0);
51 template <
class TInputImage,
class TOutputImage,
class TOutputImageDirection,
class TInterpolator>
53 std::vector<double>* m2,
54 std::vector<double>* m3)
61 std::vector<double>::iterator m1It = m1->begin();
62 std::vector<double>::iterator m1End = m1->end();
64 std::vector<double>::iterator m2It = m2->begin();
65 std::vector<double>::iterator m2End = m2->end();
67 std::vector<double>::iterator m3It = m3->begin();
68 std::vector<double>::iterator m3End = m3->end();
70 while (m1It != m1End && m2It != m2End && m3It != m3End)
90 double epsilon = 0.0000000001;
91 if ((std::abs(M1) > epsilon) && (std::abs(M2) > epsilon))
92 R12 =
static_cast<double>(1 - std::min((M1 / M2), (M2 / M1)));
93 else if ((std::abs(M1) > epsilon) || (std::abs(M2) > epsilon))
98 if ((std::abs(M1) > epsilon) && (std::abs(M3) > epsilon))
99 R13 =
static_cast<double>(1 - std::min((M1 / M3), (M3 / M1)));
100 else if ((std::abs(M1) > epsilon) || (std::abs(M3) > epsilon))
106 return static_cast<double>(std::min(R12, R13));
112 template <
class TInputImage,
class TOutputImage,
class TOutputImageDirection,
class TInterpolator>
115 Superclass::PrintSelf(os, indent);