[Insight-users] Get Distance Map

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 17 10:35:27 EST 2007


Hi Jordi,


The best way to ensure consistency on the types used to receive the
outputs of ITK filters is to use the traits defined by the filters
themselves.


In your case, you want to use the "DistanceMapType" trait.


             Simply do the following:


typedef MyDistancePointMetricType::DistanceMapType    DistanceMapType;


DistanceMapType::ConstPointer distanceMap = metric->GetDistanceMap();



     Regards,


        Luis




-----------------------------------
Jordi Romagós Figueras wrote:
> Hello everybody,
> 
> I’m using the class EuclideanDistancePointMetric and I want to get 
> DistanceMap Data, but I can’t assign this to any kind of Image. I look 
> for this type at class euclidian class and it is this (I work in 2D 
> images):
> 
> class TDistanceMap = ::itk::Image<unsigned 
> short,::itk::GetPointSetDimension<TMovingPointSet>::PointDimension> >
> 
> Then I create the same kind of Image in my code, but compiler make this 
> error:
> 
> error C2679: binary '=' : no operator found which takes a right-hand 
> operand of type 'const itk::Image<TPixel,VImageDimension> *' (or there 
> is no acceptable conversion)
>        with
>        [
>            TPixel=unsigned short,
>            VImageDimension=2
>        ]
>        c:\pfc\insighttoolkit-2.8.1\code\common\itkSmartPointer.h(113): 
> could be 'itk::SmartPointer<TObjectType> 
> &itk::SmartPointer<TObjectType>::operator =(const 
> itk::SmartPointer<TObjectType> &)'
>        with
>        [
>            TObjectType=itk::Image<unsigned short,2>
>        ]
>        c:\pfc\insighttoolkit-2.8.1\code\common\itkSmartPointer.h(117): 
> or 'itk::SmartPointer<TObjectType> 
> &itk::SmartPointer<TObjectType>::operator 
> =(itk::Image<TPixel,VImageDimension> *)'
>        with
>        [
>            TObjectType=itk::Image<unsigned short,2>,
>            TPixel=unsigned short,
>            VImageDimension=2
>        ]
>        while trying to match the argument list 
> '(itk::SmartPointer<TObjectType>, const 
> itk::Image<TPixel,VImageDimension> *)'
>        with
>        [
>            TObjectType=itk::Image<unsigned short,2>
>        ]
>        and
>        [
>            TPixel=unsigned short,
>            VImageDimension=2
>        ]
> 
> The code is this:
> 
> typedef itk::Image<unsigned short,2 > ExampleType;
>         ExampleType::Pointer p;
> 
>         p = m_metrica->GetDistanceMap();
> 
> Someone has any idea the origin of this error?
> 
> Thank you!
> 
> _________________________________________________________________
> Moda para esta temporada. Ponte al día de todas las tendencias. 
> http://www.msn.es/Mujer/moda/default.asp
> 
> _______________________________________________
> 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