My Project
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 {
49 public:
50  typedef std::vector<double> std_double_vector;
51 
59  C1DScalar(const CSplineKernel& kernel, size_t in_size, size_t out_size);
60 
69  C1DScalar(const CSplineKernel& kernel, size_t in_size, double scale);
70 
77  void operator () (const std_double_vector& input, std_double_vector& output) const;
78 
84  void run();
85 
87  std_double_vector::iterator input_begin();
89  std_double_vector::iterator input_end();
90 
92  std_double_vector::iterator output_begin();
93 
95  std_double_vector::iterator output_end();
96 
98  size_t get_output_size() const;
99 private:
100  void initialize(const CSplineKernel& kernel);
101  void upscale(const std_double_vector& input, std_double_vector& output) const;
102  void downscale(const std_double_vector& input, std_double_vector& output) const;
103 
104  enum EStrategy {
105  scs_fill_output,
106  scs_upscale,
107  scs_copy,
108  scs_downscale,
109  scs_unknown
110  };
111 
112  size_t m_in_size;
113  size_t m_support;
114  double m_scale;
115  std::vector<double> m_poles;
116  EStrategy m_strategy;
118 
119  std_double_vector m_input_buffer;
120 
121  size_t m_out_size;
122  std_double_vector m_output_buffer;
123  std::vector<CSplineKernel::VWeight> m_weights;
124  std::vector<CSplineKernel::VIndex> m_indices;
125 
126  P1DSpacialKernel m_gauss;
127 };
128 
129 
130 
132 
133 
134 #endif
C1DScalar::C1DScalar
C1DScalar(const CSplineKernel &kernel, size_t in_size, double scale)
spacial_kernel.hh
C1DScalar::input_begin
std_double_vector::iterator input_begin()
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
P1DSpacialKernel
std::shared_ptr< C1DFoldingKernel > P1DSpacialKernel
Definition: spacial_kernel.hh:169
C1DScalar::run
void run()
C1DScalar::get_output_size
size_t get_output_size() const
vector.hh
msgstream.hh
C1DScalar::input_end
std_double_vector::iterator input_end()
C1DScalar::output_end
std_double_vector::iterator output_end()
C1DScalar::std_double_vector
std::vector< double > std_double_vector
Definition: scaler1d.hh:50
C1DScalar
A class for general scaling of one-dimensional arrays.
Definition: scaler1d.hh:48
interpolator1d.hh
CSplineKernel
Base class for all spline based interpolation kernels.
Definition: splinekernel.hh:46
C1DScalar::output_begin
std_double_vector::iterator output_begin()
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
CCmdOptionFlags::input
@ input
CCmdOptionFlags::output
@ output
C1DScalar::C1DScalar
C1DScalar(const CSplineKernel &kernel, size_t in_size, size_t out_size)
PSplineBoundaryCondition
CSplineBoundaryCondition::Pointer PSplineBoundaryCondition
Definition: boundary_conditions.hh:167