annotate Framework/Volumes/VolumeReslicer.h @ 627:b7fd0471281c am-dev

fix CodeGeneration unit tests
author Alain Mazy <alain@mazy.be>
date Wed, 08 May 2019 10:51:41 +0200
parents b70e9be013e4
children c3bbb130abc4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
186
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
1 /**
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
2 * Stone of Orthanc
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 186
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
186
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
6 *
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
7 * This program is free software: you can redistribute it and/or
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
10 * the License, or (at your option) any later version.
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
11 *
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
12 * This program is distributed in the hope that it will be useful, but
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
15 * Affero General Public License for more details.
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
16 *
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
19 **/
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
20
fac46066b933 missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 154
diff changeset
21
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
154
7a52c968ea1b reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
24 #include "../Toolbox/Extent2D.h"
7a52c968ea1b reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
25 #include "../Toolbox/OrientedBoundingBox.h"
7a52c968ea1b reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 153
diff changeset
26 #include "ImageBuffer3D.h"
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancStone
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 // Hypothesis: The output voxels always have square size
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 class VolumeReslicer : public boost::noncopyable
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 private:
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 // Input parameters
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 Orthanc::PixelFormat outputFormat_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 bool hasLinearFunction_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 float scaling_; // "a" in "f(x) = a * x + b"
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 float offset_; // "b" in "f(x) = a * x + b"
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 ImageInterpolation interpolation_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 bool fastMode_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 // Output of reslicing
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 bool success_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 Extent2D extent_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 std::auto_ptr<Orthanc::Image> slice_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 void CheckIterators(const ImageBuffer3D& source,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 const CoordinateSystem3D& plane,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 const OrientedBoundingBox& box) const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 void Reset();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 float GetMinOutputValue() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 float GetMaxOutputValue() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 void SetWindow(float low,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 float high);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 public:
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 VolumeReslicer();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 void GetLinearFunction(float& scaling,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 float& offset) const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 void ResetLinearFunction();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 void SetLinearFunction(float scaling,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 float offset);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 void FitRange(const ImageBuffer3D& image);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 void SetWindowing(ImageWindowing windowing,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 const ImageBuffer3D& image,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 float rescaleSlope,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 float rescaleIntercept);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 Orthanc::PixelFormat GetOutputFormat() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 return outputFormat_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 }
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 void SetOutputFormat(Orthanc::PixelFormat format);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 ImageInterpolation GetInterpolation() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 return interpolation_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 void SetInterpolation(ImageInterpolation interpolation);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 bool IsFastMode() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 return fastMode_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 }
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 void EnableFastMode(bool enabled)
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 fastMode_ = enabled;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 }
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 bool IsSuccess() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 return success_;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 const Extent2D& GetOutputExtent() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 const Orthanc::ImageAccessor& GetOutputSlice() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 Orthanc::ImageAccessor* ReleaseOutputSlice();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 void Apply(const ImageBuffer3D& source,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 const CoordinateSystem3D& plane);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 void Apply(const ImageBuffer3D& source,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 const CoordinateSystem3D& plane,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 double voxelSize);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 };
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 }