/usr/include/mia-2.0/mia/3d/splinetransformpenalty.hh is in libmia-2.0-dev 2.0.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2013 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_3d_splinetransformpenalty_hh
#define mia_3d_splinetransformpenalty_hh
#include <mia/3d/interpolator.hh>
#include <mia/3d/datafield.hh>
#include <mia/core/vector.hh>
#include <mia/core/product_base.hh>
NS_MIA_BEGIN
/**
\brief Base class for transformation penalties in spline based deformations
This class ist the base class for the possible penalties on spline based
transformations that provide an additional smoothness constrait.
*/
class EXPORT_3D C3DSplineTransformPenalty : public CProductBase {
public:
typedef C3DSplineTransformPenalty plugin_data;
static const char *data_descr;
typedef C3DSplineTransformPenalty plugin_type;
static const char *type_descr;
/**
Constructor that sets the weight of the penalty term
\param weight
*/
C3DSplineTransformPenalty(double weight);
C3DSplineTransformPenalty(const C3DSplineTransformPenalty& org) = delete;
C3DSplineTransformPenalty& operator = (const C3DSplineTransformPenalty& org) = delete;
/**
Provides a deep copy of the penalty
\returns newly created copy of the spline penalty term.
*/
C3DSplineTransformPenalty *clone() const __attribute__((warn_unused_result));
virtual ~C3DSplineTransformPenalty();
/**
The initializer of the spline transform penalty to set up required data structurs
\param size size of the coefficient field
\param range transformation range
\param kernel kernel used to define the spline transformation
*/
void initialize(const C3DBounds& size, const C3DFVector& range, PSplineKernel kernel);
/**
Evaluate the penalty of a spline transformation defined by its coefficients
\param coefficients the spline transformation coefficients
\returns the weighted penalty
*/
double value(const C3DFVectorfield& coefficients) const;
/**
Evaluate the penalty and the gradient of a spline transformation defined by its coefficients
\param coefficients the spline transformation coefficients
\param[out] gradient the weighted gradient of the spline transformation penalty given so that
coefficients + \f$\delta\f$ gradient moves toward the minimum of the penalty term.
\returns the weighted penalty
*/
double value_and_gradient(const C3DFVectorfield& coefficients, CDoubleVector& gradient) const;
protected:
const C3DBounds& get_size() const;
const C3DFVector& get_range() const;
PSplineKernel get_kernel() const;
double get_weight() const;
private:
virtual void do_initialize() = 0;
virtual double do_value(const C3DFVectorfield& coefficients) const = 0;
virtual double do_value_and_gradient(const C3DFVectorfield& coefficients, CDoubleVector& gradient) const = 0;
virtual C3DSplineTransformPenalty *do_clone() const = 0;
double m_weight;
C3DBounds m_size;
C3DFVector m_range;
PSplineKernel m_kernel;
};
typedef std::shared_ptr<C3DSplineTransformPenalty> P3DSplineTransformPenalty;
class EXPORT_3D C3DSplineTransformPenaltyPlugin: public TFactory<C3DSplineTransformPenalty> {
public:
C3DSplineTransformPenaltyPlugin(char const * const name);
private:
virtual Product *do_create() const __attribute__((warn_unused_result));
virtual Product *do_create(float weight) const __attribute__((warn_unused_result)) = 0 ;
float m_weight;
};
/// Plugin handler for image combiner plugins
typedef THandlerSingleton<TFactoryPluginHandler<C3DSplineTransformPenaltyPlugin> >
C3DSplineTransformPenaltyPluginHandler;
FACTORY_TRAIT(C3DSplineTransformPenaltyPluginHandler);
EXPORT_3D C3DSplineTransformPenaltyPluginHandler::ProductPtr produce_3d_spline_transform_penalty(const std::string& descr);
class EXPORT_3D C3DSplineTransformPenaltyPluginHandlerTest {
public:
C3DSplineTransformPenaltyPluginHandlerTest();
};
NS_MIA_END
#endif
|