Mercurial > hg > orthanc
comparison UnitTestsSources/ImageProcessingTests.cpp @ 3366:7a4d586caf2d
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 13 May 2019 16:04:45 +0200 |
parents | 9345710bbf12 |
children | e0841192d7d0 |
comparison
equal
deleted
inserted
replaced
3365:9345710bbf12 | 3366:7a4d586caf2d |
---|---|
36 | 36 |
37 #include "../Core/DicomFormat/DicomImageInformation.h" | 37 #include "../Core/DicomFormat/DicomImageInformation.h" |
38 #include "../Core/Images/Image.h" | 38 #include "../Core/Images/Image.h" |
39 #include "../Core/Images/ImageProcessing.h" | 39 #include "../Core/Images/ImageProcessing.h" |
40 #include "../Core/Images/ImageTraits.h" | 40 #include "../Core/Images/ImageTraits.h" |
41 #include "../Core/OrthancException.h" | |
41 | 42 |
42 #include <memory> | 43 #include <memory> |
43 | 44 |
44 using namespace Orthanc; | 45 using namespace Orthanc; |
45 | 46 |
222 // inside polygon (note: we don't test too close from the edges since the current algo is taking some margin from the edges and might be improved in that sense) | 223 // inside polygon (note: we don't test too close from the edges since the current algo is taking some margin from the edges and might be improved in that sense) |
223 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 2)); | 224 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 2)); |
224 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 2, 4)); | 225 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 2, 4)); |
225 } | 226 } |
226 | 227 |
227 TYPED_TEST(TestIntegerImageTraits, FillPolygonLargerThandImage) | 228 TYPED_TEST(TestIntegerImageTraits, FillPolygonLargerThanImage) |
228 { | 229 { |
229 ImageAccessor& image = this->GetImage(); | 230 ImageAccessor& image = this->GetImage(); |
230 | 231 |
231 ImageProcessing::Set(image, 0); | 232 ImageProcessing::Set(image, 0); |
232 | 233 |
235 points.push_back(ImageProcessing::ImagePoint(image.GetWidth(),0)); | 236 points.push_back(ImageProcessing::ImagePoint(image.GetWidth(),0)); |
236 points.push_back(ImageProcessing::ImagePoint(image.GetWidth(),image.GetHeight())); | 237 points.push_back(ImageProcessing::ImagePoint(image.GetWidth(),image.GetHeight())); |
237 points.push_back(ImageProcessing::ImagePoint(0,image.GetHeight())); | 238 points.push_back(ImageProcessing::ImagePoint(0,image.GetHeight())); |
238 | 239 |
239 ASSERT_THROW(Orthanc::ImageProcessing::FillPolygon(image, points, 255), Orthanc::OrthancException); | 240 ASSERT_THROW(Orthanc::ImageProcessing::FillPolygon(image, points, 255), Orthanc::OrthancException); |
240 | |
241 // inside polygon (note: we don't test too close from the edges since the current algo is taking some margin from the edges and might be improved in that sense) | |
242 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 0, 0)); | |
243 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, image.GetWidth()-1, 0)); | |
244 } | 241 } |
245 | 242 |
246 TYPED_TEST(TestIntegerImageTraits, FillPolygonFullImage) | 243 TYPED_TEST(TestIntegerImageTraits, FillPolygonFullImage) |
247 { | 244 { |
248 ImageAccessor& image = this->GetImage(); | 245 ImageAccessor& image = this->GetImage(); |