comparison OrthancStone/Sources/Volumes/VolumeReslicer.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Volumes/VolumeReslicer.h@8a0a62189f46
children 4fb8fdf03314
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
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 "../Toolbox/Extent2D.h"
25 #include "OrientedVolumeBoundingBox.h"
26 #include "ImageBuffer3D.h"
27
28 namespace OrthancStone
29 {
30 // Hypothesis: The output voxels always have square size
31 class VolumeReslicer : public boost::noncopyable
32 {
33 private:
34 // Input parameters
35 Orthanc::PixelFormat outputFormat_;
36 bool hasLinearFunction_;
37 float scaling_; // "a" in "f(x) = a * x + b"
38 float offset_; // "b" in "f(x) = a * x + b"
39 ImageInterpolation interpolation_;
40 bool fastMode_;
41
42 // Output of reslicing
43 bool success_;
44 Extent2D extent_;
45 std::unique_ptr<Orthanc::Image> slice_;
46 double pixelSpacing_;
47
48 void CheckIterators(const ImageBuffer3D& source,
49 const CoordinateSystem3D& plane,
50 const OrientedVolumeBoundingBox& box) const;
51
52 void Reset();
53
54 float GetMinOutputValue() const;
55
56 float GetMaxOutputValue() const;
57
58 void SetWindow(float low,
59 float high);
60
61 public:
62 VolumeReslicer();
63
64 void GetLinearFunction(float& scaling,
65 float& offset) const;
66
67 void ResetLinearFunction();
68
69 void SetLinearFunction(float scaling,
70 float offset);
71
72 void FitRange(const ImageBuffer3D& image);
73
74 void SetWindowing(ImageWindowing windowing,
75 const ImageBuffer3D& image,
76 float rescaleSlope,
77 float rescaleIntercept);
78
79 Orthanc::PixelFormat GetOutputFormat() const
80 {
81 return outputFormat_;
82 }
83
84 void SetOutputFormat(Orthanc::PixelFormat format);
85
86 ImageInterpolation GetInterpolation() const
87 {
88 return interpolation_;
89 }
90
91 void SetInterpolation(ImageInterpolation interpolation);
92
93 bool IsFastMode() const
94 {
95 return fastMode_;
96 }
97
98 void EnableFastMode(bool enabled)
99 {
100 fastMode_ = enabled;
101 }
102
103 bool IsSuccess() const
104 {
105 return success_;
106 }
107
108 const Extent2D& GetOutputExtent() const;
109
110 const Orthanc::ImageAccessor& GetOutputSlice() const;
111
112 Orthanc::ImageAccessor* ReleaseOutputSlice();
113
114 void Apply(const ImageBuffer3D& source,
115 const VolumeImageGeometry& geometry,
116 const CoordinateSystem3D& plane);
117
118 void Apply(const ImageBuffer3D& source,
119 const VolumeImageGeometry& geometry,
120 const CoordinateSystem3D& plane,
121 double voxelSize);
122
123 double GetPixelSpacing() const;
124 };
125 }