diff --git a/Device/Detector/IDetector.cpp b/Device/Detector/IDetector.cpp index 5fa8f2c98d38b3fef808d284d7be4ac2daf8577c..e4de283752ba19fa2fd631ced86d3bd8c8079151 100644 --- a/Device/Detector/IDetector.cpp +++ b/Device/Detector/IDetector.cpp @@ -186,12 +186,6 @@ std::vector<const INode*> IDetector::nodeChildren() const return std::vector<const INode*>() << &m_polAnalyzer << m_resolution.get(); } -void IDetector::iterateOverRegionOfInterest(std::function<void(const_iterator)> func) const -{ - for (auto it = beginRegionOfInterestPoints(); it != endRegionOfInterestPoints(); ++it) - func(it); -} - void IDetector::iterateOverNonMaskedPoints(std::function<void(const_iterator)> func) const { for (auto it = beginNonMaskedPoints(); it != endNonMaskedPoints(); ++it) @@ -208,16 +202,6 @@ SimulationAreaIterator IDetector::endNonMaskedPoints() const return SimulationAreaIterator::createEnd(this, SimulationAreaIterator::notMasked); } -SimulationAreaIterator IDetector::beginRegionOfInterestPoints() const -{ - return SimulationAreaIterator::createBegin(this, SimulationAreaIterator::regionOfInterest); -} - -SimulationAreaIterator IDetector::endRegionOfInterestPoints() const -{ - return SimulationAreaIterator::createEnd(this, SimulationAreaIterator::regionOfInterest); -} - size_t IDetector::regionOfInterestIndexToDetectorIndex(const size_t regionOfInterestIndex) const { if (m_explicitROI.size() != 2) diff --git a/Device/Detector/IDetector.h b/Device/Detector/IDetector.h index 0c2e8dd2ef7e6e92a6777ffc78b73a666a8c6bc8..049915686109146b05b91101e0e7882b410879f8 100644 --- a/Device/Detector/IDetector.h +++ b/Device/Detector/IDetector.h @@ -71,11 +71,6 @@ public: std::vector<const INode*> nodeChildren() const override; - //! Iterate over all points within "region of interest", no matter whether they are masked or - //! not. If no region of interest is explicitly defined, then the whole detector is taken as - //! "region of interest". - void iterateOverRegionOfInterest(std::function<void(const_iterator)> func) const; - //! Iterate over all non-masked points within "region of interest". //! If no region of interest is explicitly defined, then the whole detector is taken as //! "region of interest". @@ -159,18 +154,6 @@ public: //! within the "Region of Interest" SimulationAreaIterator endNonMaskedPoints() const; - //! Create begin-iterator to iterate over all points which lay - //! within the "Region of Interest". If no region of interest is explicitly - //! defined, then the whole detector is taken as "region of interest". - //! No matter whether masked or not. - SimulationAreaIterator beginRegionOfInterestPoints() const; - - //! Create end-iterator to iterate over all points which lay - //! within the "Region of Interest". If no region of interest is explicitly - //! defined, then the whole detector is taken as "region of interest". - //! No matter whether masked or not. - SimulationAreaIterator endRegionOfInterestPoints() const; - //! Returns empty detector map in given axes units. //! This map is a data array limited to the size of the "Region of interest" Datafield createDetectorMap() const; diff --git a/Tests/Unit/Device/SimulationAreaTest.cpp b/Tests/Unit/Device/SimulationAreaTest.cpp index 16f480bdc2819667f30316f25336169e26bcd839..6efed8353b9af55f8f5a50768de6e5d967f742af 100644 --- a/Tests/Unit/Device/SimulationAreaTest.cpp +++ b/Tests/Unit/Device/SimulationAreaTest.cpp @@ -138,43 +138,6 @@ TEST(SimulationAreaTest, maskAndRoiIteration) EXPECT_EQ(roiIndexes, expectedRoiIndexes); } -//! Iteration when RegionOfInterest and masks are present. Iteration visit masked areas too. - -TEST(SimulationAreaTest, maskAndRoiIterationVisitMasks) -{ - SphericalDetector detector(5, -1.0, 4.0, 4, 0.0, 4.0); - detector.setRegionOfInterest(0.1, 1.1, 2.9, 3.9); - detector.addMask(Rectangle(-0.9, 0.1, 0.9, 1.9), true); - - std::vector<size_t> expectedRoiIndexes = {0, 1, 2, 3, 4, 5, 6, 7, 8}; - std::vector<size_t> expectedDetectorIndexes = {5, 6, 7, 9, 10, 11, 13, 14, 15}; - std::vector<size_t> indexes; - std::vector<size_t> detectorIndexes; - std::vector<size_t> roiIndexes; - for (auto it = detector.beginRegionOfInterestPoints(); - it != detector.endRegionOfInterestPoints(); ++it) { - indexes.push_back(it.roiIndex()); - detectorIndexes.push_back(it.detectorIndex()); - roiIndexes.push_back(it.roiIndex()); - } - EXPECT_EQ(indexes, expectedRoiIndexes); - EXPECT_EQ(detectorIndexes, expectedDetectorIndexes); - EXPECT_EQ(roiIndexes, expectedRoiIndexes); - - // Now same as above, but using IDetector::iterate - indexes.clear(); - detectorIndexes.clear(); - roiIndexes.clear(); - detector.iterateOverRegionOfInterest([&](IDetector::const_iterator it) { - indexes.push_back(it.roiIndex()); - detectorIndexes.push_back(it.detectorIndex()); - roiIndexes.push_back(it.roiIndex()); - }); - EXPECT_EQ(indexes, expectedRoiIndexes); - EXPECT_EQ(detectorIndexes, expectedDetectorIndexes); - EXPECT_EQ(roiIndexes, expectedRoiIndexes); -} - //! Checking index of ROI TEST(SimulationAreaTest, indexInRoi) diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py index 224ee313d83139cdc6b6f581cc262e173bb7d542..f34a2e3c9e32865410498c4b37ff2d5ab5c2b0ec 100644 --- a/auto/Wrap/libBornAgainDevice.py +++ b/auto/Wrap/libBornAgainDevice.py @@ -2700,10 +2700,6 @@ class IDetector(libBornAgainBase.ICloneable, libBornAgainParam.INode): r"""nodeChildren(IDetector self) -> std::vector< INode const *,std::allocator< INode const * > >""" return _libBornAgainDevice.IDetector_nodeChildren(self) - def iterateOverRegionOfInterest(self, func): - r"""iterateOverRegionOfInterest(IDetector self, std::function< void (IDetector::const_iterator) > func)""" - return _libBornAgainDevice.IDetector_iterateOverRegionOfInterest(self, func) - def iterateOverNonMaskedPoints(self, func): r"""iterateOverNonMaskedPoints(IDetector self, std::function< void (IDetector::const_iterator) > func)""" return _libBornAgainDevice.IDetector_iterateOverNonMaskedPoints(self, func) diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp index 66a5884b36b34179d432476adc2053835b914e6d..b35fe6b0130b981d55e95091d06012524956a5ea 100644 --- a/auto/Wrap/libBornAgainDevice_wrap.cpp +++ b/auto/Wrap/libBornAgainDevice_wrap.cpp @@ -33481,43 +33481,6 @@ fail: } -SWIGINTERN PyObject *_wrap_IDetector_iterateOverRegionOfInterest(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - IDetector *arg1 = (IDetector *) 0 ; - SwigValueWrapper< std::function< void (SimulationAreaIterator const &) > > arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "IDetector_iterateOverRegionOfInterest", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IDetector, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IDetector_iterateOverRegionOfInterest" "', argument " "1"" of type '" "IDetector const *""'"); - } - arg1 = reinterpret_cast< IDetector * >(argp1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__functionT_void_fSimulationAreaIterator_const_RF_t, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IDetector_iterateOverRegionOfInterest" "', argument " "2"" of type '" "std::function< void (IDetector::const_iterator) >""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IDetector_iterateOverRegionOfInterest" "', argument " "2"" of type '" "std::function< void (IDetector::const_iterator) >""'"); - } else { - std::function< void (IDetector::const_iterator) > * temp = reinterpret_cast< std::function< void (IDetector::const_iterator) > * >(argp2); - arg2 = *temp; - if (SWIG_IsNewObj(res2)) delete temp; - } - } - ((IDetector const *)arg1)->iterateOverRegionOfInterest(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_IDetector_iterateOverNonMaskedPoints(PyObject *self, PyObject *args) { PyObject *resultobj = 0; IDetector *arg1 = (IDetector *) 0 ; @@ -38242,7 +38205,6 @@ static PyMethodDef SwigMethods[] = { { "IDetector_setResolutionFunction", _wrap_IDetector_setResolutionFunction, METH_VARARGS, "IDetector_setResolutionFunction(IDetector self, IResolutionFunction2D resFunc)"}, { "IDetector_resetRegionOfInterest", _wrap_IDetector_resetRegionOfInterest, METH_O, "IDetector_resetRegionOfInterest(IDetector self)"}, { "IDetector_nodeChildren", _wrap_IDetector_nodeChildren, METH_O, "IDetector_nodeChildren(IDetector self) -> std::vector< INode const *,std::allocator< INode const * > >"}, - { "IDetector_iterateOverRegionOfInterest", _wrap_IDetector_iterateOverRegionOfInterest, METH_VARARGS, "IDetector_iterateOverRegionOfInterest(IDetector self, std::function< void (IDetector::const_iterator) > func)"}, { "IDetector_iterateOverNonMaskedPoints", _wrap_IDetector_iterateOverNonMaskedPoints, METH_VARARGS, "IDetector_iterateOverNonMaskedPoints(IDetector self, std::function< void (IDetector::const_iterator) > func)"}, { "IDetector_detectorMask", _wrap_IDetector_detectorMask, METH_O, "IDetector_detectorMask(IDetector self) -> DetectorMask"}, { "IDetector_addMask", _wrap_IDetector_addMask, METH_VARARGS, "IDetector_addMask(IDetector self, IShape2D shape, bool mask_value=True)"},