comparison Applications/Samples/SingleFrameEditorApplication.h @ 376:70256a53ff21

fix compatibility with Visual Studio 2008
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 13:25:03 +0100
parents 557c8ff1db5c
children 8eb4fe74000f
comparison
equal deleted inserted replaced
373:d6136a7e914d 376:70256a53ff21
40 40
41 #define EXPORT_USING_PAM 1 41 #define EXPORT_USING_PAM 1
42 42
43 43
44 #include <boost/math/constants/constants.hpp> 44 #include <boost/math/constants/constants.hpp>
45 #include <boost/math/special_functions/round.hpp>
46
45 47
46 namespace OrthancStone 48 namespace OrthancStone
47 { 49 {
48 static Matrix CreateOffsetMatrix(double dx, 50 static Matrix CreateOffsetMatrix(double dx,
49 double dy) 51 double dy)
1491 double sourceAngle_; 1493 double sourceAngle_;
1492 double targetAngle_; 1494 double targetAngle_;
1493 1495
1494 static int ToDegrees(double angle) 1496 static int ToDegrees(double angle)
1495 { 1497 {
1496 return static_cast<int>(round(angle * 180.0 / boost::math::constants::pi<double>())); 1498 return boost::math::iround(angle * 180.0 / boost::math::constants::pi<double>());
1497 } 1499 }
1498 1500
1499 protected: 1501 protected:
1500 virtual void UndoInternal(BitmapStack::Bitmap& bitmap) const 1502 virtual void UndoInternal(BitmapStack::Bitmap& bitmap) const
1501 { 1503 {
1579 { 1581 {
1580 angle = angle - clickAngle_ + originalAngle_; 1582 angle = angle - clickAngle_ + originalAngle_;
1581 1583
1582 if (roundAngles_) 1584 if (roundAngles_)
1583 { 1585 {
1584 angle = round(angle / ROUND_ANGLE) * ROUND_ANGLE; 1586 angle = boost::math::round<double>((angle / ROUND_ANGLE) * ROUND_ANGLE);
1585 } 1587 }
1586 1588
1587 accessor_.GetBitmap().SetAngle(angle); 1589 accessor_.GetBitmap().SetAngle(angle);
1588 } 1590 }
1589 } 1591 }
1988 { 1990 {
1989 double scaling = ComputeDistance(oppositeX_, oppositeY_, sceneX, sceneY) * baseScaling_; 1991 double scaling = ComputeDistance(oppositeX_, oppositeY_, sceneX, sceneY) * baseScaling_;
1990 1992
1991 if (roundScaling_) 1993 if (roundScaling_)
1992 { 1994 {
1993 scaling = round(scaling / ROUND_SCALING) * ROUND_SCALING; 1995 scaling = boost::math::round<double>((scaling / ROUND_SCALING) * ROUND_SCALING);
1994 } 1996 }
1995 1997
1996 BitmapStack::Bitmap& bitmap = accessor_.GetBitmap(); 1998 BitmapStack::Bitmap& bitmap = accessor_.GetBitmap();
1997 bitmap.SetPixelSpacing(scaling * originalSpacingX_, 1999 bitmap.SetPixelSpacing(scaling * originalSpacingX_,
1998 scaling * originalSpacingY_); 2000 scaling * originalSpacingY_);
2150 { 2152 {
2151 tmp = 0; 2153 tmp = 0;
2152 } 2154 }
2153 else 2155 else
2154 { 2156 {
2155 tmp = log2(delta); 2157 // NB: Visual Studio 2008 does not provide "log2f()", so we
2158 // implement it by ourselves
2159 tmp = logf(delta) / logf(2.0f);
2156 } 2160 }
2157 2161
2158 strength_ = tmp - 7; 2162 strength_ = tmp - 7;
2159 if (strength_ < 1) 2163 if (strength_ < 1)
2160 { 2164 {
2794 2798
2795 float center, width; 2799 float center, width;
2796 if (widget.GetStack().GetWindowing(center, width)) 2800 if (widget.GetStack().GetWindowing(center, width))
2797 { 2801 {
2798 json["Tags"][Orthanc::DICOM_TAG_WINDOW_CENTER.Format()] = 2802 json["Tags"][Orthanc::DICOM_TAG_WINDOW_CENTER.Format()] =
2799 boost::lexical_cast<std::string>(lroundf(center)); 2803 boost::lexical_cast<std::string>(boost::math::iround(center));
2800 2804
2801 json["Tags"][Orthanc::DICOM_TAG_WINDOW_WIDTH.Format()] = 2805 json["Tags"][Orthanc::DICOM_TAG_WINDOW_WIDTH.Format()] =
2802 boost::lexical_cast<std::string>(lroundf(width)); 2806 boost::lexical_cast<std::string>(boost::math::iround(width));
2803 } 2807 }
2804 2808
2805 #if EXPORT_USING_PAM == 1 2809 #if EXPORT_USING_PAM == 1
2806 json["Content"] = "data:" + std::string(Orthanc::MIME_PAM) + ";base64," + base64; 2810 json["Content"] = "data:" + std::string(Orthanc::MIME_PAM) + ";base64," + base64;
2807 #else 2811 #else