File: export_normalizer.cc

package info (click to toggle)
openstructure 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 206,240 kB
  • sloc: cpp: 188,571; python: 36,686; ansic: 34,298; fortran: 3,275; sh: 312; xml: 146; makefile: 29
file content (68 lines) | stat: -rw-r--r-- 2,862 bytes parent folder | download | duplicates (4)
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
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2020 by the OpenStructure authors
// Copyright (C) 2003-2010 by the IPLT authors
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3.0 of the License, or (at your option)
// any later version.
// This library 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 Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//------------------------------------------------------------------------------

/*
  boost::python wrapper for normalizer

  Author: Andreas Schenk
*/

#include <boost/python.hpp>
using namespace boost::python;

#include <ost/img/alg/norm.hh>

using namespace ost;
using namespace ost::img;
using namespace ost::img::alg;
namespace {

Normalizer (*linrange1)(const ConstImageHandle&,Real,Real) = CreateLinearRangeNormalizer;
Normalizer (*linrange2)(Real,Real,Real,Real) = CreateLinearRangeNormalizer;
Normalizer (*logrange1)(const ConstImageHandle&,Real,Real) = CreateLogRangeNormalizer;
Normalizer (*logrange2)(Real,Real,Real,Real) = CreateLogRangeNormalizer;
BOOST_PYTHON_FUNCTION_OVERLOADS(od_overloads, CreateTransmissionToODNormalizer, 2, 3)

} //anon ns

void export_Normalizer()
{
  Complex (Normalizer::*convert_complex)(Complex) const = &Normalizer::Convert;
  Real (Normalizer::*convert_double)(Real) const = &Normalizer::Convert;
  Complex (Normalizer::*backconvert_complex)(Complex) const = &Normalizer::BackConvert;
  Real (Normalizer::*backconvert_double)(Real) const = &Normalizer::BackConvert;
  
  class_<Normalizer,bases<ConstModIPAlgorithm> >("Normalizer",no_init)
   //complex defs first (otherwise Real will be converted to complex)
    .def("Convert",convert_complex)
    .def("Convert",convert_double)
    .def("BackConvert",backconvert_complex)
    .def("BackConvert",backconvert_double)
    ;
  
  def("CreateNoOpNormalizer",CreateNoOpNormalizer);
  def("CreateLinearNormalizer",CreateLinearNormalizer);
  def("CreateLinearRangeNormalizer",linrange1);
  def("CreateLinearRangeNormalizer",linrange2);
  def("CreateLogNormalizer",CreateLogNormalizer);
  def("CreateLogRangeNormalizer",logrange1);
  def("CreateLogRangeNormalizer",logrange2);
  def("CreateTransmissionToODNormalizer",CreateTransmissionToODNormalizer,od_overloads());
}