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

Luis Ibanez luis.ibanez at kitware.com
Wed, 14 Apr 2004 16:12:36 -0400


Hi Radhika,

The DanielssonDistanceMap takes into account diagonal distances
regardless of whether the UseImageSpacing flag is enabled or not.

What changes when the flag is enabled is that the components
of the pixel spacing are taken into account. Therefore the
distances are reported in physical units (e.g. millimeters)
instead of pixels.  As a consequence, enabling the flag also
takes care of taking pixel anisotropy into account.

The distances are computed as Euclidean distances, not as
Manhattan distances (city-block), but are limited in precision
to one-pixel. That is, there is no sub-pixel accuracy in the
distance values.  An easy way to verify the Euclidean-ness of
the resulting DistanceMap is to create a dataset with a single
pixel on in the middle and pass it as input to the Danielsson
DistanceMap filter.

Using the DanielssonDistanceMap plugin for VolView would
be a very easy way of experimenting with the distances.


Please let us know if you have further questions.


   Thanks


     Luis



-----------------------------
Radhika Sivaramakrishna wrote:

> Hi Luis,
> Thanks for your explanation. I have a doubt: when the UseImageSpacing is 
> enabled, does this (1) take into account diagonal distances and (2) 
> nonisotropic voxels also? I thought it did both. If I want to just make 
> sure that diagonal distances are taken into account (ie I don't want to 
> do city block distances or chessboard distances), but do not want to 
> take non-isotropy into account, what should I do?
> 
> Hope my question is clear.
> Thanks
> Radhika
> 
> 
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
> Sent: Monday, April 12, 2004 6:46 PM
> To: Radhika Sivaramakrishna
> Cc: ITK
> Subject: Re: [Insight-users] More questions on Daniellson distance map 
> filter
> 
> 
> 
> 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.
>  >
> 
> 
>                                                     
> ----------------------------------------------------- 
> 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.
>