# HG changeset patch # User Sebastien Jodogne # Date 1521125081 -3600 # Node ID 9523ce4f44ccae8c9b520c7a9a7894d025f17112 # Parent 98da3a8d4820a84916bedab06c9360b3008564eb removing PixelWriter diff -r 98da3a8d4820 -r 9523ce4f44cc Framework/Volumes/VolumeReslicer.cpp --- a/Framework/Volumes/VolumeReslicer.cpp Thu Mar 15 15:19:24 2018 +0100 +++ b/Framework/Volumes/VolumeReslicer.cpp Thu Mar 15 15:44:41 2018 +0100 @@ -22,100 +22,6 @@ TransferFunction_Linear }; - template - class PixelWriter - { - public: - typedef typename Orthanc::PixelTraits::PixelType InputPixelType; - typedef Orthanc::PixelTraits OutputPixelTraits; - typedef typename Orthanc::PixelTraits::PixelType OutputPixelType; - - private: - template - static void SetValueInternal(OutputPixelType* pixel, - const T& value) - { - if (value < std::numeric_limits::min()) - { - *pixel = std::numeric_limits::min(); - } - else if (value > std::numeric_limits::max()) - { - *pixel = std::numeric_limits::max(); - } - else - { - *pixel = static_cast(value); - } - } - - public: - ORTHANC_FORCE_INLINE - void SetFloatValue(OutputPixelType* pixel, - float value) const - { - SetValueInternal(pixel, value); - } - - ORTHANC_FORCE_INLINE - void SetValue(OutputPixelType* pixel, - const InputPixelType& value) const - { - SetValueInternal(pixel, value); - } - }; - - - template - class PixelWriter - { - public: - typedef typename Orthanc::PixelTraits::PixelType InputPixelType; - typedef Orthanc::PixelTraits OutputPixelTraits; - typedef Orthanc::PixelTraits::PixelType OutputPixelType; - - private: - template - static void SetValueInternal(OutputPixelType* pixel, - const T& value) - { - uint8_t v; - if (value < 0) - { - v = 0; - } - else if (value >= 255.0f) - { - v = 255; - } - else - { - v = static_cast(value); - } - - pixel->blue_ = v; - pixel->green_ = v; - pixel->red_ = v; - pixel->alpha_ = 255; - } - - public: - ORTHANC_FORCE_INLINE - void SetFloatValue(OutputPixelType* pixel, - float value) const - { - SetValueInternal(pixel, value); - } - - ORTHANC_FORCE_INLINE - void SetValue(OutputPixelType* pixel, - const InputPixelType& value) const - { - SetValueInternal(pixel, value); - } - }; - template Reader; - typedef PixelWriter Writer; + typedef Orthanc::PixelTraits Writer; typedef PixelShader Shader; const unsigned int outputWidth = slice.GetWidth(); @@ -379,8 +282,8 @@ for (unsigned int y = 0; y < outputHeight; y++) { - typename Writer::OutputPixelType* p = - reinterpret_cast(slice.GetRow(y)); + typename Writer::PixelType* p = + reinterpret_cast(slice.GetRow(y)); RowIterator it(slice, extent, plane, box, y);