[Insight-users] Does DanielssonDistanceMapImageFilter take spacing informations?

Luis Ibanez luis . ibanez at kitware . com
Sat, 25 Oct 2003 16:40:55 -0400


Hi Haoning,

The DanielssonDistance doesn't take the pixel spacing into
account.  You could recompute real physical distances by using
the method:

      VectorImageType * GetVectorDistanceMap (void)

which provides an image of offsets (ND offsets). You could
rescale these offsets by multiplying them with the pixel spacing.

Note however that this will not be a complete solution because
the decision of the nearest neighbors already have been taken
under the assumption that the distance was measured in pixels,
(as opposed to millimeters).  This means that by multiplying
the vector distance with the pixel spacing you will get now
real spacings in millimeters but you could not claim these
distances to be the ones to the closest object.

Depending on the application that you have in mind, this may
or may not be a problem.

If your application absolutely requires to find distances in
millimeters your best option is to resample the image in order
to get isotropic pixels. Then apply the Danielsson filter and
still at the end use the pixel spacing of the resampled image.



Regards,


   Luis




-------------------
Haoning Fu wrote:
> 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
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>