Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Volumes/ImageBuffer3D.h @ 2044:c9dadbe7c7b0 deep-learning
notes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 05 Mar 2023 15:05:58 +0100 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 7 * |
8 * 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:
1564
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
47 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
0 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * 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:
1564
diff
changeset
|
15 * 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:
1564
diff
changeset
|
16 * Lesser General Public License for more details. |
318
3a4ca166fafa
ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents:
212
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1564
diff
changeset
|
18 * 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:
1564
diff
changeset
|
19 * 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:
1564
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
0 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
194
7a031ac16b2d
rename Enumerations.h to StoneEnumerations.h to avoid clashes with Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
192
diff
changeset
|
26 #include "../StoneEnumerations.h" |
735
c3bbb130abc4
removing dependencies in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
734
diff
changeset
|
27 #include "../Toolbox/LinearAlgebra.h" |
0 | 28 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
29 #include <Compatibility.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1298
diff
changeset
|
30 #include <Images/Image.h> |
0 | 31 |
32 namespace OrthancStone | |
33 { | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
34 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
35 |
1785
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
36 IMPORTANT: The "ImageBuffer3D" class is *not* meant to be accessed |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
37 directly by the end users using the "GetVoxelXXX()" methods, |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
38 because of the swapping of the Z-axis (see below). The public |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
39 interactions with this class should be limited to: |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
40 |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
41 1- Using "SliceReader" and "SliceWriter" to access the raw slices, |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
42 but only on the axial projection, *and* using the "z" |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
43 coordinates returned by some "SlicesSorter" object |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
44 |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
45 2- Extracting slices using a cutting plane through class deriving |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
46 from the "IVolumeSlicer" interface |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
47 |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
48 |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
49 IMPLEMENTATION NOTE: This classes stores volume images sliced across |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
50 the Z axis, vertically, in the DECREASING Z-order along the normal |
58bebc904191
notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
51 (this is the REVERSE of the intuitive order): |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
52 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
53 +---------------+ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
54 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
55 | SLICE N-1 | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
56 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
57 +---------------+ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
58 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
59 | SLICE N-2 | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
60 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
61 +---------------+ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
62 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
63 | SLICE N-3 | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
64 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
65 . . |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
66 ...... ...... |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
67 . . |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
68 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
69 | SLICE 2 | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
70 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
71 +---------------+ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
72 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
73 | SLICE 1 | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
74 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
75 +---------------+ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
76 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
77 | SLICE 0 | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
78 | | |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
79 +---------------+ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
80 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
81 As you can see, if the 3d image has size width, height, depth, the 2d image has : |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
82 - 2d width = 3d width |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
83 - 2d height = 3d height * 3d depth |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
84 |
1783
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
85 This explains the "depth_ - 1 - z" that are used throughout this class. |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
86 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
87 EXPLANATION: This allows to have the "SliceReader" and "SliceWriter" |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
88 accessors for axial and coronal projections to directly access the |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
89 same memory buffer (no memcpy is required), while being consistent |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
90 with the Z-axis in coronal projection. The sagittal projection |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
91 nevertheless needs a memcpy. |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
92 |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
93 */ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
94 |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
95 class ImageBuffer3D : public boost::noncopyable |
0 | 96 { |
97 private: | |
98 Orthanc::Image image_; | |
99 Orthanc::PixelFormat format_; | |
100 unsigned int width_; | |
101 unsigned int height_; | |
102 unsigned int depth_; | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
103 bool computeRange_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
104 bool hasRange_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
105 float minValue_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
106 float maxValue_; |
683
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
107 Matrix transform_; |
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
108 Matrix transformInverse_; |
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
109 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
110 void ExtendImageRange(const Orthanc::ImageAccessor& slice); |
0 | 111 |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
112 void GetAxialSliceAccessor(Orthanc::ImageAccessor& target, |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
113 unsigned int slice, |
1564
e731e62692a9
upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
114 bool readOnly); |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
115 |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
116 void GetCoronalSliceAccessor(Orthanc::ImageAccessor& target, |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
117 unsigned int slice, |
1564
e731e62692a9
upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
118 bool readOnly); |
0 | 119 |
120 Orthanc::Image* ExtractSagittalSlice(unsigned int slice) const; | |
121 | |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
122 void CommitSagittalSlice(unsigned int slice, |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
123 const Orthanc::ImageAccessor& source); |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
124 |
143 | 125 template <typename T> |
126 T GetPixelUnchecked(unsigned int x, | |
127 unsigned int y, | |
128 unsigned int z) const | |
129 { | |
130 const uint8_t* buffer = reinterpret_cast<const uint8_t*>(image_.GetConstBuffer()); | |
131 const uint8_t* row = buffer + (y + height_ * (depth_ - 1 - z)) * image_.GetPitch(); | |
132 return reinterpret_cast<const T*>(row) [x]; | |
133 } | |
134 | |
0 | 135 public: |
136 ImageBuffer3D(Orthanc::PixelFormat format, | |
137 unsigned int width, | |
138 unsigned int height, | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
139 unsigned int depth, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
140 bool computeRange); |
0 | 141 |
142 void Clear(); | |
143 | |
179
db21c1810c89
moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
149
diff
changeset
|
144 const Orthanc::ImageAccessor& GetInternalImage() const |
db21c1810c89
moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
149
diff
changeset
|
145 { |
db21c1810c89
moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
149
diff
changeset
|
146 return image_; |
db21c1810c89
moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
149
diff
changeset
|
147 } |
db21c1810c89
moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
149
diff
changeset
|
148 |
0 | 149 unsigned int GetWidth() const |
150 { | |
151 return width_; | |
152 } | |
153 | |
154 unsigned int GetHeight() const | |
155 { | |
156 return height_; | |
157 } | |
158 | |
159 unsigned int GetDepth() const | |
160 { | |
161 return depth_; | |
162 } | |
163 | |
164 Orthanc::PixelFormat GetFormat() const | |
165 { | |
166 return format_; | |
167 } | |
168 | |
765 | 169 unsigned int GetBytesPerPixel() const |
170 { | |
171 return Orthanc::GetBytesPerPixel(format_); | |
172 } | |
173 | |
105 | 174 uint64_t GetEstimatedMemorySize() const; |
175 | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
176 bool GetRange(float& minValue, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
177 float& maxValue) const; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
178 |
143 | 179 uint8_t GetVoxelGrayscale8Unchecked(unsigned int x, |
180 unsigned int y, | |
181 unsigned int z) const | |
182 { | |
183 return GetPixelUnchecked<uint8_t>(x, y, z); | |
184 } | |
185 | |
186 uint16_t GetVoxelGrayscale16Unchecked(unsigned int x, | |
187 unsigned int y, | |
188 unsigned int z) const | |
189 { | |
190 return GetPixelUnchecked<uint16_t>(x, y, z); | |
191 } | |
192 | |
149
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
193 int16_t GetVoxelSignedGrayscale16Unchecked(unsigned int x, |
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
194 unsigned int y, |
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
195 unsigned int z) const |
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
196 { |
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
197 return GetPixelUnchecked<int16_t>(x, y, z); |
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
198 } |
f7be90de6d1b
ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
143
diff
changeset
|
199 |
143 | 200 uint8_t GetVoxelGrayscale8(unsigned int x, |
141
88bca952cb17
ImageBuffer3D::GetPixelGrayscale8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
139
diff
changeset
|
201 unsigned int y, |
88bca952cb17
ImageBuffer3D::GetPixelGrayscale8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
139
diff
changeset
|
202 unsigned int z) const; |
88bca952cb17
ImageBuffer3D::GetPixelGrayscale8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
139
diff
changeset
|
203 |
143 | 204 uint16_t GetVoxelGrayscale16(unsigned int x, |
139
22628d37ef5c
ImageBuffer3D::GetPixelGrayscale16
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
205 unsigned int y, |
22628d37ef5c
ImageBuffer3D::GetPixelGrayscale16
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
206 unsigned int z) const; |
22628d37ef5c
ImageBuffer3D::GetPixelGrayscale16
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
207 |
684
7719eb852dd5
new class: VolumeImageGeometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
208 |
0 | 209 class SliceReader : public boost::noncopyable |
210 { | |
211 private: | |
212 Orthanc::ImageAccessor accessor_; | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
213 std::unique_ptr<Orthanc::Image> sagittal_; // Unused for axial and coronal |
0 | 214 |
215 public: | |
192
371da7fe2c0e
FiniteProjectiveCamera::ApplyRaytracer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
187
diff
changeset
|
216 SliceReader(const ImageBuffer3D& that, |
0 | 217 VolumeProjection projection, |
218 unsigned int slice); | |
219 | |
220 const Orthanc::ImageAccessor& GetAccessor() const | |
221 { | |
222 return accessor_; | |
223 } | |
224 }; | |
225 | |
226 | |
227 class SliceWriter : public boost::noncopyable | |
228 { | |
229 private: | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
230 ImageBuffer3D& that_; |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
231 bool modified_; |
0 | 232 Orthanc::ImageAccessor accessor_; |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
233 std::unique_ptr<Orthanc::Image> sagittal_; // Unused for axial and coronal |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
234 unsigned int slice_; |
0 | 235 |
236 void Flush(); | |
237 | |
238 public: | |
239 SliceWriter(ImageBuffer3D& that, | |
240 VolumeProjection projection, | |
241 unsigned int slice); | |
242 | |
243 ~SliceWriter() | |
244 { | |
245 Flush(); | |
246 } | |
247 | |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
248 const Orthanc::ImageAccessor& GetAccessor() const |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
249 { |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
250 return accessor_; |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
251 } |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
252 |
0 | 253 Orthanc::ImageAccessor& GetAccessor() |
254 { | |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
255 modified_ = true; |
0 | 256 return accessor_; |
257 } | |
258 }; | |
259 }; | |
260 } |