Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h @ 1768:226718777702
fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 May 2021 17:18:39 +0200 |
parents | 9ac2a65d4172 |
children | a217140dd41a |
rev | line source |
---|---|
590 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1610
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
590 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
590 | 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 | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
590 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "ISceneLayer.h" | |
26 #include "../Toolbox/AffineTransform2D.h" | |
27 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
28 #include <Compatibility.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
29 #include <Images/ImageAccessor.h> |
590 | 30 |
31 namespace OrthancStone | |
32 { | |
33 class TextureBaseSceneLayer : public ISceneLayer | |
34 { | |
35 private: | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
36 std::unique_ptr<Orthanc::ImageAccessor> texture_; |
590 | 37 double originX_; |
38 double originY_; | |
39 double pixelSpacingX_; | |
40 double pixelSpacingY_; | |
41 double angle_; | |
42 bool isLinearInterpolation_; | |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
43 bool flipX_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
44 bool flipY_; |
590 | 45 uint64_t revision_; |
1768
226718777702
fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
46 std::unique_ptr<AffineTransform2D> transform_; // Manually-specified transformation |
590 | 47 |
48 protected: | |
49 void SetTexture(Orthanc::ImageAccessor* texture); | |
50 | |
51 void IncrementRevision() | |
52 { | |
53 revision_++; | |
54 } | |
55 | |
56 void CopyParameters(const TextureBaseSceneLayer& other); | |
57 | |
58 public: | |
59 TextureBaseSceneLayer(); | |
60 | |
61 // Center of the top-left pixel | |
62 void SetOrigin(double x, | |
63 double y); | |
64 | |
65 void SetPixelSpacing(double sx, | |
66 double sy); | |
67 | |
68 // In radians | |
69 void SetAngle(double angle); | |
70 | |
71 void SetLinearInterpolation(bool isLinearInterpolation); | |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
72 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
73 void SetFlipX(bool flip); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
74 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
75 void SetFlipY(bool flip); |
590 | 76 |
77 double GetOriginX() const | |
78 { | |
79 return originX_; | |
80 } | |
81 | |
82 double GetOriginY() const | |
83 { | |
84 return originY_; | |
85 } | |
86 | |
87 double GetPixelSpacingX() const | |
88 { | |
89 return pixelSpacingX_; | |
90 } | |
91 | |
92 double GetPixelSpacingY() const | |
93 { | |
94 return pixelSpacingY_; | |
95 } | |
96 | |
97 double GetAngle() const | |
98 { | |
99 return angle_; | |
100 } | |
101 | |
102 bool IsLinearInterpolation() const | |
103 { | |
104 return isLinearInterpolation_; | |
105 } | |
106 | |
107 bool HasTexture() const | |
108 { | |
109 return (texture_.get() != NULL); | |
110 } | |
111 | |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
112 bool IsFlipX() const |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
113 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
114 return flipX_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
115 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
116 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
117 bool IsFlipY() const |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
118 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
119 return flipY_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
120 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
121 |
590 | 122 const Orthanc::ImageAccessor& GetTexture() const; |
123 | |
1768
226718777702
fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
124 void SetTransform(const AffineTransform2D& transform); |
226718777702
fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
125 |
226718777702
fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
126 void ClearTransform(); |
226718777702
fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
127 |
590 | 128 AffineTransform2D GetTransform() const; |
129 | |
1610
b7630b1a0253
ISceneLayer::GetBoundingBox() returns void
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
130 virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE; |
590 | 131 |
1571 | 132 virtual uint64_t GetRevision() const ORTHANC_OVERRIDE |
590 | 133 { |
134 return revision_; | |
135 } | |
136 }; | |
137 } |