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{
49public:
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;
99private:
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
A class for general scaling of one-dimensional arrays.
Definition: scaler1d.hh:48
std::vector< double > std_double_vector
Definition: scaler1d.hh:50
std_double_vector::iterator input_end()
std_double_vector::iterator output_begin()
std_double_vector::iterator input_begin()
void run()
C1DScalar(const CSplineKernel &kernel, size_t in_size, double scale)
size_t get_output_size() const
C1DScalar(const CSplineKernel &kernel, size_t in_size, size_t out_size)
std_double_vector::iterator output_end()
Base class for all spline based interpolation kernels.
Definition: splinekernel.hh:46
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
CSplineBoundaryCondition::Pointer PSplineBoundaryCondition
std::shared_ptr< C1DFoldingKernel > P1DSpacialKernel