28 namespace ost {
namespace img {
namespace alg {
39 bool bigger<Complex>(
Complex& v,
Real rv,
const Complex& cv) {
return std::abs(v)>=std::abs(cv);}
44 return static_cast<Real>(v)>=rv;
48 explicit ThresholdFnc():
r_fv_(0.0) { set_rval(0.0); }
49 explicit ThresholdFnc(
Real f) {set_rval(f);}
50 explicit ThresholdFnc(
const Complex& f) {set_cval(f);}
52 void SetThreshold(
Real f) {set_rval(f);}
53 void SetThreshold(
const Complex& f) {set_cval(f);}
55 template <
typename T,
class D>
56 void VisitState(ImageStateImpl<T,D>& isi)
const {
57 static const T zero=T();
58 static const T one=T(1);
59 for(T* p = isi.Data().GetData(); p<isi.Data().GetEnd();++p) {
64 static String GetAlgorithmName() {
return "Threshold";}
76 typedef ImageStateConstModIPAlgorithm<ThresholdFnc>
Threshold;