Mercurial > hg > orthanc-stone
diff Framework/Toolbox/ImageGeometry.cpp @ 340:f5d5814a41a0 am-2
rendering BitmapStack
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 20 Oct 2018 18:26:05 +0200 |
parents | b3b3fa0e3689 |
children | c2e040ea8fbe |
line wrap: on
line diff
--- a/Framework/Toolbox/ImageGeometry.cpp Fri Oct 19 14:44:12 2018 +0200 +++ b/Framework/Toolbox/ImageGeometry.cpp Sat Oct 20 18:26:05 2018 +0200 @@ -174,7 +174,8 @@ ImageInterpolation Interpolation> static void ApplyAffineInternal(Orthanc::ImageAccessor& target, const Orthanc::ImageAccessor& source, - const Matrix& a) + const Matrix& a, + bool clear) { assert(target.GetFormat() == Format && source.GetFormat() == Format); @@ -182,13 +183,16 @@ typedef SubpixelReader<Format, Interpolation> Reader; typedef typename Reader::PixelType PixelType; - if (Format == Orthanc::PixelFormat_RGB24) + if (clear) { - Orthanc::ImageProcessing::Set(target, 0, 0, 0, 255); - } - else - { - Orthanc::ImageProcessing::Set(target, 0); + if (Format == Orthanc::PixelFormat_RGB24) + { + Orthanc::ImageProcessing::Set(target, 0, 0, 0, 255); + } + else + { + Orthanc::ImageProcessing::Set(target, 0); + } } Matrix inva; @@ -260,7 +264,8 @@ double a21, double a22, double b2, - ImageInterpolation interpolation) + ImageInterpolation interpolation, + bool clear) { if (source.GetFormat() != target.GetFormat()) { @@ -292,12 +297,12 @@ { case ImageInterpolation_Nearest: ApplyAffineInternal<Orthanc::PixelFormat_Grayscale8, - ImageInterpolation_Nearest>(target, source, a); + ImageInterpolation_Nearest>(target, source, a, clear); break; case ImageInterpolation_Bilinear: ApplyAffineInternal<Orthanc::PixelFormat_Grayscale8, - ImageInterpolation_Bilinear>(target, source, a); + ImageInterpolation_Bilinear>(target, source, a, clear); break; default: @@ -310,12 +315,12 @@ { case ImageInterpolation_Nearest: ApplyAffineInternal<Orthanc::PixelFormat_Grayscale16, - ImageInterpolation_Nearest>(target, source, a); + ImageInterpolation_Nearest>(target, source, a, clear); break; case ImageInterpolation_Bilinear: ApplyAffineInternal<Orthanc::PixelFormat_Grayscale16, - ImageInterpolation_Bilinear>(target, source, a); + ImageInterpolation_Bilinear>(target, source, a, clear); break; default: @@ -328,12 +333,12 @@ { case ImageInterpolation_Nearest: ApplyAffineInternal<Orthanc::PixelFormat_SignedGrayscale16, - ImageInterpolation_Nearest>(target, source, a); + ImageInterpolation_Nearest>(target, source, a, clear); break; case ImageInterpolation_Bilinear: ApplyAffineInternal<Orthanc::PixelFormat_SignedGrayscale16, - ImageInterpolation_Bilinear>(target, source, a); + ImageInterpolation_Bilinear>(target, source, a, clear); break; default: @@ -346,12 +351,12 @@ { case ImageInterpolation_Nearest: ApplyAffineInternal<Orthanc::PixelFormat_Float32, - ImageInterpolation_Nearest>(target, source, a); + ImageInterpolation_Nearest>(target, source, a, clear); break; case ImageInterpolation_Bilinear: ApplyAffineInternal<Orthanc::PixelFormat_Float32, - ImageInterpolation_Bilinear>(target, source, a); + ImageInterpolation_Bilinear>(target, source, a, clear); break; default: @@ -364,7 +369,7 @@ { case ImageInterpolation_Nearest: ApplyAffineInternal<Orthanc::PixelFormat_RGB24, - ImageInterpolation_Nearest>(target, source, a); + ImageInterpolation_Nearest>(target, source, a, clear); break; default: @@ -447,7 +452,8 @@ void ApplyProjectiveTransform(Orthanc::ImageAccessor& target, const Orthanc::ImageAccessor& source, const Matrix& a, - ImageInterpolation interpolation) + ImageInterpolation interpolation, + bool clear) { if (source.GetFormat() != target.GetFormat()) { @@ -481,18 +487,21 @@ ApplyAffineTransform(target, source, a(0, 0) / w, a(0, 1) / w, a(0, 2) / w, a(1, 0) / w, a(1, 1) / w, a(1, 2) / w, - interpolation); + interpolation, clear); return; } } - if (target.GetFormat() == Orthanc::PixelFormat_RGB24) + if (clear) { - Orthanc::ImageProcessing::Set(target, 0, 0, 0, 255); - } - else - { - Orthanc::ImageProcessing::Set(target, 0); + if (target.GetFormat() == Orthanc::PixelFormat_RGB24) + { + Orthanc::ImageProcessing::Set(target, 0, 0, 0, 255); + } + else + { + Orthanc::ImageProcessing::Set(target, 0); + } } Matrix inva;