[Insight-users] Bug in BlobSpatialObject
Julien Jomier
julien.jomier at kitware.com
Wed Aug 16 15:52:28 EDT 2006
Hi Kajetan,
I just put a fix in the cvs repository.
Thanks a lot for the report,
Julien
Kajetan Berlinger wrote:
> 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
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list