spacial_kernel.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_core_spacial_kernel_hh
#define mia_core_spacial_kernel_hh
#include <vector>
// MIA specific
#include <mia/core/defines.hh>
#include <mia/core/factory.hh>
NS_MIA_BEGIN
struct EXPORT_CORE spacial_kernel_data {
static const char *data_descr;
};
struct EXPORT_CORE kernel_plugin_type {
static const char *type_descr;
};
class EXPORT_CORE C1DFilterKernel : public CProductBase
{
protected:
C1DFilterKernel(unsigned fsize);
virtual ~C1DFilterKernel();
public:
typedef spacial_kernel_data plugin_data;
typedef kernel_plugin_type plugin_type;
int get_fsize() const;
size_t size() const;
void apply_inplace(std::vector<double>& data) const;
std::vector<double> apply(const std::vector<double>& data) const;
private:
virtual size_t do_size() const = 0;
virtual std::vector<double> do_apply(const std::vector<double>& data) const = 0;
unsigned m_fsize;
};
class EXPORT_CORE C1DFoldingKernel : public C1DFilterKernel
{
public:
typedef std::vector<double> vec_mask;
typedef vec_mask::const_iterator const_iterator;
C1DFoldingKernel(int fsize);
const_iterator begin()const;
const_iterator end()const;
const_iterator dbegin()const;
const_iterator dend()const;
double& operator[](int i)
{
return m_mask[i];
}
double operator[](int i)const
{
return m_mask[i];
}
protected:
typedef vec_mask::iterator iterator;
iterator begin();
iterator end();
iterator dbegin();
iterator dend();
private:
virtual size_t do_size() const;
vec_mask m_mask;
vec_mask m_derivative;
};
typedef TFactory<C1DFoldingKernel> C1DSpacialKernelPlugin;
typedef std::shared_ptr<C1DFoldingKernel> P1DSpacialKernel;
template<> const char *const
TPluginHandler<TFactory<C1DFoldingKernel>>::m_help;
typedef THandlerSingleton<TFactoryPluginHandler<C1DSpacialKernelPlugin>> C1DSpacialKernelPluginHandler;
inline P1DSpacialKernel produce_spacial_kernel(const std::string& descr)
{
return C1DSpacialKernelPluginHandler::instance().produce(descr);
}
FACTORY_TRAIT(C1DSpacialKernelPluginHandler);
NS_MIA_END
#endif
m_help
const char *const TPluginHandler< CSplineBoundaryConditionPlugin >::m_help
Definition boundary_conditions.hh:199
C1DFilterKernel::C1DFilterKernel
C1DFilterKernel(unsigned fsize)
C1DFilterKernel::apply
std::vector< double > apply(const std::vector< double > &data) const
C1DFilterKernel::apply_inplace
void apply_inplace(std::vector< double > &data) const
C1DFilterKernel::plugin_data
spacial_kernel_data plugin_data
define the plugin search path, data part
Definition spacial_kernel.hh:63
C1DFilterKernel::size
size_t size() const
returns the width of the kernel
C1DFilterKernel::plugin_type
kernel_plugin_type plugin_type
define the plugin search path, type part
Definition spacial_kernel.hh:65
C1DFilterKernel::~C1DFilterKernel
virtual ~C1DFilterKernel()
C1DFilterKernel::get_fsize
int get_fsize() const
returns the filter width definition parameter
C1DFoldingKernel::begin
iterator begin()
returns an iterator at the begin of the kernel
C1DFoldingKernel::iterator
vec_mask::iterator iterator
kernel iterator
Definition spacial_kernel.hh:143
C1DFoldingKernel::C1DFoldingKernel
C1DFoldingKernel(int fsize)
C1DFoldingKernel::vec_mask
std::vector< double > vec_mask
Data type of the kernel coefficient vector.
Definition spacial_kernel.hh:106
C1DFoldingKernel::dbegin
iterator dbegin()
returns an iterator at the begin if the derivative of the kernel
C1DFoldingKernel::const_iterator
vec_mask::const_iterator const_iterator
iterator over the kernel
Definition spacial_kernel.hh:109
C1DFoldingKernel::operator[]
double operator[](int i) const
standard access operator, ro version
Definition spacial_kernel.hh:137
C1DFoldingKernel::begin
const_iterator begin() const
returns a constant iterator at the begin of the filter kernel
C1DFoldingKernel::dend
iterator dend()
returns an iterator at the end if the derivative of the kernel
C1DFoldingKernel::end
iterator end()
returns an iterator at the end of the kernel
C1DFoldingKernel::dbegin
const_iterator dbegin() const
returns a constant iterator at the begin of the derivative of the filter kernel
C1DFoldingKernel::end
const_iterator end() const
returns a constant iterator at the end of the filter kernel
C1DFoldingKernel::dend
const_iterator dend() const
returns a constant iterator at the end of the derivative of the filter kernel
C1DFoldingKernel::operator[]
double & operator[](int i)
standard access operator, rw version
Definition spacial_kernel.hh:131
CProductBase
The base class for all plug-in created object.
Definition product_base.hh:41
TFactory
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition factory.hh:51
THandlerSingleton
the singleton that a plug-in handler really is
Definition handler.hh:159
THandlerSingleton< TFactoryPluginHandler< C1DSpacialKernelPlugin > >::instance
static const TFactoryPluginHandler< C1DSpacialKernelPlugin > & instance()
TPluginHandler
The basic template of all plugin handlers.
Definition handler.hh:57
defines.hh
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
factory.hh
FACTORY_TRAIT
#define FACTORY_TRAIT(F)
Definition factory_trait.hh:69
produce_spacial_kernel
P1DSpacialKernel produce_spacial_kernel(const std::string &descr)
Definition spacial_kernel.hh:178
C1DSpacialKernelPlugin
TFactory< C1DFoldingKernel > C1DSpacialKernelPlugin
base class for filters kernels working in the spacial domain
Definition spacial_kernel.hh:167
P1DSpacialKernel
std::shared_ptr< C1DFoldingKernel > P1DSpacialKernel
Definition spacial_kernel.hh:169
C1DSpacialKernelPluginHandler
THandlerSingleton< TFactoryPluginHandler< C1DSpacialKernelPlugin > > C1DSpacialKernelPluginHandler
plugin handler for spaciel filter kernels
Definition spacial_kernel.hh:175
kernel_plugin_type
Definition spacial_kernel.hh:38
kernel_plugin_type::type_descr
static const char * type_descr
Definition spacial_kernel.hh:39
spacial_kernel_data
Definition spacial_kernel.hh:33
spacial_kernel_data::data_descr
static const char * data_descr
Definition spacial_kernel.hh:34