[Insight-users] Bug in BlobSpatialObject

Kajetan Berlinger kaje at kaje.info
Wed Aug 16 15:24:22 EDT 2006


Hello,

I tried to use BlobSpatialObject for defining an image mask for the fixed 
image of a simple 2D-2D registration problem.
Just for testing I created a blob (certainly in 2D space) by adding alle the 
points of a rectangle. 
But the number of pixels considered for the computation of the metric value 
was always 0.
The problem is that in BlobSpatialObject::IsInside( const PointType & point)
,independent of the underlying dimension, in every case three dimensions are 
used to decide whether the point is inside the blob or not (marked with ***    
in the code below).
I just commented out the comparison with respect to z of the difference vector 
and then it worked. 
Don't know what the most elegant way is to enable this method to work 
dimension independent, ... just wanted to report about that.
 

template< unsigned int TDimension >
bool 
BlobSpatialObject< TDimension >
::IsInside( const PointType & point) const
{
  typename PointListType::const_iterator it = m_Points.begin();
  typename PointListType::const_iterator itEnd = m_Points.end();
   
  if(!this->GetIndexToWorldTransform()->GetInverse(const_cast<TransformType 
              *>(this->GetInternalInverseTransform())))
    {
    return false;
    }

	PointType transformedPoint =                	
             this->GetInternalInverseTransform()->TransformPoint(point);


  if( this->GetBounds()->IsInside(transformedPoint) ) 
     {
    while(it != itEnd)
      {
      typename PointType::VectorType difference = 
        transformedPoint - it->GetPosition();
*****************************************************************************			
	  if(fabs(difference[0]) <= 0.5 &&  vcl_fabs(difference[1]) <= 0.5)      
                           // && vcl_fabs(difference[2]) <= 0.5)
        {
			
        return true;
        }
*****************************************************************************
      it++;

      }
    }
  return false;
}

cu
Kaj


More information about the Insight-users mailing list