Mercurial > hg > orthanc-stone
annotate Framework/Volumes/VolumeReslicer.h @ 269:0dfa83535cd7 am-2
indentation
author | am@osimis.io |
---|---|
date | Wed, 22 Aug 2018 15:22:33 +0200 |
parents | fac46066b933 |
children | b70e9be013e4 |
rev | line source |
---|---|
186 | 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-2018 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 | |
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 | 24 #include "../Toolbox/Extent2D.h" |
25 #include "../Toolbox/OrientedBoundingBox.h" | |
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 } |