[med-svn] r12481 - in trunk/packages/insighttoolkit/trunk/debian: . patches
Steven Michael Robbins
smr at alioth.debian.org
Sat Oct 27 13:14:56 UTC 2012
Author: smr
Date: 2012-10-27 13:14:56 +0000 (Sat, 27 Oct 2012)
New Revision: 12481
Added:
trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-1.diff
trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-2.diff
Modified:
trunk/packages/insighttoolkit/trunk/debian/changelog
trunk/packages/insighttoolkit/trunk/debian/patches/series
Log:
Add patches to fix i386 build errors in DigitallyReconstructedRadiograph1Test.
Modified: trunk/packages/insighttoolkit/trunk/debian/changelog
===================================================================
--- trunk/packages/insighttoolkit/trunk/debian/changelog 2012-10-27 13:14:21 UTC (rev 12480)
+++ trunk/packages/insighttoolkit/trunk/debian/changelog 2012-10-27 13:14:56 UTC (rev 12481)
@@ -1,3 +1,11 @@
+insighttoolkit4 (4.2.1-2) unstable; urgency=low
+
+ * patches/DRtest-1.diff:
+ * patches/DRtest-2.diff: New. Fixes DigitallyReconstructedRadiograph
+ generation on i386.
+
+ -- Steve M. Robbins <smr at debian.org> Sat, 27 Oct 2012 08:13:31 -0500
+
insighttoolkit4 (4.2.1-1) unstable; urgency=low
* New upstream version.
Added: trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-1.diff
===================================================================
--- trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-1.diff (rev 0)
+++ trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-1.diff 2012-10-27 13:14:56 UTC (rev 12481)
@@ -0,0 +1,69 @@
+From b6d0a549bd94bdb2b4c9a32fce6acd7ef9f011e0 Mon Sep 17 00:00:00 2001
+From: Matt McCormick <matt.mccormick at kitware.com>
+Date: Fri, 26 Oct 2012 02:23:04 -0400
+Subject: [PATCH] ENH: Add operator=( FloatType & rhs ) to
+ CompensatedSummation.
+
+Change-Id: I0d81b71046ec317b33a09ddabf619a49344676de
+---
+ Modules/Core/Common/include/itkCompensatedSummation.h | 3 +++
+ Modules/Core/Common/include/itkCompensatedSummation.hxx | 11 +++++++++++
+ Modules/Core/Common/test/itkCompensatedSummationTest.cxx | 7 +++++++
+ 3 files changed, 21 insertions(+)
+
+diff --git a/Modules/Core/Common/include/itkCompensatedSummation.h b/Modules/Core/Common/include/itkCompensatedSummation.h
+index fab8aee..ad919f6 100644
+--- a/Modules/Core/Common/include/itkCompensatedSummation.h
++++ b/Modules/Core/Common/include/itkCompensatedSummation.h
+@@ -98,6 +98,9 @@ public:
+ /** Reset the sum and compensation to zero. */
+ void ResetToZero();
+
++ /** Reset the sum to the given value and the compensation to zero. */
++ Self & operator=( const FloatType & rhs );
++
+ /** Get the sum. */
+ const AccumulateType & GetSum() const;
+
+diff --git a/Modules/Core/Common/include/itkCompensatedSummation.hxx b/Modules/Core/Common/include/itkCompensatedSummation.hxx
+index 1e90d13..909c288 100644
+--- a/Modules/Core/Common/include/itkCompensatedSummation.hxx
++++ b/Modules/Core/Common/include/itkCompensatedSummation.hxx
+@@ -142,6 +142,17 @@ CompensatedSummation< TFloat >
+ }
+
+ template < class TFloat >
++CompensatedSummation< TFloat > &
++CompensatedSummation< TFloat >
++::operator=( const FloatType & rhs )
++{
++ this->m_Sum = rhs;
++ this->m_Compensation = NumericTraits< AccumulateType >::Zero;
++
++ return *this;
++}
++
++template < class TFloat >
+ const typename CompensatedSummation< TFloat >::AccumulateType &
+ CompensatedSummation< TFloat >
+ ::GetSum() const
+diff --git a/Modules/Core/Common/test/itkCompensatedSummationTest.cxx b/Modules/Core/Common/test/itkCompensatedSummationTest.cxx
+index a9b646b..2d83fe3 100644
+--- a/Modules/Core/Common/test/itkCompensatedSummationTest.cxx
++++ b/Modules/Core/Common/test/itkCompensatedSummationTest.cxx
+@@ -104,5 +104,12 @@ int itkCompensatedSummationTest( int, char * [] )
+ return EXIT_FAILURE;
+ }
+
++ floatAccumulator = 2.0;
++ if( floatAccumulator.GetSum() != 2.0 )
++ {
++ std::cerr << "operator= did not set the value." << std::endl;
++ return EXIT_FAILURE;
++ }
++
+ return EXIT_SUCCESS;
+ }
+--
+1.7.10.4
+
Added: trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-2.diff
===================================================================
--- trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-2.diff (rev 0)
+++ trunk/packages/insighttoolkit/trunk/debian/patches/DRtest-2.diff 2012-10-27 13:14:56 UTC (rev 12481)
@@ -0,0 +1,175 @@
+From dfd007fac96f5d11e55ec4de6abc99c209c2268b Mon Sep 17 00:00:00 2001
+From: Matt McCormick <matt.mccormick at kitware.com>
+Date: Fri, 26 Oct 2012 02:24:58 -0400
+Subject: [PATCH] BUG: Improve robustness of RayCastInterpolateImageFunction.
+
+The robustness of RayCastInterpolationImageFunction is improved by using
+CompensatedSummation. This fixes failures of
+DigitallyReconstructedRadiograph1Test on some 32-bit platforms.
+
+Also add minor style improvements.
+
+Change-Id: Id0a7cf5124db026d402113fda3ef1265d098f56e
+---
+ .../include/itkRayCastInterpolateImageFunction.hxx | 54 +++++++++++---------
+ 1 file changed, 29 insertions(+), 25 deletions(-)
+
+diff --git a/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx b/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx
+index c8745b5..c97c5ac 100644
+--- a/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx
++++ b/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx
+@@ -18,6 +18,7 @@
+ #ifndef __itkRayCastInterpolateImageFunction_hxx
+ #define __itkRayCastInterpolateImageFunction_hxx
+
++#include "itkCompensatedSummation.h"
+ #include "itkRayCastInterpolateImageFunction.h"
+
+ #include "vnl/vnl_math.h"
+@@ -57,6 +58,8 @@ public:
+ typedef typename InputImageType::PixelType PixelType;
+ typedef typename InputImageType::IndexType IndexType;
+
++ typedef itk::CompensatedSummation< double > CompensatedSummationType;
++
+ /**
+ * Set the image class
+ */
+@@ -68,12 +71,12 @@ public:
+ /**
+ * Initialise the ray using the position and direction of a line.
+ *
+- * \param RayPosn The position of the ray in 3D (mm).
+- * \param RayDirn The direction of the ray in 3D (mm).
++ * \param rayPosition The position of the ray in 3D (mm).
++ * \param rayDirection The direction of the ray in 3D (mm).
+ *
+ * \return True if this is a valid ray.
+ */
+- bool SetRay(OutputPointType RayPosn, DirectionType RayDirn);
++ bool SetRay(const OutputPointType & rayPosition, const DirectionType & rayDirection);
+
+ /** \brief
+ * Integrate the interpolated intensities above a given threshold,
+@@ -226,7 +229,7 @@ protected:
+ * voxel. This enables indices of the neighbouring voxels within the plane
+ * to be determined by simply casting to 'int' and optionally adding 1.
+ */
+- double m_Position3Dvox[3];
++ CompensatedSummationType m_Position3Dvox[3];
+
+ /** The incremental direction vector of the ray in voxels. */
+ double m_VoxelIncrement[3];
+@@ -667,7 +670,7 @@ RayCastHelper< TInputImage, TCoordRep >
+ template< class TInputImage, class TCoordRep >
+ bool
+ RayCastHelper< TInputImage, TCoordRep >
+-::SetRay(OutputPointType RayPosn, DirectionType RayDirn)
++::SetRay(const OutputPointType & rayPosition, const DirectionType & rayDirection)
+ {
+ // Store the position and direction of the ray
+ typename TInputImage::SpacingType spacing = this->m_Image->GetSpacing();
+@@ -683,17 +686,17 @@ RayCastHelper< TInputImage, TCoordRep >
+ m_VoxelDimensionInZ = spacing[2];
+
+ m_CurrentRayPositionInMM[0] =
+- RayPosn[0] + 0.5 * m_VoxelDimensionInX * (double)m_NumberOfVoxelsInX;
++ rayPosition[0] + 0.5 * m_VoxelDimensionInX * (double)m_NumberOfVoxelsInX;
+
+ m_CurrentRayPositionInMM[1] =
+- RayPosn[1] + 0.5 * m_VoxelDimensionInY * (double)m_NumberOfVoxelsInY;
++ rayPosition[1] + 0.5 * m_VoxelDimensionInY * (double)m_NumberOfVoxelsInY;
+
+ m_CurrentRayPositionInMM[2] =
+- RayPosn[2] + 0.5 * m_VoxelDimensionInZ * (double)m_NumberOfVoxelsInZ;
++ rayPosition[2] + 0.5 * m_VoxelDimensionInZ * (double)m_NumberOfVoxelsInZ;
+
+- m_RayDirectionInMM[0] = RayDirn[0];
+- m_RayDirectionInMM[1] = RayDirn[1];
+- m_RayDirectionInMM[2] = RayDirn[2];
++ m_RayDirectionInMM[0] = rayDirection[0];
++ m_RayDirectionInMM[1] = rayDirection[1];
++ m_RayDirectionInMM[2] = rayDirection[2];
+
+ // Compute the ray path for this coordinate in mm
+
+@@ -1208,17 +1211,17 @@ void
+ RayCastHelper< TInputImage, TCoordRep >
+ ::IncrementVoxelPointers(void)
+ {
+- double xBefore = m_Position3Dvox[0];
+- double yBefore = m_Position3Dvox[1];
+- double zBefore = m_Position3Dvox[2];
++ double xBefore = m_Position3Dvox[0].GetSum();
++ double yBefore = m_Position3Dvox[1].GetSum();
++ double zBefore = m_Position3Dvox[2].GetSum();
+
+ m_Position3Dvox[0] += m_VoxelIncrement[0];
+ m_Position3Dvox[1] += m_VoxelIncrement[1];
+ m_Position3Dvox[2] += m_VoxelIncrement[2];
+
+- int dx = ( (int)m_Position3Dvox[0] ) - ( (int)xBefore );
+- int dy = ( (int)m_Position3Dvox[1] ) - ( (int)yBefore );
+- int dz = ( (int)m_Position3Dvox[2] ) - ( (int)zBefore );
++ int dx = ( (int)m_Position3Dvox[0].GetSum() ) - ( (int)xBefore );
++ int dy = ( (int)m_Position3Dvox[1].GetSum() ) - ( (int)yBefore );
++ int dz = ( (int)m_Position3Dvox[2].GetSum() ) - ( (int)zBefore );
+
+ m_RayIntersectionVoxelIndex[0] += dx;
+ m_RayIntersectionVoxelIndex[1] += dy;
+@@ -1258,20 +1261,20 @@ RayCastHelper< TInputImage, TCoordRep >
+ {
+ case TRANSVERSE_IN_X:
+ {
+- y = m_Position3Dvox[1] - vcl_floor(m_Position3Dvox[1]);
+- z = m_Position3Dvox[2] - vcl_floor(m_Position3Dvox[2]);
++ y = m_Position3Dvox[1].GetSum() - vcl_floor(m_Position3Dvox[1].GetSum());
++ z = m_Position3Dvox[2].GetSum() - vcl_floor(m_Position3Dvox[2].GetSum());
+ break;
+ }
+ case TRANSVERSE_IN_Y:
+ {
+- y = m_Position3Dvox[0] - vcl_floor(m_Position3Dvox[0]);
+- z = m_Position3Dvox[2] - vcl_floor(m_Position3Dvox[2]);
++ y = m_Position3Dvox[0].GetSum() - vcl_floor(m_Position3Dvox[0].GetSum());
++ z = m_Position3Dvox[2].GetSum() - vcl_floor(m_Position3Dvox[2].GetSum());
+ break;
+ }
+ case TRANSVERSE_IN_Z:
+ {
+- y = m_Position3Dvox[0] - vcl_floor(m_Position3Dvox[0]);
+- z = m_Position3Dvox[1] - vcl_floor(m_Position3Dvox[1]);
++ y = m_Position3Dvox[0].GetSum() - vcl_floor(m_Position3Dvox[0].GetSum());
++ z = m_Position3Dvox[1].GetSum() - vcl_floor(m_Position3Dvox[1].GetSum());
+ break;
+ }
+ default:
+@@ -1301,7 +1304,7 @@ RayCastHelper< TInputImage, TCoordRep >
+
+ // double posn3D_x, posn3D_y, posn3D_z;
+
+- integral = 0.;
++ CompensatedSummationType sum;
+
+ // Check if this is a valid ray
+
+@@ -1320,7 +1323,7 @@ RayCastHelper< TInputImage, TCoordRep >
+
+ if ( intensity > threshold )
+ {
+- integral += intensity - threshold;
++ sum += intensity - threshold;
+ }
+ this->IncrementVoxelPointers();
+ }
+@@ -1329,6 +1332,7 @@ RayCastHelper< TInputImage, TCoordRep >
+ however, if its moving diagonally the ray points will be further
+ apart so account for this by scaling by the distance moved. */
+
++ integral = sum.GetSum();
+ integral *= this->GetRayPointSpacing();
+
+ return true;
+--
+1.7.10.4
+
Modified: trunk/packages/insighttoolkit/trunk/debian/patches/series
===================================================================
--- trunk/packages/insighttoolkit/trunk/debian/patches/series 2012-10-27 13:14:21 UTC (rev 12480)
+++ trunk/packages/insighttoolkit/trunk/debian/patches/series 2012-10-27 13:14:56 UTC (rev 12481)
@@ -0,0 +1,2 @@
+DRtest-1.diff
+DRtest-2.diff
More information about the debian-med-commit
mailing list