comparison Framework/Volumes/VolumeReslicer.cpp @ 180:4da803580da9 wasm

remove macro ORTHANC_STONE_FORCE_INLINE
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Mar 2018 20:02:39 +0100
parents db21c1810c89
children 98da3a8d4820
comparison
equal deleted inserted replaced
179:db21c1810c89 180:4da803580da9
5 #include <Core/Images/ImageTraits.h> 5 #include <Core/Images/ImageTraits.h>
6 #include <Core/Logging.h> 6 #include <Core/Logging.h>
7 #include <Core/OrthancException.h> 7 #include <Core/OrthancException.h>
8 8
9 #include <boost/math/special_functions/round.hpp> 9 #include <boost/math/special_functions/round.hpp>
10
11 #if defined(_MSC_VER)
12 # define ORTHANC_STONE_FORCE_INLINE __forceinline
13 #elif defined(__GNUC__) || defined(__clang__) || defined(__EMSCRIPTEN__)
14 # define ORTHANC_STONE_FORCE_INLINE inline __attribute((always_inline))
15 #else
16 # error Please support your compiler here
17 #endif
18 10
19 11
20 namespace OrthancStone 12 namespace OrthancStone
21 { 13 {
22 // Anonymous namespace to avoid clashes between compilation modules 14 // Anonymous namespace to avoid clashes between compilation modules
56 *pixel = static_cast<OutputPixelType>(value); 48 *pixel = static_cast<OutputPixelType>(value);
57 } 49 }
58 } 50 }
59 51
60 public: 52 public:
61 ORTHANC_STONE_FORCE_INLINE 53 ORTHANC_FORCE_INLINE
62 void SetFloatValue(OutputPixelType* pixel, 54 void SetFloatValue(OutputPixelType* pixel,
63 float value) const 55 float value) const
64 { 56 {
65 SetValueInternal<float>(pixel, value); 57 SetValueInternal<float>(pixel, value);
66 } 58 }
67 59
68 ORTHANC_STONE_FORCE_INLINE 60 ORTHANC_FORCE_INLINE
69 void SetValue(OutputPixelType* pixel, 61 void SetValue(OutputPixelType* pixel,
70 const InputPixelType& value) const 62 const InputPixelType& value) const
71 { 63 {
72 SetValueInternal<InputPixelType>(pixel, value); 64 SetValueInternal<InputPixelType>(pixel, value);
73 } 65 }
106 pixel->red_ = v; 98 pixel->red_ = v;
107 pixel->alpha_ = 255; 99 pixel->alpha_ = 255;
108 } 100 }
109 101
110 public: 102 public:
111 ORTHANC_STONE_FORCE_INLINE 103 ORTHANC_FORCE_INLINE
112 void SetFloatValue(OutputPixelType* pixel, 104 void SetFloatValue(OutputPixelType* pixel,
113 float value) const 105 float value) const
114 { 106 {
115 SetValueInternal<float>(pixel, value); 107 SetValueInternal<float>(pixel, value);
116 } 108 }
117 109
118 ORTHANC_STONE_FORCE_INLINE 110 ORTHANC_FORCE_INLINE
119 void SetValue(OutputPixelType* pixel, 111 void SetValue(OutputPixelType* pixel,
120 const InputPixelType& value) const 112 const InputPixelType& value) const
121 { 113 {
122 SetValueInternal<InputPixelType>(pixel, value); 114 SetValueInternal<InputPixelType>(pixel, value);
123 } 115 }
227 VoxelReader(const ImageBuffer3D& image) : 219 VoxelReader(const ImageBuffer3D& image) :
228 VoxelReaderBase(image) 220 VoxelReaderBase(image)
229 { 221 {
230 } 222 }
231 223
232 ORTHANC_STONE_FORCE_INLINE 224 ORTHANC_FORCE_INLINE
233 float GetFloatValue(float volumeX, 225 float GetFloatValue(float volumeX,
234 float volumeY, 226 float volumeY,
235 float volumeZ) const 227 float volumeZ) const
236 { 228 {
237 InputPixelType value; 229 InputPixelType value;
238 GetValue(value, volumeX, volumeY, volumeZ); 230 GetValue(value, volumeX, volumeY, volumeZ);
239 return static_cast<float>(value); 231 return static_cast<float>(value);
240 } 232 }
241 233
242 ORTHANC_STONE_FORCE_INLINE 234 ORTHANC_FORCE_INLINE
243 void GetValue(InputPixelType& target, 235 void GetValue(InputPixelType& target,
244 float volumeX, 236 float volumeX,
245 float volumeY, 237 float volumeY,
246 float volumeZ) const 238 float volumeZ) const
247 { 239 {
424 float /* offset */) : 416 float /* offset */) :
425 reader_(image) 417 reader_(image)
426 { 418 {
427 } 419 }
428 420
429 ORTHANC_STONE_FORCE_INLINE 421 ORTHANC_FORCE_INLINE
430 void Apply(typename PixelWriter::OutputPixelType* pixel, 422 void Apply(typename PixelWriter::OutputPixelType* pixel,
431 float volumeX, 423 float volumeX,
432 float volumeY, 424 float volumeY,
433 float volumeZ) 425 float volumeZ)
434 { 426 {
453 float /* offset */) : 445 float /* offset */) :
454 reader_(image) 446 reader_(image)
455 { 447 {
456 } 448 }
457 449
458 ORTHANC_STONE_FORCE_INLINE 450 ORTHANC_FORCE_INLINE
459 void Apply(typename PixelWriter::OutputPixelType* pixel, 451 void Apply(typename PixelWriter::OutputPixelType* pixel,
460 float volumeX, 452 float volumeX,
461 float volumeY, 453 float volumeY,
462 float volumeZ) 454 float volumeZ)
463 { 455 {
484 scaling_(scaling), 476 scaling_(scaling),
485 offset_(offset) 477 offset_(offset)
486 { 478 {
487 } 479 }
488 480
489 ORTHANC_STONE_FORCE_INLINE 481 ORTHANC_FORCE_INLINE
490 void Apply(typename PixelWriter::OutputPixelType* pixel, 482 void Apply(typename PixelWriter::OutputPixelType* pixel,
491 float volumeX, 483 float volumeX,
492 float volumeY, 484 float volumeY,
493 float volumeZ) 485 float volumeZ)
494 { 486 {
535 offset_[0] = static_cast<float>(tmp[0]); 527 offset_[0] = static_cast<float>(tmp[0]);
536 offset_[1] = static_cast<float>(tmp[1]); 528 offset_[1] = static_cast<float>(tmp[1]);
537 offset_[2] = static_cast<float>(tmp[2]); 529 offset_[2] = static_cast<float>(tmp[2]);
538 } 530 }
539 531
540 ORTHANC_STONE_FORCE_INLINE 532 ORTHANC_FORCE_INLINE
541 void Next() 533 void Next()
542 { 534 {
543 position_[0] += offset_[0]; 535 position_[0] += offset_[0];
544 position_[1] += offset_[1]; 536 position_[1] += offset_[1];
545 position_[2] += offset_[2]; 537 position_[2] += offset_[2];
546 } 538 }
547 539
548 ORTHANC_STONE_FORCE_INLINE 540 ORTHANC_FORCE_INLINE
549 void GetVolumeCoordinates(float& x, 541 void GetVolumeCoordinates(float& x,
550 float& y, 542 float& y,
551 float& z) const 543 float& z) const
552 { 544 {
553 x = position_[0]; 545 x = position_[0];