scaler1d.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef mia_core_scale1d_hh
22 #define mia_core_scale1d_hh
23 
24 #include <cassert>
25 #include <vector>
26 #include <memory>
27 
28 #include <mia/core/vector.hh>
29 #include <mia/core/msgstream.hh>
32 
34 
48 public:
49  typedef std::vector<double> std_double_vector;
50 
58  C1DScalar(const CSplineKernel& kernel, size_t in_size, size_t out_size);
59 
68  C1DScalar(const CSplineKernel& kernel, size_t in_size, double scale);
69 
76  void operator () (const std_double_vector& input, std_double_vector& output) const;
77 
83  void run();
84 
86  std_double_vector::iterator input_begin();
88  std_double_vector::iterator input_end();
89 
91  std_double_vector::iterator output_begin();
92 
94  std_double_vector::iterator output_end();
95 
97  size_t get_output_size() const;
98 private:
99  void initialize(const CSplineKernel& kernel);
100  void upscale(const std_double_vector& input, std_double_vector& output) const;
101  void downscale(const std_double_vector& input, std_double_vector& output) const;
102 
103  enum EStrategy {
104  scs_fill_output,
105  scs_upscale,
106  scs_copy,
107  scs_downscale,
108  scs_unknown
109  };
110 
111  size_t m_in_size;
112  size_t m_support;
113  double m_scale;
114  std::vector<double> m_poles;
115  EStrategy m_strategy;
117 
118  std_double_vector m_input_buffer;
119 
120  size_t m_out_size;
121  std_double_vector m_output_buffer;
122  std::vector<CSplineKernel::VWeight> m_weights;
123  std::vector<CSplineKernel::VIndex> m_indices;
124 
125  P1DSpacialKernel m_gauss;
126 };
127 
128 
129 
131 
132 
133 #endif
std::shared_ptr< C1DFoldingKernel > P1DSpacialKernel
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
A class for general scaling of one-dimensional arrays.
Definition: scaler1d.hh:47
Base class for all spline based interpolation kernels.
Definition: splinekernel.hh:45
std::vector< double > std_double_vector
Definition: scaler1d.hh:49
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
CSplineBoundaryCondition::Pointer PSplineBoundaryCondition
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36