diff --git a/modules/gui/pymod/export_plot.cc b/modules/gui/pymod/export_plot.cc deleted file mode 100644 index 9091a73139b4bc51b8a04be621c92ef5010dfc7b..0000000000000000000000000000000000000000 --- a/modules/gui/pymod/export_plot.cc +++ /dev/null @@ -1,203 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - Author: Ansgar Philippsen, Andreas Schenk -*/ - -#include <boost/python.hpp> -#include <ost/gui/plot_viewer/plot_viewer_proxy.hh> -#include <ost/gui/plot_viewer/plot_data.hh> -#include <ost/gui/plot_viewer/plot_data_info.hh> -#include <ost/gui/plot_viewer/plot_function_info.hh> -#include <ost/gui/plot_viewer/plot_function.hh> -#include <ost/gui/plot_viewer/plot_group.hh> - -using namespace boost::python; -using namespace ost; -using namespace ost::gui; - -namespace { - -struct PlotFunctionWrap : PlotFunction, wrapper<PlotFunction> -{ - IOProfileWrap(PyObject*&, const ost::io::IOProfile&) - Real Func(Real val) const - { - return this->get_override("Func")(val); - } -}; - - -//PlotDataInfoWrappers -PlotInfoBasePtr plot_info_base_set_mode(PlotInfoBasePtr inptr, unsigned int val ){inptr->SetMode(val);return inptr;} -PlotInfoBasePtr plot_info_base_set_name(PlotInfoBasePtr inptr, const String& s ){inptr->SetName(QString::fromStdString(s));return inptr;} -PlotInfoBasePtr plot_info_base_set_visible(PlotInfoBasePtr inptr, bool val ){inptr->SetVisible(val);return inptr;} -PlotInfoBasePtr plot_info_base_set_color(PlotInfoBasePtr inptr, QColor color){inptr->SetColor(color);return inptr;} -PlotInfoBasePtr plot_info_base_set_color2(PlotInfoBasePtr inptr, int r, int g, int b){inptr->SetColor(r,g,b);return inptr;} -PlotInfoBasePtr plot_info_base_set_linecolor1(PlotInfoBasePtr inptr, QColor color ){inptr->SetLineColor(color);return inptr;} -PlotInfoBasePtr plot_info_base_set_fillcolor1(PlotInfoBasePtr inptr, QColor color){inptr->SetFillColor(color);return inptr;} -PlotInfoBasePtr plot_info_base_set_linecolor2(PlotInfoBasePtr inptr, int r, int g, int b){inptr->SetLineColor(r,g,b);return inptr;} -PlotInfoBasePtr plot_info_base_set_fillcolor2(PlotInfoBasePtr inptr, int r, int g, int b){inptr->SetFillColor(r,g,b);return inptr;} - - - -PlotDataInfoPtr plot_data_info_set_quality(PlotDataInfoPtr inptr, bool val ){inptr->SetQuality(val);return inptr;} -PlotDataInfoPtr plot_data_info_set_symbol(PlotDataInfoPtr inptr, unsigned int val ){inptr->SetSymbol(val);return inptr;} -PlotDataInfoPtr plot_data_info_set_symbolsize(PlotDataInfoPtr inptr, unsigned int val ){inptr->SetSymbolSize(val);return inptr;} -PlotDataInfoPtr plot_data_info_set_errormode(PlotDataInfoPtr inptr, unsigned int val ){inptr->SetErrorMode(val);return inptr;} -PlotDataInfoPtr plot_data_info_set_callback(PlotDataInfoPtr inptr, object cb){inptr->SetCallback(cb);return inptr;} -PlotDataInfoPtr plot_data_info_set_name(PlotDataInfoPtr inptr, const String& name ){inptr->SetName(QString(name.c_str()));return inptr;} - -PlotGroupInfoPtr plot_group_info_set_quality(PlotGroupInfoPtr inptr, bool val ){inptr->SetQuality(val);return inptr;} -PlotGroupInfoPtr plot_group_info_set_name(PlotGroupInfoPtr inptr, const String& name ){inptr->SetName(QString(name.c_str()));return inptr;} -PlotGroupInfoPtr plot_group_info_set_symbol(PlotGroupInfoPtr inptr, unsigned int val ){inptr->SetSymbol(val);return inptr;} -PlotGroupInfoPtr plot_group_info_set_symbolsize(PlotGroupInfoPtr inptr, unsigned int val ){inptr->SetSymbolSize(val);return inptr;} -PlotGroupInfoPtr plot_group_info_set_errormode(PlotGroupInfoPtr inptr, unsigned int val ){inptr->SetErrorMode(val);return inptr;} -PlotGroupInfoPtr plot_group_info_set_callback(PlotGroupInfoPtr inptr, object cb){inptr->SetCallback(cb);return inptr;} - -} // ns - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddY_Overloads,PlotData::AddY, 1, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddYE_Overloads,PlotData::AddYE, 2,3) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddYQ_Overloads,PlotData::AddYQ, 2,3) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddYEQ_Overloads,PlotData::AddYEQ, 3,4) - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddXY_Overloads,PlotData::AddXY, 2,3) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddXYQ_Overloads,PlotData::AddXYQ, 3,4) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddXYE_Overloads,PlotData::AddXYE, 3,4) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddXYEQ_Overloads,PlotData::AddXYEQ, 4,5) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddXEYE_Overloads,PlotData::AddXEYE, 4,5) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotData_AddXEYEQ_Overloads,PlotData::AddXEYEQ, 5,6) - - -void (PlotGroup::*PlotGroup_add1)(PlotDataPtr dataptr)=&PlotGroup::Add; -void (PlotGroup::*PlotGroup_add2)(PlotFunctionPtr functionptr)=&PlotGroup::Add; -void (PlotGroup::*PlotGroup_add3)(PlotGroupPtr groupptr)=&PlotGroup::Add; - -PlotDataInfoPtr (PlotViewerProxy::*PlotViewerProxy_add1)(PlotDataPtr dataptr,bool)=&PlotViewerProxy::Add; -PlotFunctionInfoPtr (PlotViewerProxy::*PlotViewerProxy_add2)(PlotFunctionPtr functionptr)=&PlotViewerProxy::Add; -PlotGroupInfoPtr (PlotViewerProxy::*PlotViewerProxy_add3)(PlotGroupPtr groupptr,bool)=&PlotViewerProxy::Add; - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(PlotViewerProxy_Add_Overloads, Add, 1,2) - -void export_Plot() -{ - class_<PlotFunctionWrap, boost::noncopyable>("PlotFunction") - ; - - class_<PlotInfoBase,PlotInfoBasePtr>("PlotInfoBase",init<>()) - .def("SetMode",plot_info_base_set_mode) - .def("SetName",plot_info_base_set_name) - .def("SetVisible",plot_info_base_set_visible) - .def("SetColor",plot_info_base_set_color) - .def("SetColor",plot_info_base_set_color2) - .def("SetFillColor",plot_info_base_set_fillcolor1) - .def("SetLineColor",plot_info_base_set_linecolor1) - .def("SetFillColor",plot_info_base_set_fillcolor2) - .def("SetLineColor",plot_info_base_set_linecolor2) - ; - - class_<PlotDataInfo,PlotDataInfoPtr, bases<PlotInfoBase> >("PlotDataInfo",init<>()) - .def("SetSymbol",plot_data_info_set_symbol) - .def("SetSymbolSize",plot_data_info_set_symbolsize) - .def("SetErrorMode",plot_data_info_set_errormode) - .def("SetQuality",plot_data_info_set_quality) - .def("SetName", plot_data_info_set_name) - .def("SetCallback",plot_data_info_set_callback) - ; - - class_<PlotGroupInfo,PlotGroupInfoPtr, bases<PlotInfoBase> >("PlotGroupInfo",init<>()) - .def("SetSymbol",plot_group_info_set_symbol) - .def("SetSymbolSize",plot_group_info_set_symbolsize) - .def("SetErrorMode",plot_group_info_set_errormode) - .def("SetQuality",plot_group_info_set_quality) - .def("SetCallback",plot_group_info_set_callback) - ; - - class_<PlotFunctionInfo,PlotFunctionInfoPtr, bases<PlotInfoBase> >("PlotFunctionInfo",init<>()) - ; - - class_<PlotData,PlotDataPtr>("PlotData",init<>()) - .def("AddY",&PlotData::AddY,PlotData_AddY_Overloads()) - .def("AddYQ",&PlotData::AddYE,PlotData_AddYQ_Overloads()) - .def("AddYE",&PlotData::AddYQ,PlotData_AddYE_Overloads()) - .def("AddYEQ",&PlotData::AddYEQ,PlotData_AddYEQ_Overloads()) - .def("AddXY",&PlotData::AddXY,PlotData_AddXY_Overloads()) - .def("AddXYQ",&PlotData::AddXYQ,PlotData_AddXYQ_Overloads()) - .def("AddXYE",&PlotData::AddXYE,PlotData_AddXYE_Overloads()) - .def("AddXYEQ",&PlotData::AddXYEQ,PlotData_AddXYEQ_Overloads()) - .def("AddXEYE",&PlotData::AddXEYE,PlotData_AddXEYE_Overloads()) - .def("AddXEYEQ",&PlotData::AddXEYEQ,PlotData_AddXEYEQ_Overloads()) - .def("GetMinimumX",&PlotData::GetMinimumX) - .def("GetMaximumX",&PlotData::GetMaximumX) - .def("GetMinimumY",&PlotData::GetMinimumY) - .def("GetMaximumY",&PlotData::GetMaximumY) - ; - - class_<PlotGroup,PlotGroupPtr>("PlotGroup",init<>()) - .def("Add",PlotGroup_add1) - .def("Add",PlotGroup_add2) - .def("Add",PlotGroup_add3) - ; - - - {//scope - - scope PlotViewerScope = - class_<PlotViewerProxy,PlotViewerProxyPtr>("PlotViewer", no_init) - .def("Add",PlotViewerProxy_add1,PlotViewerProxy_Add_Overloads()) - .def("Add",PlotViewerProxy_add2) - .def("Add",PlotViewerProxy_add3,PlotViewerProxy_Add_Overloads()) - .def("SetMinimumX", &PlotViewerProxy::SetMinimumX) - .def("SetMaximumX", &PlotViewerProxy::SetMaximumX) - .def("SetMinimumY", &PlotViewerProxy::SetMinimumY) - .def("SetMaximumY", &PlotViewerProxy::SetMaximumY) - .def("GetMinimumX", &PlotViewerProxy::GetMinimumX) - .def("GetMaximumX", &PlotViewerProxy::GetMaximumX) - .def("GetMinimumY", &PlotViewerProxy::GetMinimumY) - .def("GetMaximumY", &PlotViewerProxy::GetMaximumY) - .def("SetAutofit", &PlotViewerProxy::SetAutofit) - ; - - enum_<PlotInfoBase::modes>("modes") - .value("POINTS", PlotDataInfo::POINTS) - .value("LINES", PlotDataInfo::LINES) - .value("POINTSANDLINES", PlotDataInfo::POINTSANDLINES) - .value("AREA", PlotDataInfo::AREA) - .value("POINTSANDAREA", PlotDataInfo::POINTSANDAREA) - .export_values() - ; - enum_<PlotInfoBase::shapes>("shapes") - .value("CIRCLE", PlotDataInfo::CIRCLE) - .value("RECTANGLE", PlotDataInfo::RECTANGLE) - .value("CROSS", PlotDataInfo::CROSS) - .value("DIAGONALCROSS", PlotDataInfo::DIAGONALCROSS) - .export_values() - ; - enum_<PlotInfoBase::errormodes>("errormodes") - .value("NONE", PlotDataInfo::NONE) - .value("LINE", PlotDataInfo::LINE) - .value("BOX", PlotDataInfo::BOX) - .value("VECTOR", PlotDataInfo::VECTOR) - .export_values() - ; - }//scope -} diff --git a/modules/gui/src/data_viewer/img2qt.cc b/modules/gui/src/data_viewer/img2qt.cc index 2194c6030b115e53e230857601d45964bc46e469..fdf5b8cb415b72fa918069162208fea2ff36505e 100644 --- a/modules/gui/src/data_viewer/img2qt.cc +++ b/modules/gui/src/data_viewer/img2qt.cc @@ -70,15 +70,6 @@ public: } - void VisitFunction(const Function& f) - { - for(int y=0;y<img_->size().height();++y) { - for(int x=0;x<img_->size().width();++x) { - int cv=clamp(static_cast<int>(norm_->Convert(f.GetReal(Point(x,y)+off_))),0,255); - img_->setPixel(x,y,qRgb(cv,cv,cv)); - } - } - } static String GetAlgorithmName() {return "Conv0";} diff --git a/modules/img/alg/src/highest_peak_search_3d.cc b/modules/img/alg/src/highest_peak_search_3d.cc index c8e884577be8e601c78c58eecaf1221cb461283e..913586a08a631285f7991f133be8d1890beb5b33 100644 --- a/modules/img/alg/src/highest_peak_search_3d.cc +++ b/modules/img/alg/src/highest_peak_search_3d.cc @@ -173,10 +173,6 @@ template <typename T, class D> peak_collector.ClearPeakList(); } - void HighestPeakSearch3DBase::VisitFunction(const Function& f) - { - throw Error("VisitFunction not implemented"); - } } // ns diff --git a/modules/img/alg/src/highest_peak_search_3d.hh b/modules/img/alg/src/highest_peak_search_3d.hh index d61c8a84753eac1fc67c51b5c4fa6a6081269c6b..1f2bc2fd6dadd91ac58e1d31736357c87314fe8c 100644 --- a/modules/img/alg/src/highest_peak_search_3d.hh +++ b/modules/img/alg/src/highest_peak_search_3d.hh @@ -35,8 +35,6 @@ class DLLEXPORT_IMG_ALG HighestPeakSearch3DBase template <typename T, class D> void VisitState(const ImageStateImpl<T,D>& isi); - void VisitFunction(const Function& f); - static String GetAlgorithmName() {return "HighestPeakSearch3D";} //! Main "return" function returns a list of Peaks diff --git a/modules/img/alg/src/histogram.cc b/modules/img/alg/src/histogram.cc index 6225fd99c017de03e6795c4232eb669b0896b9cb..16d90f3518f722ca71afc402659292715eef08eb 100644 --- a/modules/img/alg/src/histogram.cc +++ b/modules/img/alg/src/histogram.cc @@ -66,18 +66,6 @@ void HistogramBase::VisitState(const ImageStateImpl<T,D>& isi) bins_[bin]++; } } -void HistogramBase::VisitFunction(const Function& fnc) -{ - bins_=Bins(bin_count_,0); - for(ExtentIterator it(fnc.GetExtent());!it.AtEnd(); ++it) { - Real val=fnc.GetReal(it); - val = std::max(min_,val); - val=std::min(max_,val); - int bin = int(floor((val-min_)*cfac_)); - bins_[bin]++; - } -} - } diff --git a/modules/img/alg/src/histogram.hh b/modules/img/alg/src/histogram.hh index 820744d31b01ace41437c9d0293a24f086291dfa..c930ba43a20e118bcd2cbbe953a3c1932fbca052 100644 --- a/modules/img/alg/src/histogram.hh +++ b/modules/img/alg/src/histogram.hh @@ -55,8 +55,6 @@ public: template <typename T, class D> void VisitState(const ImageStateImpl<T,D>& isi); - void VisitFunction(const Function& f); - const Bins& GetBins() const; static String GetAlgorithmName() {return "Histogram";} diff --git a/modules/img/alg/src/stat.cc b/modules/img/alg/src/stat.cc index 01053ab7e28bbccdfaf0a7c4839633246d675995..2623149985969502481659c094ffc6192a43385e 100644 --- a/modules/img/alg/src/stat.cc +++ b/modules/img/alg/src/stat.cc @@ -99,59 +99,6 @@ void StatBase::VisitState(const ImageStateImpl<T,D>& isi) } } -void StatBase::VisitFunction(const Function& fnc) -{ - sum_=0.0; - mean_=0.0; - - Real n = (Real)(fnc.GetSize().GetVol()); - if(n==0.0){ - var_=0.0; - std_dev_=0.0; - min_=0.0; - max_=0.0; - maxpos_=Point(0,0,0), - minpos_=Point(0,0,0), - rms_=0.0; - skewness_=0.0; - kurtosis_=0.0; - center_of_mass_=Vec3(0.0,0.0,0.0); - return; - } - - Vec3 sumcenter(0.0,0.0,0.0); - ValIndex minindex(std::numeric_limits<Real>::max(),Point(0,0,0)); - ValIndex maxindex(-std::numeric_limits<Real>::max(),Point(0,0,0)); - min_ = std::numeric_limits<Real>::max(); - max_ = -std::numeric_limits<Real>::max(); - StatAccumulator<> acc; - - for(ExtentIterator it(fnc.GetExtent());!it.AtEnd(); ++it) { - Real val=fnc.GetReal(it); - ValIndex vi(val,it); - minindex=std::min<ValIndex>(vi,minindex); - maxindex=std::max<ValIndex>(vi,maxindex); - sumcenter+=Point(it).ToVec3()*val; - acc(val); - } - min_=minindex.first; - max_=maxindex.first; - minpos_=minindex.second; - maxpos_=maxindex.second; - var_=acc.GetVariance(); - std_dev_=acc.GetStandardDeviation(); - rms_=acc.GetRootMeanSquare(); - skewness_=acc.GetSkewness(); - kurtosis_= acc.GetKurtosis(); - sum_=acc.GetSum(); - mean_=acc.GetMean(); - if(sum_!=0.0){ - center_of_mass_=sumcenter/sum_; - }else{ - center_of_mass_=Vec3(0.0,0.0,0.0); - } -} - std::ostream& operator<<(std::ostream& o, const Stat& s) { o << "mean=" << s.GetMean() << " "; diff --git a/modules/img/alg/src/stat.hh b/modules/img/alg/src/stat.hh index 47009785a94a72bc50d967cb8be8f99021963181..ba1861621612f2dd9fd6cb2900bda916c843b450 100644 --- a/modules/img/alg/src/stat.hh +++ b/modules/img/alg/src/stat.hh @@ -68,8 +68,6 @@ class DLLEXPORT_IMG_ALG StatBase template <typename T, class D> void VisitState(const ImageStateImpl<T,D>& isi); - void VisitFunction(const Function& f); - static String GetAlgorithmName() {return "Stat";} // other interface diff --git a/modules/img/alg/src/stat_min_max.cc b/modules/img/alg/src/stat_min_max.cc index 3b46db02e0fce3668e78c21386c91cf7f2e57c4c..c6963864462aa53fad855adede023496333fe016 100644 --- a/modules/img/alg/src/stat_min_max.cc +++ b/modules/img/alg/src/stat_min_max.cc @@ -66,28 +66,6 @@ void StatMinMaxBase::VisitState(const ImageStateImpl<T,D>& isi) maxpos_=maxindex.second+isi.GetExtent().GetStart(); } -void StatMinMaxBase::VisitFunction(const Function& fnc) -{ - ValIndex minindex(std::numeric_limits<Real>::max(),Point(0,0,0)); - ValIndex maxindex(-std::numeric_limits<Real>::max(),Point(0,0,0)); - Real n = (Real)(fnc.GetSize().GetVol()); - - if(n==0.0) return; - - min_ = std::numeric_limits<Real>::max(); - max_ = -std::numeric_limits<Real>::max(); - - for(ExtentIterator it(fnc.GetExtent());!it.AtEnd(); ++it) { - Real val=fnc.GetReal(it); - ValIndex vi(val,it); - minindex=std::min<ValIndex>(vi,minindex); - maxindex=std::max<ValIndex>(vi,maxindex); - } - min_=minindex.first; - max_=maxindex.first; - minpos_=minindex.second; - maxpos_=maxindex.second; -} std::ostream& operator<<(std::ostream& o, const StatMinMax& s) { diff --git a/modules/img/alg/src/stat_min_max.hh b/modules/img/alg/src/stat_min_max.hh index b1a89bc81b1f30564c72fe9b88e400830403da85..15d7300bc335a7930d67dcc2f09bb76c72903ff6 100644 --- a/modules/img/alg/src/stat_min_max.hh +++ b/modules/img/alg/src/stat_min_max.hh @@ -56,8 +56,6 @@ class DLLEXPORT_IMG_ALG StatMinMaxBase template <typename T, class D> void VisitState(const ImageStateImpl<T,D>& isi); - void VisitFunction(const Function& f); - static String GetAlgorithmName() {return "StatMinMax";} // other interface diff --git a/modules/img/base/pymod/CMakeLists.txt b/modules/img/base/pymod/CMakeLists.txt index de787d14064aa27fb4f0117e9f9bf3bdac06c596..a14d21e6820ed757b457bc5da7614277bfcb417c 100644 --- a/modules/img/base/pymod/CMakeLists.txt +++ b/modules/img/base/pymod/CMakeLists.txt @@ -2,7 +2,6 @@ set(OST_IMG_PYMOD_SOURCES export_data.cc export_data_algorithm.cc export_extent.cc -export_function.cc export_image_handle.cc export_peak.cc export_phase.cc diff --git a/modules/img/base/pymod/export_data_algorithm.cc b/modules/img/base/pymod/export_data_algorithm.cc index f1f8056c56c582a2dcc702ab16ae34f8812c205e..4fe222395eb9da2c1772c8e79cce852d927fca94 100644 --- a/modules/img/base/pymod/export_data_algorithm.cc +++ b/modules/img/base/pymod/export_data_algorithm.cc @@ -43,11 +43,6 @@ public: virtual void VisitImage(const ConstImageHandle&) { throw(Error("NonModAlgorithm Base: VisitImage not overridden")); } - - virtual void Visit(const Function& f) {VisitFunction(f);} - virtual void VisitFunction(const Function&) { - throw(Error("NonModAlgorithm Base: VisitFunction not overridden")); - } }; class WrapPyNonModAlgorithm: public PyNonModAlgorithm { @@ -59,9 +54,6 @@ public: virtual void VisitImage(const ConstImageHandle& ih) { call_method<void>(self_, "VisitImage", ih); } - virtual void VisitFunction(const Function& f) { - call_method<void>(self_, "VisitFunction", f); - } private: PyObject* const self_; diff --git a/modules/img/base/pymod/export_function.cc b/modules/img/base/pymod/export_function.cc deleted file mode 100644 index 2660574394b0cc909f73573e04fe975cf83d2be5..0000000000000000000000000000000000000000 --- a/modules/img/base/pymod/export_function.cc +++ /dev/null @@ -1,98 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - Author: Ansgar Philippsen -*/ - -#include <boost/python.hpp> -#include <ost/img/function.hh> -using namespace boost::python; - -namespace ost { namespace img { - -class WrapRealFunction: public RealFunction -{ -public: - WrapRealFunction(PyObject* self, const RealFunction& f): - RealFunction(f), - self_(self) {} - - WrapRealFunction(PyObject* self) - : RealFunction(SPATIAL), - self_(self) - { } - WrapRealFunction(PyObject* self, DataDomain domain) - : RealFunction(domain), - self_(self) - { } - virtual Real Func(const Vec3& v) const { - return call_method<Real>(self_,"Func",v); - } - -private: - PyObject* self_; -}; - -class WrapComplexFunction: public ComplexFunction -{ -public: - WrapComplexFunction(PyObject* self, const ComplexFunction& f): - ComplexFunction(f), - self_(self) {} - - WrapComplexFunction(PyObject* self) - : ComplexFunction(SPATIAL), - self_(self) - { } - - WrapComplexFunction(PyObject* self, DataDomain domain) - : ComplexFunction(domain), - self_(self) - { } - virtual Complex Func(const Vec3& v) const { - return call_method<Complex>(self_,"Func",v); - } - -private: - PyObject* self_; -}; - -}} // namespace - -void export_Function() -{ - using namespace ost::img; - using namespace ost; - class_<Function, bases<Data>, boost::noncopyable>("Function", no_init) - .def("SetExtent",&Function::SetExtent) - ; - - class_<RealFunction, WrapRealFunction, bases<Function>, boost::noncopyable>("RealFunction") - .def(init<DataDomain>()) - .def("Func",&RealFunction::Func) - ; - - class_<ComplexFunction, WrapComplexFunction, bases<Function>, boost::noncopyable>("ComplexFunction") - .def(init<DataDomain>()) - .def("Func",&ComplexFunction::Func) - ; - -} diff --git a/modules/img/base/pymod/export_image_handle.cc b/modules/img/base/pymod/export_image_handle.cc index 24aace26cb7b1a4d4945296e592c6ee3cd27d8f5..b85817f32ea97efbd0a5ff9921ccce9b1fd4a02e 100644 --- a/modules/img/base/pymod/export_image_handle.cc +++ b/modules/img/base/pymod/export_image_handle.cc @@ -253,14 +253,6 @@ void export_ImageHandle() .def(Real() * self) .def(self /= Real()) .def(self / Real()) - .def(self += other<Function>()) - .def(self + other<Function>()) - .def(self -= other<Function>()) - .def(self - other<Function>()) - .def(self *= other<Function>()) - .def(self * other<Function>()) - .def(self /= other<Function>()) - .def(self / other<Function>()) ; def("CreateImage",c0); @@ -325,10 +317,6 @@ void export_ConstImageHandle() .def(self * Complex()) .def(Complex() * self) .def(self / Complex()) - .def(self + other<Function>()) - .def(self - other<Function>()) - .def(self * other<Function>()) - .def(self / other<Function>()) ; implicitly_convertible<ImageHandle,ConstImageHandle>(); diff --git a/modules/img/base/pymod/export_image_list.cc b/modules/img/base/pymod/export_image_list.cc index e97b34bff6fd36598a7598727c6dec73775a80ce..50fc5a941ea7108a1271763ab1f602f8135fa14b 100644 --- a/modules/img/base/pymod/export_image_list.cc +++ b/modules/img/base/pymod/export_image_list.cc @@ -86,10 +86,6 @@ void export_ImageList() .def(self -= Real()) .def(self *= Real()) .def(self /= Real()) - .def(self += other<Function>()) - .def(self -= other<Function>()) - .def(self *= other<Function>()) - .def(self /= other<Function>()) ; } diff --git a/modules/img/base/pymod/wrap_img.cc b/modules/img/base/pymod/wrap_img.cc index a23f89745e442a4ecf2c6a060fdcfb79cdac8726..f89f14e95eda56af6de0be53a27bca8db4a6ffbd 100644 --- a/modules/img/base/pymod/wrap_img.cc +++ b/modules/img/base/pymod/wrap_img.cc @@ -39,7 +39,6 @@ using namespace boost::python; void export_Data(); void export_DataAlgorithm(); void export_Extent(); -void export_Function(); void export_ImageHandle(); void export_ImageList(); void export_ConstImageHandle(); @@ -60,7 +59,6 @@ BOOST_PYTHON_MODULE(_ost_img) export_Data(); export_DataAlgorithm(); export_Extent(); - export_Function(); export_ImageHandle(); export_ImageList(); export_ConstImageHandle(); diff --git a/modules/img/base/src/CMakeLists.txt b/modules/img/base/src/CMakeLists.txt index ff5191865fc22a3364106ba0980174417946742b..23e6ea92d7bb9a0ed6dd7452d02b9f306e24099d 100644 --- a/modules/img/base/src/CMakeLists.txt +++ b/modules/img/base/src/CMakeLists.txt @@ -8,8 +8,6 @@ data_algorithm.cc data_observer.cc extent.cc extent_iterator.cc -function_base.cc -function_impl.cc image_factory.cc image_handle.cc image_impl.cc @@ -45,10 +43,6 @@ debug.hh dllexport.hh extent.hh extent_iterator.hh -function.hh -function_base.hh -function_fw.hh -function_impl.hh image.hh image_factory.hh image_fw.hh @@ -61,7 +55,6 @@ mask_visitor.hh normalizer_fw.hh normalizer_impl.hh null_data.hh -null_function.hh observable.hh paste_impl.hh peak.hh diff --git a/modules/img/base/src/algorithm.hh b/modules/img/base/src/algorithm.hh index 68f9cec6ff52975a2f4c7a468897b57352d0bec6..4b00bc04465f48f62dc2764dfbccb670f9b54840 100644 --- a/modules/img/base/src/algorithm.hh +++ b/modules/img/base/src/algorithm.hh @@ -32,7 +32,6 @@ #include "data.hh" #include "data_algorithm.hh" #include "image_handle.hh" -#include "function.hh" #include "extent.hh" #include "size.hh" #include "point.hh" diff --git a/modules/img/base/src/data.hh b/modules/img/base/src/data.hh index fc2401b077ad23f3d410eab8d33a146813f54bd7..3ab5d6063a93e997ff1f94981ffd236f7a3ba2a6 100644 --- a/modules/img/base/src/data.hh +++ b/modules/img/base/src/data.hh @@ -248,7 +248,7 @@ private: - setting the spatial origin - modifying the pixel sampling - It servers mainly as the base class for ImageHandle and Function. + It servers mainly as the base class for ImageHandle. */ class DLLEXPORT_OST_IMG_BASE Data: public ConstData { public: diff --git a/modules/img/base/src/data_algorithm.hh b/modules/img/base/src/data_algorithm.hh index 1cc85d3437dbb4e3d23d709acd82fc49330ba411..02e05ff4cb1ba198c63ee2b134594f526cd40600 100644 --- a/modules/img/base/src/data_algorithm.hh +++ b/modules/img/base/src/data_algorithm.hh @@ -28,7 +28,6 @@ #define IMG_DATA_ALG_H #include <ost/img/module_config.hh> -#include "function_fw.hh" #include "image_fw.hh" /* @@ -69,8 +68,6 @@ class DLLEXPORT_OST_IMG_BASE NonModAlgorithm: public AlgorithmBase public: //! visitor implementation for images virtual void Visit(const ConstImageHandle& i) = 0; - //! visitor implementation for real functions - virtual void Visit(const Function& f) = 0; protected: //! ctor, must be initialized with name diff --git a/modules/img/base/src/image_handle.cc b/modules/img/base/src/image_handle.cc index 92234663c3a0d14a7444373c433d155c68cd90f7..94709ec95172939c64c313df6e5f258acafd2601 100644 --- a/modules/img/base/src/image_handle.cc +++ b/modules/img/base/src/image_handle.cc @@ -572,47 +572,6 @@ ImageHandle& ImageHandle::operator/=(const ConstImageHandle& h) return *this; } -ImageHandle& ImageHandle::operator+=(const Function& h) -{ - try { - ImageStatePtr()->operator+=(h); - } catch(InvalidExtentException&) { - // ignore - } - return *this; -} - -ImageHandle& ImageHandle::operator-=(const Function& h) -{ - try { - ImageStatePtr()->operator-=(h); - } catch(InvalidExtentException&) { - // ignore - } - return *this; -} - -ImageHandle& ImageHandle::operator*=(const Function& h) -{ - try { - ImageStatePtr()->operator*=(h); - } catch(InvalidExtentException&) { - // ignore - } - return *this; -} - -ImageHandle& ImageHandle::operator/=(const Function& h) -{ - try { - ImageStatePtr()->operator/=(h); - } catch(InvalidExtentException&) { - // ignore - } - return *this; -} - - void ImageHandle::Reciproce() { throw Error("Reciproce not implemented"); @@ -989,53 +948,6 @@ ImageHandle operator/(const ConstImageHandle& h1, const ConstImageHandle& h2) return nh; } -ImageHandle operator+(const ConstImageHandle& h1, const Function& h2) -{ - ImageHandle nh=h1.Copy(); - nh+=h2; - return nh; -} -ImageHandle operator-(const ConstImageHandle& h1, const Function& h2) -{ - ImageHandle nh=h1.Copy(); - nh-=h2; - return nh; -} - -ImageHandle operator*(const ConstImageHandle& h1, const Function& h2) -{ - ImageHandle nh=h1.Copy(); - nh*=h2; - return nh; -} - -ImageHandle operator/(const ConstImageHandle& h1, const Function& h2) -{ - ImageHandle nh=h1.Copy(); - nh/=h2; - return nh; -} - -ImageHandle operator+(const Function& h1, const ConstImageHandle& h2) -{ - ImageHandle nh=h2.Copy(); - nh+=h1; - return nh; -} - -ImageHandle operator-(const Function& h1, const ConstImageHandle& h2) -{ - ImageHandle nh=h2.Copy(); - nh+=h1; - return nh; -} - -ImageHandle operator*(const Function& h1, const ConstImageHandle& h2) -{ - ImageHandle nh=h2.Copy(); - nh*=h1; - return nh; -} }} // namespace diff --git a/modules/img/base/src/image_handle.hh b/modules/img/base/src/image_handle.hh index 4acf4e2718c2ee3d56ad80b7d8216d6ca8361731..62ed281d2967872bc44d790c3b7d1e09f94f2ae9 100644 --- a/modules/img/base/src/image_handle.hh +++ b/modules/img/base/src/image_handle.hh @@ -38,7 +38,6 @@ #include "data.hh" #include "observable.hh" #include "data_observer.hh" -#include "function.hh" #include "extent_iterator.hh" #include "image_state/image_state_visitor_fw.hh" @@ -463,11 +462,6 @@ public: ImageHandle& operator*=(const ConstImageHandle& h); ImageHandle& operator/=(const ConstImageHandle& h); - ImageHandle& operator+=(const Function& h); - ImageHandle& operator-=(const Function& h); - ImageHandle& operator*=(const Function& h); - ImageHandle& operator/=(const Function& h); - //@} /*! @name low-level access @@ -736,14 +730,6 @@ DLLEXPORT_OST_IMG_BASE ImageHandle operator-(const ConstImageHandle& h1, const C DLLEXPORT_OST_IMG_BASE ImageHandle operator*(const ConstImageHandle& h1, const ConstImageHandle& h2); DLLEXPORT_OST_IMG_BASE ImageHandle operator/(const ConstImageHandle& h1, const ConstImageHandle& h2); -DLLEXPORT_OST_IMG_BASE ImageHandle operator+(const ConstImageHandle& h1, const Function& h2); -DLLEXPORT_OST_IMG_BASE ImageHandle operator-(const ConstImageHandle& h1, const Function& h2); -DLLEXPORT_OST_IMG_BASE ImageHandle operator*(const ConstImageHandle& h1, const Function& h2); -DLLEXPORT_OST_IMG_BASE ImageHandle operator/(const ConstImageHandle& h1, const Function& h2); - -DLLEXPORT_OST_IMG_BASE ImageHandle operator+(const Function& h1, const ConstImageHandle& h2); -DLLEXPORT_OST_IMG_BASE ImageHandle operator-(const Function& h1, const ConstImageHandle& h2); -DLLEXPORT_OST_IMG_BASE ImageHandle operator*(const Function& h1, const ConstImageHandle& h2); }} // namespace img diff --git a/modules/img/base/src/image_list.cc b/modules/img/base/src/image_list.cc index 27c47423b66be12ab4156bfd89e602782f292d00..522e5f7af76c67f2b171ec5ad6f07e9782adef4c 100644 --- a/modules/img/base/src/image_list.cc +++ b/modules/img/base/src/image_list.cc @@ -329,32 +329,4 @@ ImageList& ImageList::operator/=(const ConstImageHandle& h) } return *this; } -ImageList& ImageList::operator+=(const Function& h) -{ - for(iterator it=begin();it!=end();++it){ - (*it)+=h; - } - return *this; -} -ImageList& ImageList::operator-=(const Function& h) -{ - for(iterator it=begin();it!=end();++it){ - (*it)-=h; - } - return *this; -} -ImageList& ImageList::operator*=(const Function& h) -{ - for(iterator it=begin();it!=end();++it){ - (*it)*=h; - } - return *this; -} -ImageList& ImageList::operator/=(const Function& h) -{ - for(iterator it=begin();it!=end();++it){ - (*it)/=h; - } - return *this; -} }}//ns diff --git a/modules/img/base/src/image_list.hh b/modules/img/base/src/image_list.hh index 70fd1ca478055b87995723e1ad8edeb8e62f65fa..43314701376a1a550918eebb83c2c5f2f97df99e 100644 --- a/modules/img/base/src/image_list.hh +++ b/modules/img/base/src/image_list.hh @@ -135,10 +135,6 @@ public: ImageList& operator-=(const ConstImageHandle& h); ImageList& operator*=(const ConstImageHandle& h); ImageList& operator/=(const ConstImageHandle& h); - ImageList& operator+=(const Function& h); - ImageList& operator-=(const Function& h); - ImageList& operator*=(const Function& h); - ImageList& operator/=(const Function& h); private: Size get_max_size_(); DataType get_data_type_(); diff --git a/modules/img/base/src/image_state/image_state_algorithm.hh b/modules/img/base/src/image_state/image_state_algorithm.hh index e5546583a2208bd600c66d73667783aa3acb8338..54a4b939ebb48e56b1abd32c24e090a77aac4418 100644 --- a/modules/img/base/src/image_state/image_state_algorithm.hh +++ b/modules/img/base/src/image_state/image_state_algorithm.hh @@ -226,16 +226,13 @@ namespace ost { namespace img { namespace image_state { FNC(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb), BASE (FNC::GetAlgorithmName()) {} -//! non-modifying image state visitor plus data algorithm +//! non-modifying image state visitor plus non-mod algorithm /*! This convenience hybrid class combines the functionality of the NonModAlgorithm and the ImageStateNonModVisitor by implementing - both interfaces. The template is expected to be a class with two - methods, a VisitState() method as for - img::image_state::ImageStateNonModVisitor, and in addition a - Visit(const Function&) method for the implementation of the - img::NonModAlgorithm interface and a static GetAlgorithmName() for - the initialization of the img::NonModAlgorithm ctor + both interfaces. The template parameter is expected to be a class + offering VisitState (see img::image_state::ImageStateNonModVisitor ), + plus a static GetAlgorithmName() method: \code @@ -244,8 +241,6 @@ namespace ost { namespace img { namespace image_state { template<typename T, class D> void VisitState(const img::image_state::ImageStateImpl<T,D>& isi); - void VisitFunction(const Funcion& f); - static String GetAlgorithmName(); }; @@ -275,9 +270,6 @@ public: virtual void Visit(const ConstImageHandle& h) { h.StateApply(*this); } - virtual void Visit(const Function& f) { - this->VisitFunction(f); - } private: /* diff --git a/modules/img/base/src/image_state/image_state_base.hh b/modules/img/base/src/image_state/image_state_base.hh index 22b5ed14ae02d04049f129456d417a012c3a285e..385c8903ab61d562a4171634cae9fd2cd2d93717 100644 --- a/modules/img/base/src/image_state/image_state_base.hh +++ b/modules/img/base/src/image_state/image_state_base.hh @@ -208,11 +208,6 @@ public: ImageStateBase& operator*=(const ImageStateBase& b); ImageStateBase& operator/=(const ImageStateBase& b); - virtual void operator+=(const Function& b) = 0; - virtual void operator-=(const Function& b) = 0; - virtual void operator*=(const Function& b) = 0; - virtual void operator/=(const Function& b) = 0; - protected: ImageStateBase() {} ImageStateBase(const ImageStateBase& s) {} diff --git a/modules/img/base/src/image_state/image_state_impl.cc b/modules/img/base/src/image_state/image_state_impl.cc index 7dec67093909b1536d96a72051084581793969bd..2575a1adb3ffe4493461bc68fe798127dba55449 100644 --- a/modules/img/base/src/image_state/image_state_impl.cc +++ b/modules/img/base/src/image_state/image_state_impl.cc @@ -702,130 +702,6 @@ ImageStateBase& ImageStateImpl<T,D>::operator/=(const Complex& v) return *this; } -// add function - -template<typename T> -void add_func_value(T& v, const Function& f, const Point& p); - -template<> -void add_func_value(Real& v, const Function& f, const Point& p) -{ - v+=f.GetReal(p); -} - -template<> -void add_func_value(Complex& v, const Function& f, const Point& p) -{ - v+=f.GetComplex(p); -} - -template<typename T> -void add_func_value(T& v, const Function& f, const Point& p) -{ - v+=static_cast<T>(f.GetReal(p)); -} - -template <typename T, class D> -void ImageStateImpl<T,D>::operator+=(const Function& f) -{ - for(ExtentIterator it(this->GetExtent());!it.AtEnd();++it) { - add_func_value(this->Value(it),f,it); - } -} - -// sub function - -template<typename T> -void sub_func_value(T& v, const Function& f, const Point& p); - -template<> -void sub_func_value(Real& v, const Function& f, const Point& p) -{ - v-=f.GetReal(p); -} - -template<> -void sub_func_value(Complex& v, const Function& f, const Point& p) -{ - v-=f.GetComplex(p); -} - -template<typename T> -void sub_func_value(T& v, const Function& f, const Point& p) -{ - v-=static_cast<T>(f.GetReal(p)); -} - -template <typename T, class D> -void ImageStateImpl<T,D>::operator-=(const Function& f) -{ - for(ExtentIterator it(this->GetExtent());!it.AtEnd();++it) { - sub_func_value(this->Value(it),f,it); - } -} - -// mul function - -template<typename T> -void mul_func_value(T& v, const Function& f, const Point& p); - -template<> -void mul_func_value(Real& v, const Function& f, const Point& p) -{ - v*=f.GetReal(p); -} - -template<> -void mul_func_value(Complex& v, const Function& f, const Point& p) -{ - v*=f.GetComplex(p); -} - -template<typename T> -void mul_func_value(T& v, const Function& f, const Point& p) -{ - v*=static_cast<T>(f.GetReal(p)); -} - -template <typename T, class D> -void ImageStateImpl<T,D>::operator*=(const Function& f) -{ - for(ExtentIterator it(this->GetExtent());!it.AtEnd();++it) { - mul_func_value(this->Value(it),f,it); - } -} - -// div function - -template<typename T> -void div_func_value(T& v, const Function& f, const Point& p); - -template<> -void div_func_value(Real& v, const Function& f, const Point& p) -{ - v/=f.GetReal(p); -} - -template<> -void div_func_value(Complex& v, const Function& f, const Point& p) -{ - v/=f.GetComplex(p); -} - -template<typename T> -void div_func_value(T& v, const Function& f, const Point& p) -{ - v/=static_cast<T>(f.GetReal(p)); -} - - -template <typename T, class D> -void ImageStateImpl<T,D>::operator/=(const Function& f) -{ - for(ExtentIterator it(this->GetExtent());!it.AtEnd();++it) { - div_func_value(this->Value(it),f,it); - } -} template <typename T, class D> template <typename U> diff --git a/modules/img/base/src/image_state/image_state_impl.hh b/modules/img/base/src/image_state/image_state_impl.hh index 151592ee781fecfba9f87b83c4836137ea67a5f1..d18989aaa3f6722617b01893fc765a6603bdfa25 100644 --- a/modules/img/base/src/image_state/image_state_impl.hh +++ b/modules/img/base/src/image_state/image_state_impl.hh @@ -211,11 +211,6 @@ public: virtual ImageStateBase& operator/=(Real v); virtual ImageStateBase& operator/=(const Complex& v); - virtual void operator+=(const Function& b); - virtual void operator-=(const Function& b); - virtual void operator*=(const Function& b); - virtual void operator/=(const Function& b); - protected: // helper methods for operators above template <typename U> void add_scalar(const U& v); diff --git a/modules/img/base/src/null_function.hh b/modules/img/base/src/null_function.hh deleted file mode 100644 index d21613b0639e2eb9d88d9866dd1546cd27fcacc5..0000000000000000000000000000000000000000 --- a/modules/img/base/src/null_function.hh +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - convenience null function - - Author: Ansgar Philippsen -*/ - -#ifndef IMG_NULL_FUNCTION_H -#define IMG_NULL_FUNCTION_H - -#include "module_config.hh" -#include "function_base.hh" - -namespace ost { namespace img { - -//! null function -/*! - Implements Function interface, will always - return zero -*/ -class DLLEXPORT NullFunction: public Function { -public: - NullFunction(): - Function(SPATIAL) - {} - - virtual DataType GetType() const {return REAL;} - - virtual Real GetIntpolReal(const Vec3& v) const {return 0.0;} - - virtual Complex GetIntpolComplex(const Vec3& v) const {return Complex(0.0,0.0);} - - virtual ~NullFunction(){}; -}; - -}} // namespace - - -#endif diff --git a/modules/img/base/src/paste_impl.cc b/modules/img/base/src/paste_impl.cc index 848cc7c5e8dfe2d8d469e2e7539d91c42ef3f1c7..243ca43b223a26296b46c7450f5b8933b941d667 100644 --- a/modules/img/base/src/paste_impl.cc +++ b/modules/img/base/src/paste_impl.cc @@ -45,18 +45,6 @@ void PasteFnc::VisitState(const image_state::ImageStateImpl<V,D>& isi) f_paste_ip(target_.ImageStatePtr().get(),&isi); } -void PasteFnc::VisitFunction(const Function& f) -{ - if(target_.GetType()==REAL) { - for(ExtentIterator it(f.GetExtent());!it.AtEnd();++it) { - target_.SetReal(it,f.GetReal(it)); - } - } else { - for(ExtentIterator it(f.GetExtent());!it.AtEnd();++it) { - target_.SetComplex(it,f.GetComplex(it)); - } - } -} } diff --git a/modules/img/base/src/paste_impl.hh b/modules/img/base/src/paste_impl.hh index 70e483cd59ab567117618b43108074492c47f5b7..700a786cd5c2592a09967e44563dfcf276f375bb 100644 --- a/modules/img/base/src/paste_impl.hh +++ b/modules/img/base/src/paste_impl.hh @@ -34,8 +34,6 @@ public: template<typename V, class D> void VisitState(const image_state::ImageStateImpl<V,D>& isi); - void VisitFunction(const Function& f); - static String GetAlgorithmName() {return "Paste";} private: diff --git a/modules/img/base/src/raster_image/raster_image.cc b/modules/img/base/src/raster_image/raster_image.cc index 20856e19f6b6fce55da9823aa5c71d61aceabf4f..143e1110b2c0e739a5c1b522886e54a409aeacfa 100644 --- a/modules/img/base/src/raster_image/raster_image.cc +++ b/modules/img/base/src/raster_image/raster_image.cc @@ -305,7 +305,6 @@ public: } - void VisitFunction(const Function& f) {} static String GetAlgorithmName() {return "RasterImageFiller";} diff --git a/modules/img/base/tests/CMakeLists.txt b/modules/img/base/tests/CMakeLists.txt index 503345f160b89b0c98997d43278f0c4e1e33b633..439133bf38f0909414bb91a8422eb536e27548e8 100644 --- a/modules/img/base/tests/CMakeLists.txt +++ b/modules/img/base/tests/CMakeLists.txt @@ -1,9 +1,7 @@ set(OST_IMG_BASE_UNIT_TESTS test_data.cc test_extent.cc -test_function.cc test_image.cc -test_image_factory.cc test_image_state.cc test_image_state_visitor.cc test_index.cc diff --git a/modules/img/base/tests/test_function.cc b/modules/img/base/tests/test_function.cc deleted file mode 100644 index d3cffa9b62f744cd555120e2d336bbf3af5fdaa8..0000000000000000000000000000000000000000 --- a/modules/img/base/tests/test_function.cc +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - Author: Ansgar Philippsen -*/ - -#include "test_function.hh" - -#include <ost/img/function.hh> -#include <ost/img/null_function.hh> -using namespace ost::img; - -namespace test_function { - -void test_NullFunc() -{ - NullFunction nf; - - BOOST_CHECK(nf.GetDomain()==SPATIAL); - BOOST_CHECK(nf.GetReal(Point(-1,-4,-7))==0.0); -} - -void test_RealFunc() -{ - class MyRealFunc: public RealFunction { - public: - MyRealFunc(): - RealFunction(SPATIAL) - {} - - Real Func(const Vec3& v) const {return 1.5;} - }; - - MyRealFunc f; - - BOOST_CHECK(f.GetReal(Point())==1.5); -} - -void test_ComplexFunc() -{ - class MyComplexFunc: public ComplexFunction { - public: - MyComplexFunc(): - ComplexFunction(SPATIAL) - {} - - Complex Func(const Vec3& v) const {return Complex(-1.5,8.0);} - }; - - MyComplexFunc f; - - BOOST_CHECK(f.GetComplex(Point())==Complex(-1.5,8.0)); -} - -} // namespace - -test_suite* CreateFunctionTest() -{ - using namespace test_function; - test_suite* ts=BOOST_TEST_SUITE("Function Test"); - - ts->add(BOOST_TEST_CASE(&test_NullFunc)); - ts->add(BOOST_TEST_CASE(&test_RealFunc)); - ts->add(BOOST_TEST_CASE(&test_ComplexFunc)); - - return ts; -} diff --git a/modules/img/base/tests/test_function.hh b/modules/img/base/tests/test_function.hh deleted file mode 100644 index f2e7353bf1f8d84ca2d2700d40672ace904436fd..0000000000000000000000000000000000000000 --- a/modules/img/base/tests/test_function.hh +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - Author: Ansgar Philippsen -*/ - -#ifndef IMG_TEST_FUNCTION_H -#define IMG_TEST_FUNCTION_H - -#define BOOST_TEST_DYN_LINK -#include <boost/test/unit_test.hpp> -using boost::unit_test_framework::test_suite; - -test_suite* CreateFunctionTest(); - -#endif diff --git a/modules/img/base/tests/test_image_factory.cc b/modules/img/base/tests/test_image_factory.cc deleted file mode 100644 index 04554c580960088ae19cfcea7a6962375bdd24c9..0000000000000000000000000000000000000000 --- a/modules/img/base/tests/test_image_factory.cc +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - Author: Ansgar Philippsen -*/ - -#include "test_image_factory.hh" - -#include <ost/img/image_factory.hh> -#include <ost/img/function.hh> -#include <ost/img/image.hh> - -using namespace ost::img; - -namespace test_image_factory { - -void test_Generate() -{ - class MyComplexFunc: public ComplexFunction { - public: - MyComplexFunc(): - ComplexFunction(FREQUENCY) - {} - - virtual Complex Func(const Vec3& v) const { - return Complex(v[0],v[1]); - } - }; - - - MyComplexFunc cf; - Extent ext(Point(-10,-10),Point(10,10)); - cf.SetExtent(ext); - - ImageHandle g1 = GenerateImage(cf); - - BOOST_CHECK(g1.GetType()==COMPLEX); - BOOST_CHECK(g1.GetDomain()==FREQUENCY); - BOOST_CHECK(g1.GetExtent()==ext); - - for(ExtentIterator it(ext); !it.AtEnd(); ++it) { - Point p(it); - BOOST_REQUIRE(g1.GetComplex(p) == cf.GetComplex(p)); - BOOST_REQUIRE(g1.GetComplex(p) == Complex(Real(p[0]),Real(p[1]))); - } - -} - -} // namespace - -test_suite* CreateImageFactoryTest() -{ - using namespace test_image_factory; - test_suite* ts=BOOST_TEST_SUITE("ImageFactory Test"); - - ts->add(BOOST_TEST_CASE(&test_Generate)); - - return ts; -} diff --git a/modules/img/base/tests/test_image_factory.hh b/modules/img/base/tests/test_image_factory.hh deleted file mode 100644 index 90109184aa7665648810217972723a52bde06f2b..0000000000000000000000000000000000000000 --- a/modules/img/base/tests/test_image_factory.hh +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// Copyright (C) 2003-2010 by the IPLT authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - -/* - Author: Ansgar Philippsen -*/ - -#ifndef IMG_TEST_IMAGE_FACTORY_H -#define IMG_TEST_IMAGE_FACTORY_H - -#define BOOST_TEST_DYN_LINK -#include <boost/test/unit_test.hpp> -using boost::unit_test_framework::test_suite; - -test_suite* CreateImageFactoryTest(); - -#endif diff --git a/modules/img/base/tests/tests.cc b/modules/img/base/tests/tests.cc index 2027c80088bd2164d511fec7dc02b0ce8f9f98a3..161687ebee631fcabb08218358556c594363862c 100644 --- a/modules/img/base/tests/tests.cc +++ b/modules/img/base/tests/tests.cc @@ -29,9 +29,7 @@ #include "test_data.hh" #include "test_extent.hh" -#include "test_function.hh" #include "test_image.hh" -#include "test_image_factory.hh" #include "test_image_state.hh" #include "test_image_state_visitor.hh" #include "test_index.hh" @@ -60,9 +58,7 @@ bool init_ost_img_base_unit_tests() { try { framework::master_test_suite().add(CreateDataTest()); framework::master_test_suite().add(CreateExtentTest()); - framework::master_test_suite().add(CreateFunctionTest()); framework::master_test_suite().add(CreateImageTest()); - framework::master_test_suite().add(CreateImageFactoryTest()); framework::master_test_suite().add(CreateImageStateTest()); framework::master_test_suite().add(CreateImageStateVisitorTest()); framework::master_test_suite().add(CreateIndexTest());