Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/SubvoxelReader.h @ 1644:4796fb60999e
removing methods from SortedFrames to simplify api
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Nov 2020 18:08:16 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
rev | line source |
---|---|
183 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
183 | 6 * |
7 * 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:
1596
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
183 | 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 | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
14 * 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:
1596
diff
changeset
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
17 * 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:
1596
diff
changeset
|
18 * 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:
1596
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
183 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../Volumes/ImageBuffer3D.h" | |
26 #include "GeometryToolbox.h" | |
27 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
28 #include <Images/ImageTraits.h> |
183 | 29 |
30 #include <boost/noncopyable.hpp> | |
31 #include <cmath> | |
32 | |
33 namespace OrthancStone | |
34 { | |
35 namespace Internals | |
36 { | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
37 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
38 WARNING : the slice order is different between this class and ImageBuffer3D |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
39 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
40 See the comment above ImageBuffer3D declaration. |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
41 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
42 The slices are supposed to be stored in INCREASING z-order in this class! |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
43 */ |
183 | 44 class SubvoxelReaderBase : public boost::noncopyable |
45 { | |
46 private: | |
47 const ImageBuffer3D& source_; | |
48 unsigned int width_; | |
49 unsigned int height_; | |
50 unsigned int depth_; | |
51 | |
52 public: | |
1571 | 53 explicit SubvoxelReaderBase(const ImageBuffer3D& source) : |
183 | 54 source_(source), |
55 width_(source.GetWidth()), | |
56 height_(source.GetHeight()), | |
57 depth_(source.GetDepth()) | |
58 { | |
59 } | |
60 | |
61 ORTHANC_FORCE_INLINE | |
62 const Orthanc::ImageAccessor& GetSource() const | |
63 { | |
64 return source_.GetInternalImage(); | |
65 } | |
66 | |
67 ORTHANC_FORCE_INLINE | |
68 unsigned int GetWidth() const | |
69 { | |
70 return width_; | |
71 } | |
72 | |
73 ORTHANC_FORCE_INLINE | |
74 unsigned int GetHeight() const | |
75 { | |
76 return height_; | |
77 } | |
78 | |
79 ORTHANC_FORCE_INLINE | |
80 unsigned int GetDepth() const | |
81 { | |
82 return depth_; | |
83 } | |
84 | |
85 ORTHANC_FORCE_INLINE | |
86 unsigned int ComputeRow(unsigned int y, | |
87 unsigned int z) const | |
88 { | |
89 return z * height_ + y; | |
90 } | |
91 }; | |
92 } | |
93 | |
94 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
95 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
96 WARNING : the slice order is different between this class and ImageBuffer3D |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
97 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
98 See the comment above ImageBuffer3D declaration. |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
99 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
100 The slices are supposed to be stored in INCREASING z-order in this class! |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
101 */ |
183 | 102 template <Orthanc::PixelFormat Format, |
103 ImageInterpolation Interpolation> | |
104 class SubvoxelReader; | |
105 | |
106 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
107 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
108 WARNING : the slice order is different between this class and ImageBuffer3D |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
109 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
110 See the comment above ImageBuffer3D declaration. |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
111 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
112 The slices are supposed to be stored in INCREASING z-order in this class! |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
113 */ |
183 | 114 template <Orthanc::PixelFormat Format> |
115 class SubvoxelReader<Format, ImageInterpolation_Nearest> : | |
116 public Internals::SubvoxelReaderBase | |
117 { | |
118 public: | |
119 typedef Orthanc::PixelTraits<Format> Traits; | |
120 typedef typename Traits::PixelType PixelType; | |
121 | |
1571 | 122 explicit SubvoxelReader(const ImageBuffer3D& source) : |
183 | 123 SubvoxelReaderBase(source) |
124 { | |
125 } | |
126 | |
127 inline bool GetValue(PixelType& target, | |
128 float x, | |
129 float y, | |
130 float z) const; | |
131 | |
132 inline bool GetFloatValue(float& target, | |
133 float x, | |
134 float y, | |
135 float z) const; | |
136 }; | |
137 | |
138 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
139 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
140 WARNING : the slice order is different between this class and ImageBuffer3D |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
141 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
142 See the comment above ImageBuffer3D declaration. |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
143 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
144 The slices are supposed to be stored in INCREASING z-order in this class! |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
145 */ |
183 | 146 template <Orthanc::PixelFormat Format> |
147 class SubvoxelReader<Format, ImageInterpolation_Bilinear> : | |
148 public Internals::SubvoxelReaderBase | |
149 { | |
150 public: | |
151 typedef Orthanc::PixelTraits<Format> Traits; | |
152 typedef typename Traits::PixelType PixelType; | |
153 | |
1571 | 154 explicit SubvoxelReader(const ImageBuffer3D& source) : |
183 | 155 SubvoxelReaderBase(source) |
156 { | |
157 } | |
158 | |
159 inline bool Sample(float& f00, | |
160 float& f01, | |
161 float& f10, | |
162 float& f11, | |
163 unsigned int ux, | |
164 unsigned int uy, | |
165 unsigned int uz) const; | |
166 | |
167 inline bool GetValue(PixelType& target, | |
168 float x, | |
169 float y, | |
170 float z) const; | |
171 | |
172 inline bool GetFloatValue(float& target, | |
173 float x, | |
174 float y, | |
175 float z) const; | |
176 }; | |
177 | |
178 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
179 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
180 WARNING : the slice order is different between this class and ImageBuffer3D |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
181 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
182 See the comment above ImageBuffer3D declaration. |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
183 |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
184 The slices are supposed to be stored in INCREASING z-order in this class! |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
185 */ |
183 | 186 template <Orthanc::PixelFormat Format> |
187 class SubvoxelReader<Format, ImageInterpolation_Trilinear> : | |
188 public Internals::SubvoxelReaderBase | |
189 { | |
190 private: | |
191 SubvoxelReader<Format, ImageInterpolation_Bilinear> bilinear_; | |
192 | |
193 public: | |
194 typedef Orthanc::PixelTraits<Format> Traits; | |
195 typedef typename Traits::PixelType PixelType; | |
196 | |
1571 | 197 explicit SubvoxelReader(const ImageBuffer3D& source) : |
183 | 198 SubvoxelReaderBase(source), |
199 bilinear_(source) | |
200 { | |
201 } | |
202 | |
203 inline bool GetValue(PixelType& target, | |
204 float x, | |
205 float y, | |
206 float z) const; | |
207 | |
208 inline bool GetFloatValue(float& target, | |
209 float x, | |
210 float y, | |
211 float z) const; | |
212 }; | |
213 | |
214 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
215 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
216 See important comment above |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
217 */ |
183 | 218 |
219 template <Orthanc::PixelFormat Format> | |
220 bool SubvoxelReader<Format, ImageInterpolation_Nearest>::GetValue(PixelType& target, | |
221 float x, | |
222 float y, | |
223 float z) const | |
224 { | |
225 if (x < 0 || | |
226 y < 0 || | |
227 z < 0) | |
228 { | |
229 return false; | |
230 } | |
231 else | |
232 { | |
233 unsigned int ux = static_cast<unsigned int>(std::floor(x)); | |
234 unsigned int uy = static_cast<unsigned int>(std::floor(y)); | |
235 unsigned int uz = static_cast<unsigned int>(std::floor(z)); | |
236 | |
237 if (ux < GetWidth() && | |
238 uy < GetHeight() && | |
239 uz < GetDepth()) | |
240 { | |
241 Orthanc::ImageTraits<Format>::GetPixel(target, GetSource(), ux, ComputeRow(uy, uz)); | |
242 return true; | |
243 } | |
244 else | |
245 { | |
246 return false; | |
247 } | |
248 } | |
249 } | |
250 | |
251 | |
252 template <Orthanc::PixelFormat Format> | |
253 bool SubvoxelReader<Format, ImageInterpolation_Nearest>::GetFloatValue(float& target, | |
254 float x, | |
255 float y, | |
256 float z) const | |
257 { | |
258 PixelType value; | |
259 | |
260 if (GetValue(value, x, y, z)) | |
261 { | |
262 target = Traits::PixelToFloat(value); | |
263 return true; | |
264 } | |
265 else | |
266 { | |
267 return false; | |
268 } | |
269 } | |
270 | |
271 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
272 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
273 See important comment above |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
274 */ |
183 | 275 |
276 template <Orthanc::PixelFormat Format> | |
277 bool SubvoxelReader<Format, ImageInterpolation_Bilinear>::Sample(float& f00, | |
278 float& f01, | |
279 float& f10, | |
280 float& f11, | |
281 unsigned int ux, | |
282 unsigned int uy, | |
283 unsigned int uz) const | |
284 { | |
285 if (ux < GetWidth() && | |
286 uy < GetHeight() && | |
287 uz < GetDepth()) | |
288 { | |
289 f00 = Orthanc::ImageTraits<Format>::GetFloatPixel(GetSource(), ux, ComputeRow(uy, uz)); | |
290 } | |
291 else | |
292 { | |
293 // Pixel is out of the volume | |
294 return false; | |
295 } | |
296 | |
297 if (ux + 1 < GetWidth()) | |
298 { | |
299 f01 = Orthanc::ImageTraits<Format>::GetFloatPixel(GetSource(), ux + 1, ComputeRow(uy, uz)); | |
300 } | |
301 else | |
302 { | |
303 f01 = f00; | |
304 } | |
305 | |
306 if (uy + 1 < GetHeight()) | |
307 { | |
308 f10 = Orthanc::ImageTraits<Format>::GetFloatPixel(GetSource(), ux, ComputeRow(uy + 1, uz)); | |
309 } | |
310 else | |
311 { | |
312 f10 = f00; | |
313 } | |
314 | |
315 if (ux + 1 < GetWidth() && | |
316 uy + 1 < GetHeight()) | |
317 { | |
318 f11 = Orthanc::ImageTraits<Format>::GetFloatPixel(GetSource(), ux + 1, ComputeRow(uy + 1, uz)); | |
319 } | |
320 else | |
321 { | |
322 f11 = f00; | |
323 } | |
324 | |
325 return true; | |
326 } | |
327 | |
328 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
329 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
330 See important comment above |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
331 */ |
183 | 332 |
333 template <Orthanc::PixelFormat Format> | |
334 bool SubvoxelReader<Format, ImageInterpolation_Bilinear>::GetFloatValue(float& target, | |
335 float x, | |
336 float y, | |
337 float z) const | |
338 { | |
339 x -= 0.5f; | |
340 y -= 0.5f; | |
341 | |
342 if (x < 0 || | |
343 y < 0 || | |
344 z < 0) | |
345 { | |
346 return false; | |
347 } | |
348 else | |
349 { | |
350 unsigned int ux = static_cast<unsigned int>(std::floor(x)); | |
351 unsigned int uy = static_cast<unsigned int>(std::floor(y)); | |
352 unsigned int uz = static_cast<unsigned int>(std::floor(z)); | |
353 | |
354 float f00, f01, f10, f11; | |
355 if (Sample(f00, f01, f10, f11, ux, uy, uz)) | |
356 { | |
357 float ax = x - static_cast<float>(ux); | |
358 float ay = y - static_cast<float>(uy); | |
359 | |
360 target = GeometryToolbox::ComputeBilinearInterpolationUnitSquare(ax, ay, f00, f01, f10, f11); | |
361 return true; | |
362 } | |
363 else | |
364 { | |
365 return false; | |
366 } | |
367 } | |
368 } | |
369 | |
370 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
371 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
372 See important comment above |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
373 */ |
183 | 374 |
375 template <Orthanc::PixelFormat Format> | |
376 bool SubvoxelReader<Format, ImageInterpolation_Bilinear>::GetValue(PixelType& target, | |
377 float x, | |
378 float y, | |
379 float z) const | |
380 { | |
381 float value; | |
382 | |
383 if (GetFloatValue(value, x, y, z)) | |
384 { | |
385 Traits::FloatToPixel(target, value); | |
386 return true; | |
387 } | |
388 else | |
389 { | |
390 return false; | |
391 } | |
392 } | |
393 | |
394 | |
395 | |
396 template <Orthanc::PixelFormat Format> | |
397 bool SubvoxelReader<Format, ImageInterpolation_Trilinear>::GetFloatValue(float& target, | |
398 float x, | |
399 float y, | |
400 float z) const | |
401 { | |
402 x -= 0.5f; | |
403 y -= 0.5f; | |
404 z -= 0.5f; | |
405 | |
406 if (x < 0 || | |
407 y < 0 || | |
408 z < 0) | |
409 { | |
410 return false; | |
411 } | |
412 else | |
413 { | |
414 unsigned int ux = static_cast<unsigned int>(std::floor(x)); | |
415 unsigned int uy = static_cast<unsigned int>(std::floor(y)); | |
416 unsigned int uz = static_cast<unsigned int>(std::floor(z)); | |
417 | |
418 float f000, f001, f010, f011; | |
419 if (bilinear_.Sample(f000, f001, f010, f011, ux, uy, uz)) | |
420 { | |
421 const float ax = x - static_cast<float>(ux); | |
422 const float ay = y - static_cast<float>(uy); | |
423 | |
424 float f100, f101, f110, f111; | |
425 | |
426 if (bilinear_.Sample(f100, f101, f110, f111, ux, uy, uz + 1)) | |
427 { | |
428 const float az = z - static_cast<float>(uz); | |
429 target = GeometryToolbox::ComputeTrilinearInterpolationUnitSquare | |
430 (ax, ay, az, f000, f001, f010, f011, f100, f101, f110, f111); | |
431 } | |
432 else | |
433 { | |
434 target = GeometryToolbox::ComputeBilinearInterpolationUnitSquare | |
435 (ax, ay, f000, f001, f010, f011); | |
436 } | |
437 | |
438 return true; | |
439 } | |
440 else | |
441 { | |
442 return false; | |
443 } | |
444 } | |
445 } | |
446 | |
447 | |
1488
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
448 /* |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
449 See important comment above |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
450 */ |
7f16987131e1
Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents:
1455
diff
changeset
|
451 |
183 | 452 |
453 template <Orthanc::PixelFormat Format> | |
454 bool SubvoxelReader<Format, ImageInterpolation_Trilinear>::GetValue(PixelType& target, | |
455 float x, | |
456 float y, | |
457 float z) const | |
458 { | |
459 float value; | |
460 | |
461 if (GetFloatValue(value, x, y, z)) | |
462 { | |
463 Traits::FloatToPixel(target, value); | |
464 return true; | |
465 } | |
466 else | |
467 { | |
468 return false; | |
469 } | |
470 } | |
471 } |