[Insight-users] Does DanielssonDistanceMapImageFilter take spacing informations?

Haoning Fu fu at medicalmedia . com
Wed, 22 Oct 2003 14:09:56 -0400


Hi,

When I used DanielssonDistanceMapImageFilter to compute a distance map 
from a 3D image, I found that DanielssonDistanceMapImageFilter did not 
take in spacing information.

As a result, the distance of two adjacent pixels is still 1 instead of 
the true physical distance.

Am I doing something wrong? The following is my code fragment.


   typedef itk::Image< float, 3 >  ComputeImageType;
   typedef itk::DanielssonDistanceMapImageFilter <ComputeImageType, 
ComputeImageType >  FilterType;

   double origin[3];
   origin[0] = 0.0;    // X coordinate
   origin[1] = 0.0;    // Y coordinate
   origin[2] = 0.0;    // z coordinate

   /*********************************************************/
   // spacing information here
   /*********************************************************/

   double spacing[ 3 ];
   spacing[0] = 0.507812;    // along X direction
   spacing[1] = 0.507812;    // along Y direction
   spacing[2] = 2;           // along Z direction

   ComputeImageType ::SizeType  size;
   size[0]  = 512;  // size along X
   size[1]  = 512;  // size along Y
   size[2]  = 512;  // size along Z

   ComputeImageType::IndexType start;
   start.Fill( 0 );

   ComputeImageType::RegionType region;
   region.SetIndex( start );
   region.SetSize(  size  );

   /*********************************************************/
   //initiate memory for images
   /*********************************************************/
   ComputeImageType::Pointer image = ComputeImageType::New();
   image->SetRegions( region );
   image->SetSpacing( spacing );
   image->Allocate();

   FilterType::Pointer filter = FilterType::New();
   filter->SetInput (image);
   filter->Update();


If you have any clue, please inform me.
Thank you very much.


Haoning Fu
fu at medicalmedia . com