annotate OrthancStone/Sources/Volumes/VolumeReslicer.h @ 1596:4fb8fdf03314

removed annoying whitespace
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 26 Oct 2020 17:51:42 +0100
parents 244ad1e4e76a
children 8563ea5d8ae4
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
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 783
diff changeset
5 * Copyright (C) 2017-2020 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.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
16 *
186
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"
742
fa5febe0f0c2 moved OrientedBoundingBox in the Volumes folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
25 #include "OrientedVolumeBoundingBox.h"
154
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_;
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
45 std::unique_ptr<Orthanc::Image> slice_;
783
cd13a062c9bd DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 742
diff changeset
46 double pixelSpacing_;
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 void CheckIterators(const ImageBuffer3D& source,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 const CoordinateSystem3D& plane,
742
fa5febe0f0c2 moved OrientedBoundingBox in the Volumes folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
50 const OrientedVolumeBoundingBox& box) const;
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 void Reset();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 float GetMinOutputValue() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 float GetMaxOutputValue() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 void SetWindow(float low,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 float high);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 public:
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 VolumeReslicer();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 void GetLinearFunction(float& scaling,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 float& offset) const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 void ResetLinearFunction();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 void SetLinearFunction(float scaling,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 float offset);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 void FitRange(const ImageBuffer3D& image);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void SetWindowing(ImageWindowing windowing,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 const ImageBuffer3D& image,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 float rescaleSlope,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 float rescaleIntercept);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 Orthanc::PixelFormat GetOutputFormat() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 return outputFormat_;
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
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 void SetOutputFormat(Orthanc::PixelFormat format);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 ImageInterpolation GetInterpolation() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 return interpolation_;
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
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 void SetInterpolation(ImageInterpolation interpolation);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 bool IsFastMode() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 return fastMode_;
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
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 void EnableFastMode(bool enabled)
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 fastMode_ = enabled;
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
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 bool IsSuccess() const
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 {
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 return success_;
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
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 const Extent2D& GetOutputExtent() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 const Orthanc::ImageAccessor& GetOutputSlice() const;
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 Orthanc::ImageAccessor* ReleaseOutputSlice();
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 void Apply(const ImageBuffer3D& source,
735
c3bbb130abc4 removing dependencies in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
115 const VolumeImageGeometry& geometry,
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 const CoordinateSystem3D& plane);
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 void Apply(const ImageBuffer3D& source,
735
c3bbb130abc4 removing dependencies in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
119 const VolumeImageGeometry& geometry,
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 const CoordinateSystem3D& plane,
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 double voxelSize);
783
cd13a062c9bd DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 742
diff changeset
122
cd13a062c9bd DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 742
diff changeset
123 double GetPixelSpacing() const;
153
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 };
ae531ab5dcd9 new class: VolumeReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }