Xmipp  v3.23.11-Nereus
bspline_geo_transformer.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: David Strelak (davidstrelak@gmail.com)
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 
26 #ifndef LIBRARIES_RECONSTRUCTION_BSPLINE_GEO_TRANSFORMER_H_
27 #define LIBRARIES_RECONSTRUCTION_BSPLINE_GEO_TRANSFORMER_H_
28 
30 #include "CTPL/ctpl_stl.h"
31 #include "data/cpu.h"
32 
36 template<typename T>
38 public:
40 
41  void check() const override {
43  }
44 };
45 
46 template<typename T>
47 class BSplineGeoTransformer : public AGeoTransformer<BSplineTransformSettings<T>, T> {
48 public:
49 
51  setDefault();
52  }
55 
57  release();
58  }
59  BSplineGeoTransformer &operator=(const BSplineGeoTransformer&)=delete;
60  BSplineGeoTransformer &operator=(const BSplineGeoTransformer&&)=delete;
61 
62  virtual void setSrc(const T *data) override {
63  m_src = data;
64  this->setIsSrcSet(nullptr != data);
65  }
66 
67  virtual const T *getSrc() const {
68  return m_src;
69  }
70 
71  virtual T *getDest() const override {
72  return m_dest.get();
73  }
74 
75  virtual void copySrcToDest() override;
76 
77  virtual T *interpolate(const std::vector<float> &matrices);
78 
79  virtual void sum(T *dest, const std::vector<float> &weights, size_t firstN, T norm); //FIXME DS refactor
80 
81 protected:
82  virtual void initialize(bool doAllocation) override;
83  virtual void release();
84  virtual void setDefault();
85  virtual void check() override;
86 
87  virtual bool canBeReused(const BSplineTransformSettings<T> &s) const override;
88 private:
89  std::unique_ptr<T[]> m_dest;
90  const T *m_src;
91  ctpl::thread_pool m_threadPool;
92 };
94 #endif /* LIBRARIES_RECONSTRUCTION_BSPLINE_GEO_TRANSFORMER_H_ */
virtual void check() const
T norm(const std::vector< T > &v)
Definition: vector_ops.h:399
virtual const T * getSrc() const
virtual void setSrc(const T *data) override
virtual T * getDest() const override