[Insight-users] FastChamferDistanceImageFilter

Raul Daniel Millan daniel.millan at upf.edu
Fri Feb 10 16:29:11 EST 2006


Hi Luis,
    I utilized the itkFastChamferDistanceImageFilterTest.cxx with some 
little modifications.
The output data from the FastChamferDsitanceImageFilter came to be 
exactly equal to the
input one. I expected that the output image was something different...
with distance values between -10 and some positive value...

What am I doing wrong or this result is correct?

The modifications were:

/*=========================================================================

// simple signed distance function

*namespace* 
{
	*template* <*typename* TPoint>
	*double*
	SimpleSignedDistance( *const* TPoint & p )
	{
		*if* (fabs(accum - radius) > 1)
		{
			*if*((accum - radius) > 0)
				*return* radius;
*			else **if ((accum - radius) < -5)
				**return -100.0;*
			*else*	
				*return* -radius;
		}
		*else*
		{
			*return* ( accum - radius );
		}
	}
}


*int* main(*int*, *char** [] )
{
  std::cout<< "Test ITK Chamfer Distance Image Filter" << std::endl;
  std::cout << "Compute the distance map of a 64x64x64 image" << std::endl;

  *const* *unsigned* *int* ImageDimension = 3;
  *typedef* *float* PixelType;
  
  *typedef* itk::Image<PixelType,ImageDimension> ImageType;
  *typedef* itk::Point<*double*,ImageDimension> PointType;
  
  ImageType::SizeType size = {{64,64,64}};
  ImageType::IndexType index = {{0,0,0}};
  ...
  ...

  /* Create Fast Chamfer Distance filter */
  *typedef* itk::FastChamferDistanceImageFilter<ImageType,ImageType> ChamferFilterType;
  ...
  ...
 
  // For debugging write the result
  *typedef* itk::ImageFileWriter< ImageType >  WriterType;
  ...   
}
/*=========================================================================



Thanks,
daniel

(lo siento por el inglés....)


---------------------
Luis Ibanez wrote ::
Hi David,

Please look at the file

/Insight/Testing/Code/Algorithms/
    itkFastChamferDistanceImageFilterTest.cxx

for an example on how to use this class.


Regards,



    Luis






More information about the Insight-users mailing list