OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pixel_sampling.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  pixel sampling encapsulation
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_PIXEL_SAMPLING_H
28 #define IMG_PIXEL_SAMPLING_H
29 
30 #include <ost/img/module_config.hh>
31 #include <ost/img/data_types.hh>
32 #include "vecmat.hh"
33 
34 #include <ost/message.hh>
35 
36 namespace ost { namespace img {
37 
38 class Extent;
39 class Point;
40 
41 class DLLEXPORT InvalidSampling: public Error {
42 public:
44  Error("invalid sampling value used, must be >0")
45  {}
46 };
47 
49 /*
50  This class encapsulates the logic dealing with
51  all aspects of domain-dependent pixel sampling.
52  It is used by the derived Data classes to
53  implement the sampling functionality.
54 */
56 public:
57  PixelSampling();
58  // initialize with spatial sampling always!
59  PixelSampling(const Vec3& spat_sampling, DataDomain d, const Extent& e);
60 
61  const Vec3& GetPixelSampling() const;
62  void SetPixelSampling(const Vec3&);
63 
64  const Vec3& GetSpatialSampling() const;
65  void SetSpatialSampling(const Vec3& d);
66 
67  const Vec3& GetFrequencySampling() const;
68  void SetFrequencySampling(const Vec3& d);
69 
70  void SetDomain(DataDomain d);
71  void SetExtent(const Extent& e);
72 
73  Vec3 Point2Coord(const Point& p) const;
74  Vec3 Coord2Point(const Vec3& c) const;
75 
76  Vec3 Vec2Coord(const Vec3& p) const;
77 
78 private:
79  DataDomain dom_;
80  Vec3 spat_scale_, i_spat_scale_;
81  Vec3 freq_scale_, i_freq_scale_;
82  Vec3 fac_;
83 
84  void set_spat_scale(const Vec3& d);
85  void set_freq_scale(const Vec3& d);
86 };
87 
88 
89 }} // namespace
90 
91 #endif
DataDomain
underlying data type
Definition: data_types.hh:42
Helper class to handle pixel sampling.
Defines lower and upper valid indices.
Definition: extent.hh:60
class encapsulating 1D to 3D point
Definition: point.hh:43
#define DLLEXPORT_OST_IMG_BASE