409
|
1 /**
|
|
2 * Stone of Orthanc
|
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
|
|
4 * Department, University Hospital of Liege, Belgium
|
439
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
|
409
|
6 *
|
|
7 * This program is free software: you can redistribute it and/or
|
|
8 * modify it under the terms of the GNU Affero General Public License
|
|
9 * as published by the Free Software Foundation, either version 3 of
|
|
10 * the License, or (at your option) any later version.
|
|
11 *
|
|
12 * This program is distributed in the hope that it will be useful, but
|
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15 * Affero General Public License for more details.
|
|
16 *
|
|
17 * You should have received a copy of the GNU Affero General Public License
|
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19 **/
|
|
20
|
|
21
|
|
22 #pragma once
|
|
23
|
|
24 #include "../StoneEnumerations.h"
|
|
25 #include "LinearAlgebra.h"
|
|
26
|
|
27 #include <Core/Images/ImageAccessor.h>
|
|
28
|
|
29 namespace OrthancStone
|
|
30 {
|
|
31 class AffineTransform2D
|
|
32 {
|
|
33 private:
|
|
34 Matrix matrix_;
|
|
35
|
|
36 public:
|
|
37 AffineTransform2D();
|
|
38
|
|
39 // The matrix must be 3x3, without perspective effects
|
|
40 AffineTransform2D(const Matrix& m);
|
|
41
|
|
42 AffineTransform2D(const AffineTransform2D& other) :
|
|
43 matrix_(other.matrix_)
|
|
44 {
|
|
45 }
|
|
46
|
|
47 const Matrix& GetHomogeneousMatrix() const
|
|
48 {
|
|
49 return matrix_;
|
|
50 }
|
|
51
|
|
52 void Apply(double& x /* inout */,
|
|
53 double& y /* inout */) const;
|
|
54
|
|
55 void Apply(Orthanc::ImageAccessor& target,
|
|
56 const Orthanc::ImageAccessor& source,
|
|
57 ImageInterpolation interpolation,
|
|
58 bool clear) const;
|
|
59
|
|
60 static AffineTransform2D Invert(const AffineTransform2D& a);
|
|
61
|
|
62 static AffineTransform2D Combine(const AffineTransform2D& a,
|
|
63 const AffineTransform2D& b);
|
|
64
|
|
65 static AffineTransform2D Combine(const AffineTransform2D& a,
|
|
66 const AffineTransform2D& b,
|
|
67 const AffineTransform2D& c);
|
|
68
|
|
69 static AffineTransform2D Combine(const AffineTransform2D& a,
|
|
70 const AffineTransform2D& b,
|
|
71 const AffineTransform2D& c,
|
|
72 const AffineTransform2D& d);
|
|
73
|
|
74 static AffineTransform2D CreateOffset(double dx,
|
|
75 double dy);
|
|
76
|
|
77 static AffineTransform2D CreateScaling(double sx,
|
|
78 double sy);
|
|
79
|
|
80 static AffineTransform2D CreateRotation(double angle);
|
|
81 };
|
|
82 }
|