comparison Framework/Radiography/RadiographyScene.cpp @ 923:6b81c5453382

RadiographyScene: avoid exporting to width+1 image size due to numerical noise in GetSceneExtent()
author Alain Mazy <alain@mazy.be>
date Mon, 22 Jul 2019 14:28:56 +0200
parents 580dd82e13f5
children 1b49e78d91d0
comparison
equal deleted inserted replaced
918:d6c029d15aaa 923:6b81c5453382
604 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 604 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
605 } 605 }
606 606
607 Extent2D extent = GetSceneExtent(); 607 Extent2D extent = GetSceneExtent();
608 608
609 int w = static_cast<int>(std::ceil(extent.GetWidth() / pixelSpacingX)); 609 int w = static_cast<int>(std::round(extent.GetWidth() / pixelSpacingX));
610 int h = static_cast<int>(std::ceil(extent.GetHeight() / pixelSpacingY)); 610 int h = static_cast<int>(std::round(extent.GetHeight() / pixelSpacingY));
611 611
612 if (w < 0 || h < 0) 612 if (w < 0 || h < 0)
613 { 613 {
614 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); 614 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
615 } 615 }