Mercurial > hg > orthanc
comparison OrthancFramework/Sources/Images/ImageProcessing.cpp @ 4201:2d5209153b32
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 08:18:28 +0200 |
parents | bf7b9edf6b81 |
children | 9279de56a405 |
comparison
equal
deleted
inserted
replaced
4200:7112a8af0b63 | 4201:2d5209153b32 |
---|---|
416 const unsigned int width = target.GetWidth(); | 416 const unsigned int width = target.GetWidth(); |
417 | 417 |
418 for (unsigned int y = 0; y < height; y++) | 418 for (unsigned int y = 0; y < height; y++) |
419 { | 419 { |
420 TargetType* p = reinterpret_cast<TargetType*>(target.GetRow(y)); | 420 TargetType* p = reinterpret_cast<TargetType*>(target.GetRow(y)); |
421 const SourceType* q = reinterpret_cast<const SourceType*>(source.GetRow(y)); | 421 const SourceType* q = reinterpret_cast<const SourceType*>(source.GetConstRow(y)); |
422 | 422 |
423 for (unsigned int x = 0; x < width; x++, p++, q++) | 423 for (unsigned int x = 0; x < width; x++, p++, q++) |
424 { | 424 { |
425 float v = a * static_cast<float>(*q) + b; | 425 float v = a * static_cast<float>(*q) + b; |
426 | 426 |
1858 } | 1858 } |
1859 ImageProcessing::DrawLineSegment(image, points[points.size() -1].GetX(), points[points.size() -1].GetY(), points[0].GetX(), points[0].GetY(), value_); | 1859 ImageProcessing::DrawLineSegment(image, points[points.size() -1].GetX(), points[points.size() -1].GetY(), points[0].GetX(), points[0].GetY(), value_); |
1860 | 1860 |
1861 std::vector<int32_t> nodeX; | 1861 std::vector<int32_t> nodeX; |
1862 nodeX.resize(cpSize); | 1862 nodeX.resize(cpSize); |
1863 int nodes, pixelX, pixelY, i, j, swap ; | 1863 int pixelX, pixelY, i, swap ; |
1864 | 1864 |
1865 // Loop through the rows of the image. | 1865 // Loop through the rows of the image. |
1866 for (pixelY = top; pixelY < bottom; pixelY++) | 1866 for (pixelY = top; pixelY < bottom; pixelY++) |
1867 { | 1867 { |
1868 double y = (double)pixelY; | 1868 double y = (double)pixelY; |
1869 // Build a list of nodes. | 1869 // Build a list of nodes. |
1870 nodes = 0; | 1870 int nodes = 0; |
1871 j = static_cast<int>(cpSize) - 1; | 1871 int j = static_cast<int>(cpSize) - 1; |
1872 | 1872 |
1873 for (i = 0; i < static_cast<int>(cpSize); i++) | 1873 for (i = 0; i < static_cast<int>(cpSize); i++) |
1874 { | 1874 { |
1875 if ((cpy[i] < y && cpy[j] >= y) || (cpy[j] < y && cpy[i] >= y)) | 1875 if ((cpy[i] < y && cpy[j] >= y) || (cpy[j] < y && cpy[i] >= y)) |
1876 { | 1876 { |
2045 | 2045 |
2046 | 2046 |
2047 void ImageProcessing::Resize(ImageAccessor& target, | 2047 void ImageProcessing::Resize(ImageAccessor& target, |
2048 const ImageAccessor& source) | 2048 const ImageAccessor& source) |
2049 { | 2049 { |
2050 if (source.GetFormat() != source.GetFormat()) | 2050 if (source.GetFormat() != target.GetFormat()) |
2051 { | 2051 { |
2052 throw OrthancException(ErrorCode_IncompatibleImageFormat); | 2052 throw OrthancException(ErrorCode_IncompatibleImageFormat); |
2053 } | 2053 } |
2054 | 2054 |
2055 if (source.GetWidth() == target.GetWidth() && | 2055 if (source.GetWidth() == target.GetWidth() && |