[Insight-users] More questions on Daniellson distance map filter

Luis Ibanez luis.ibanez at kitware.com
Mon, 12 Apr 2004 21:45:43 -0400


Hi Radhika,

When you enable the "UseImageSpacing" flag, the values
of pixel spacing are used in the last stage of distance
computation. The spacing is used to multiply the distance
components when their squares are summed up.

The resulting distance is then casted to the type of the
output image pixel type. This is done in the file:

     Insight/Code/BasicFilters/
       itkDanielssonDistanceMapImageFilter.txx:

in line 299:

    dt.Set(
      static_cast<
         typename
           OutputImageType::PixelType>(sqrt( distance )) );


Note that the casting is done as a flat truncation.
No effort is made for scaling the distances in the
range of the pixel type.  Depending on the physical
extent of your image, this may or may not be a problem.



If you want to compute this distance scaling in a better
way, you could setup the output pixel type as float,
and then connect the output of the DanielssonDistanceMap
filter to a RescaleIntensityImageFilter with output pixel
type = unsigned char.  This last filter will then rescale
nicely the distances into the range of intensities of the
output image. Note that with this filter you can select
what values to use for representing the maximum and minimum
values of the distance.


--

You may want to take a look at the new VolView plugin
for computing the Danielsson distance. The source code
for this plugin is available at


       InsightApplications/
                VolviewPlugins/
                   vvITKDanielssonDistanceMap.cxx




Please let us know if you have further questions,


Thanks


   Luis



-------------------------------

Radhika Sivaramakrishna wrote:

> Hi,
> 
> I had more questions on the Danielsson distance map filter. I have set 
> the input and output of the filter to unsigned char.
> 
> I have also put the SetUseImageSpacing flag to true. This means that 
> actual distances may be computed which are more floating point
> 
> numbers.  Since I am forcing the output to unsigned char, then does this 
> mean that the actual distances are truncated to unsigned char
> 
> or are they rounded to it? Is there a better way to handle this?
> 
> Thanks
> 
> Radhika
> 
>  
> 
> -----------------------------------------------------
> 
> Confidentiality Notice.
> 
> This email message is for the sole use of the intended recipient(s) and 
> may contain confidential and privileged information. Any unauthorized 
> review, use, disclosure or distribution is prohibited. If you are not 
> the intended recipient, please contact the sender by reply email and 
> destroy all copies of the original message. If you are the intended 
> recipient, please be advised that the content of this message is subject 
> to access, review and disclosure by the sender's Email System Administrator.
>