25 #ifndef CLIP_MIN_MAX_HH_
26 #define CLIP_MIN_MAX_HH_
28 namespace ost {
namespace img {
namespace alg {
39 bool cbigger<Complex>(
Complex& v,
Real rv,
const Complex& cv) {
return std::abs(v)>=std::abs(cv);}
44 return static_cast<Real>(v)>=rv;
53 T get_t(
Real rv,
const Complex& cv){
return static_cast<T
>(rv);}
55 struct ClipMinMaxFnc {
56 explicit ClipMinMaxFnc() { set_rl(0.0); set_ru(1.0); }
57 explicit ClipMinMaxFnc(
Real l,
Real u) {set_rl(l);set_ru(u);}
58 explicit ClipMinMaxFnc(
const Complex& l,
const Complex& u) {set_cl(l);set_cu(u);}
60 void SetThresholds(
Real l,
Real u) {set_rl(l);set_ru(u);}
61 void SetThresholds(
const Complex& l,
const Complex& u) {set_cl(l);set_cu(u);}
63 template <
typename T,
class D>
64 void VisitState(ImageStateImpl<T,D>& isi)
const {
65 for(T* p = isi.Data().GetData(); p<isi.Data().GetEnd();++p) {
70 static String GetAlgorithmName() {
return "ClipMinMax";}
87 typedef ImageStateConstModIPAlgorithm<ClipMinMaxFnc>
ClipMinMax;