MantisBT - ITK
View Issue Details
0009398ITKpublic2009-08-11 18:272009-08-11 19:55
Hans Johnson 
Hans Johnson 
urgentmajoralways
closedfixed 
 
ITK-3-14 
0009398: Changes to itkOptImageToImageMetric.txx on 2009-07-28 break backwards compatibility
A new boolean variable was introduced to the code on 2009-07-28 in the class called: m_UseFixedImageMask

This variable is used to determine if fixed image mask processing should be done. In the past (and in the non-optimized version), fixed image mask processing was contingent only upon the existence of a mask object.

This new version of the code now requires that you first set the mask, and then indicate that you want to use the mask.

It is also possible to set the

m_FixedImageMask to some real mask object, then set m_UseFixedImageMask to true,
and subsequently set m_FixedImageMask back to NULL. This scenerio would cause the following bit of code to fail.

      if( m_UseFixedImageMask )
        {
        double val;
        if( m_FixedImageMask->ValueAt( inputPoint, val ) )
          {

=======================
I recommend removing the new boolean m_UseFixedImageMask and replacing it with a test of the the existance of a non-null m_FixedImageMask.


cvs diff: Diffing Code/Review
Index: Code/Review/itkOptImageToImageMetric.h
===================================================================
RCS file: /cvsroot/Insight/Insight/Code/Review/itkOptImageToImageMetric.h,v
retrieving revision 1.28
diff -r1.28 itkOptImageToImageMetric.h
207,209d206
< void SetUseFixedImageMask( bool useMask );
< itkGetConstReferenceMacro( UseFixedImageMask, bool );
<
397d393
< bool m_UseFixedImageMask;
Index: Code/Review/itkOptImageToImageMetric.txx
===================================================================
RCS file: /cvsroot/Insight/Insight/Code/Review/itkOptImageToImageMetric.txx,v
retrieving revision 1.34
diff -r1.34 itkOptImageToImageMetric.txx
55d54
< m_UseFixedImageMask = false;
174,192d172
< ::SetUseFixedImageMask( bool useMask )
< {
< if( useMask != m_UseFixedImageMask )
< {
< m_UseFixedImageMask = useMask;
< if( m_UseFixedImageMask )
< {
< this->SetUseAllPixels( false );
< }
< else
< {
< this->Modified();
< }
< }
< }
<
< template <class TFixedImage, class TMovingImage>
< void
< ImageToImageMetric<TFixedImage,TMovingImage>
608c588
< if( m_UseFixedImageMask
---
> if( m_FixedImageMask.IsNotNull()
646c626
< if( m_UseFixedImageMask )
---
> if( m_FixedImageMask.IsNotNull() )
727c707
< if( m_UseFixedImageMask
---
> if( m_FixedImageMask.IsNotNull()
741c721
< if( m_UseFixedImageMask )
---
> if( m_FixedImageMask.IsNotNull() )
1596,1603d1575
< if( m_UseFixedImageMask )
< {
< os << indent << "Use Fixed Image Mask: True" << std::endl;
< }
< else
< {
< os << indent << "Use Fixed Image Mask: False" << std::endl;
< }
cvs diff: Diffing Code/Review/Statistics

============

Tests are currently running on this.
No tags attached.
Issue History
2009-08-11 18:27Hans JohnsonNew Issue
2009-08-11 19:54Hans JohnsonNote Added: 0017099
2009-08-11 19:55Hans JohnsonStatusnew => resolved
2009-08-11 19:55Hans JohnsonFixed in Version => ITK-3-14
2009-08-11 19:55Hans JohnsonResolutionopen => fixed
2009-08-11 19:55Hans JohnsonAssigned To => Hans Johnson
2009-08-11 19:55Hans JohnsonStatusresolved => closed

Notes
(0017099)
Hans Johnson   
2009-08-11 19:54   
Thanks for the catch.

Please go ahead and fix it.

I hope the rest of my changes didn't impact you.

Thanks,
Stephen