18 #ifndef __otbMaskMuParserFilter_txx
19 #define __otbMaskMuParserFilter_txx
27 #include "itkNumericTraits.h"
34 template<
class TInputImage,
class TOutputImage,
class TFunction>
39 m_ThreadUnderflow.SetSize(1);
40 m_ThreadOverflow.SetSize(1);
45 template<
class TInputImage,
class TOutputImage,
class TFunction>
51 template<
class TInputImage,
class TOutputImage,
class TFunction>
54 Superclass::PrintSelf(os, indent);
56 os << indent <<
"Expression: " << m_Expression << std::endl;
59 template<
class TInputImage,
class TOutputImage,
class TFunction>
62 if (m_Expression != expression) m_Expression = expression;
66 template<
class TInputImage,
class TOutputImage,
class TFunction>
72 template<
class TInputImage,
class TOutputImage,
class TFunction>
75 std::vector<std::string> varList;
77 tempFunctor->SetExpression(m_Expression);
82 functor(this->GetInput()->GetPixel(this->GetInput()->GetBufferedRegion().GetIndex()));
86 itkDebugMacro(<< err);
89 const std::map<std::string, double*>& varMap = functor.GetVar();
90 std::map<std::string, double*>::const_iterator it;
91 for (it = varMap.begin(); it != varMap.end(); ++it)
93 varList.push_back( it->first );
99 template<
class TInputImage,
class TOutputImage,
class TFunction>
103 tempFunctor->SetExpression(m_Expression);
109 functor(this->GetInput()->GetPixel(this->GetInput()->GetBufferedRegion().GetIndex()));
113 itkDebugMacro(<< err);
116 return functor.GetFunList();
119 template<
class TInputImage,
class TOutputImage,
class TFunction>
123 checkFunctor->SetExpression(m_Expression);
129 functor(this->GetInput()->GetPixel(this->GetInput()->GetBufferedRegion().GetIndex()));
133 itkDebugMacro(<< err);
142 template<
class TInputImage,
class TOutputImage,
class TFunction>
146 typename std::vector<FunctorPointer>::iterator itFunctor;
147 unsigned int nbThreads = this->GetNumberOfThreads();
148 unsigned int thread_index;
149 std::ostringstream varName;
152 m_ThreadUnderflow.SetSize(nbThreads);
153 m_ThreadUnderflow.Fill(0);
154 m_ThreadOverflow.SetSize(nbThreads);
155 m_ThreadOverflow.Fill(0);
156 m_VFunctor.resize(nbThreads);
158 for (itFunctor = m_VFunctor.begin(); itFunctor < m_VFunctor.end(); itFunctor++)
159 *itFunctor = FunctorType::New();
161 for (thread_index = 0; thread_index < nbThreads; thread_index++)
163 m_VFunctor.at(thread_index)->SetExpression(m_Expression);
168 template<
class TInputImage,
class TOutputImage,
class TFunction>
181 this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
196 outputIt.
Set(functor(inputIt.
Get()));
199 progress.CompletedPixel();
203 template<
class TInputImage,
class TOutputImage,
class TFunction>