From 63bb1fa0ffec116cfbfb461900c4602fccce60d5 Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Thu, 15 Nov 2012 19:16:56 -0500 Subject: [PATCH] removed Function interface from img module --- modules/gui/pymod/export_plot.cc | 203 ------------------ modules/gui/src/data_viewer/img2qt.cc | 9 - modules/img/alg/src/highest_peak_search_3d.cc | 4 - modules/img/alg/src/highest_peak_search_3d.hh | 2 - modules/img/alg/src/histogram.cc | 12 -- modules/img/alg/src/histogram.hh | 2 - modules/img/alg/src/stat.cc | 53 ----- modules/img/alg/src/stat.hh | 2 - modules/img/alg/src/stat_min_max.cc | 22 -- modules/img/alg/src/stat_min_max.hh | 2 - modules/img/base/pymod/CMakeLists.txt | 1 - .../img/base/pymod/export_data_algorithm.cc | 8 - modules/img/base/pymod/export_function.cc | 98 --------- modules/img/base/pymod/export_image_handle.cc | 12 -- modules/img/base/pymod/export_image_list.cc | 4 - modules/img/base/pymod/wrap_img.cc | 2 - modules/img/base/src/CMakeLists.txt | 7 - modules/img/base/src/algorithm.hh | 1 - modules/img/base/src/data.hh | 2 +- modules/img/base/src/data_algorithm.hh | 3 - modules/img/base/src/image_handle.cc | 88 -------- modules/img/base/src/image_handle.hh | 14 -- modules/img/base/src/image_list.cc | 28 --- modules/img/base/src/image_list.hh | 4 - .../src/image_state/image_state_algorithm.hh | 16 +- .../base/src/image_state/image_state_base.hh | 5 - .../base/src/image_state/image_state_impl.cc | 124 ----------- .../base/src/image_state/image_state_impl.hh | 5 - modules/img/base/src/null_function.hh | 58 ----- modules/img/base/src/paste_impl.cc | 12 -- modules/img/base/src/paste_impl.hh | 2 - .../img/base/src/raster_image/raster_image.cc | 1 - modules/img/base/tests/CMakeLists.txt | 2 - modules/img/base/tests/test_function.cc | 85 -------- modules/img/base/tests/test_function.hh | 34 --- modules/img/base/tests/test_image_factory.cc | 77 ------- modules/img/base/tests/test_image_factory.hh | 34 --- modules/img/base/tests/tests.cc | 4 - 38 files changed, 5 insertions(+), 1037 deletions(-) delete mode 100644 modules/gui/pymod/export_plot.cc delete mode 100644 modules/img/base/pymod/export_function.cc delete mode 100644 modules/img/base/src/null_function.hh delete mode 100644 modules/img/base/tests/test_function.cc delete mode 100644 modules/img/base/tests/test_function.hh delete mode 100644 modules/img/base/tests/test_image_factory.cc delete mode 100644 modules/img/base/tests/test_image_factory.hh diff --git a/modules/gui/pymod/export_plot.cc b/modules/gui/pymod/export_plot.cc deleted file mode 100644 index 9091a7313..000000000 --- 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 2194c6030..fdf5b8cb4 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 c8e884577..913586a08 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 d61c8a847..1f2bc2fd6 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 6225fd99c..16d90f351 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 820744d31..c930ba43a 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 01053ab7e..262314998 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 47009785a..ba1861621 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 3b46db02e..c69638644 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 b1a89bc81..15d7300bc 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 de787d140..a14d21e68 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 f1f8056c5..4fe222395 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 266057439..000000000 --- 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 24aace26c..b85817f32 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 e97b34bff..50fc5a941 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 a23f89745..f89f14e95 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 ff5191865..23e6ea92d 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 68f9cec6f..4b00bc044 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 fc2401b07..3ab5d6063 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 1cc85d343..02e05ff4c 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 92234663c..94709ec95 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 4acf4e271..62ed281d2 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 27c47423b..522e5f7af 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 70fd1ca47..433147013 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 e5546583a..54a4b939e 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 22b5ed14a..385c8903a 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 7dec67093..2575a1adb 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 151592ee7..d18989aaa 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 d21613b06..000000000 --- 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 848cc7c5e..243ca43b2 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 70e483cd5..700a786cd 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 20856e19f..143e1110b 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 503345f16..439133bf3 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 d3cffa9b6..000000000 --- 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 f2e7353bf..000000000 --- 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 04554c580..000000000 --- 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 90109184a..000000000 --- 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 2027c8008..161687ebe 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()); -- GitLab