[Insight-developers] bug in itkPeriodicBoundaryCondition
Torsten Rohlfing
torsten at synapse.sri.com
Mon Jan 15 18:39:40 EST 2007
Hi --
I think I ran into a bug in the
itk::PeriodicBoundaryCondition::operator() implementations. The problem
is that a local ConstNeighborhoodIterator is created, but the type of
this iterator does not get the PeriodicBoundaryCondition type as its
second template parameter. Thus, a dynamic cast from the function
parameter to the local pointer gives NULL, and the code segfaults. This
occurs twice, once in each of the two operator() functions.
Here's a diff against the latest CVS version:
Index: itkPeriodicBoundaryCondition.txx
===================================================================
RCS file:
/cvsroot/Insight/Insight/Code/Common/itkPeriodicBoundaryCondition.txx,v
retrieving revision 1.6
diff -u -r1.6 itkPeriodicBoundaryCondition.txx
--- itkPeriodicBoundaryCondition.txx 20 Apr 2006 17:01:27 -0000 1.6
+++ itkPeriodicBoundaryCondition.txx 15 Jan 2007 23:35:58 -0000
@@ -27,8 +27,8 @@
const NeighborhoodType *data) const
{
typedef typename OffsetType::OffsetValueType OffsetValueType;
- const ConstNeighborhoodIterator<TImage> * iterator
- = dynamic_cast<const ConstNeighborhoodIterator<TImage> *>(data);
+ const ConstNeighborhoodIterator<TImage,Self> * iterator
+ = dynamic_cast<const ConstNeighborhoodIterator<TImage,Self> *>(data);
typename TImage::PixelType *ptr;
int linear_index = 0;
unsigned int i;
@@ -81,8 +81,8 @@
const NeighborhoodAccessorFunctorType
&neighborhoodAccessorFunctor) const
{
typedef typename OffsetType::OffsetValueType OffsetValueType;
- const ConstNeighborhoodIterator<TImage> * iterator
- = dynamic_cast<const ConstNeighborhoodIterator<TImage> *>(data);
+ const ConstNeighborhoodIterator<TImage,Self> * iterator
+ = dynamic_cast<const ConstNeighborhoodIterator<TImage,Self> *>(data);
typename TImage::PixelType *ptr;
int linear_index = 0;
unsigned int i;
--
Torsten Rohlfing, PhD SRI International, Neuroscience Program
Research Scientist 333 Ravenswood Ave, Menlo Park, CA 94025
Phone: ++1 (650) 859-3379 Fax: ++1 (650) 859-2743
torsten at synapse.sri.com http://www.stanford.edu/~rohlfing/
"Though this be madness, yet there is a method in't"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: torsten.vcf
Type: text/x-vcard
Size: 366 bytes
Desc: not available
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20070115/99f80ab6/torsten.vcf
More information about the Insight-developers
mailing list