[Insight-users] RE: Wondering if it is a bug in Danielsson distance map filter

Radhika Sivaramakrishna radhika.sivaramakrishna at synarc.com
Thu, 15 Apr 2004 17:59:37 -0700


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C4234E.16A7DC9C
Content-Type: text/plain

Hi Luis,
The pixel type is unsigned char for everything.
Radhika


-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
Sent: Thursday, April 15, 2004 4:39 PM
To: Radhika Sivaramakrishna
Cc: ITK
Subject: Re: Wondering if it is a bug in Danielsson distance map filter



Hi Radhika,

Thanks for posting this detailed report.

This looks like a bug...

Just a question... what is the pixel type that you
use as output for the ShiftScale image ?

I'm wondering that if it is a float pixel type, we
may be dealing with a pixel that has a float value
very close to zero in the image passed as input
to the Danielsson filter.


Please let us know,



   Thanks



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

> Hi Luis,
> I am observing a strange behavior in the Danielsson map filter and I am 
> wondering if it is a bug. I have been experimenting with this for a few 
> days now and I have found this behavior even on 3D images. I have 
> attached an image (Mask_2D.img) that I ran the distance map filter on. I 
> inverted this mask before running the filter. I ran it with and without 
> setting UseImageSpacing. When I do not
> 
> set UseImageSpacing, I observe some strange behavior. It sets 1 in 
> places where it should not. Could you explain what is happening? My 
> pixel type is unsigned char. Here is a very small portion of the code 
> that just runs the shiftscale and Danielsson Filter. In the attached 
> results you will clearly see an extra 1 in location (8,18) which should 
> not be. I don't know if I am using this incorrectly or something else is 
> happening.
> 
> Thanks
> Radhika
> 
> typedef itk::Image<PixelType,2> ImageType2D;
> typedef itk::ImageFileWriter< ImageType2D >  WriterType2D;     
> typedef itk::ShiftScaleImageFilter <ImageType2D, ImageType2D> 
> ShiftScaleFilterType2D;
> typedef itk::DanielssonDistanceMapImageFilter <ImageType2D, ImageType2D> 
> EDMFilterType2D;       EDMFilterType2D::Pointer edmfilter2D = 
> EDMFilterType2D::New();
> 
> ShiftScaleFilterType2D::Pointer ssfilter2D =
ShiftScaleFilterType2D::New();
>        
> ssfilter2D->SetShift(shift);
> ssfilter2D->SetScale(scale);
> edmfilter2D->SetInputIsBinary(true);
> //      edmfilter2D->SetUseImageSpacing(true);
> ssfilter2D->SetInput(mask);
> edmfilter2D->SetInput(ssfilter2D->GetOutput());
> edmfilter2D->Update();
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
> Sent: Wednesday, April 14, 2004 1:13 PM
> To: Radhika Sivaramakrishna
> Cc: ITK
> Subject: Re: [Insight-users] More questions on Daniellson distance map 
> filter
> 
> 
> 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.
>  >
> 
> 
>                                                     
> ----------------------------------------------------- 
> 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.

------_=_NextPart_001_01C4234E.16A7DC9C
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2656.87">
<TITLE>RE: Wondering if it is a bug in Danielsson distance map filter</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi Luis,</FONT>
<BR><FONT SIZE=2>The pixel type is unsigned char for everything.</FONT>
<BR><FONT SIZE=2>Radhika</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Luis Ibanez [<A HREF="mailto:luis.ibanez at kitware.com">mailto:luis.ibanez at kitware.com</A>] </FONT>
<BR><FONT SIZE=2>Sent: Thursday, April 15, 2004 4:39 PM</FONT>
<BR><FONT SIZE=2>To: Radhika Sivaramakrishna</FONT>
<BR><FONT SIZE=2>Cc: ITK</FONT>
<BR><FONT SIZE=2>Subject: Re: Wondering if it is a bug in Danielsson distance map filter</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>Hi Radhika,</FONT>
</P>

<P><FONT SIZE=2>Thanks for posting this detailed report.</FONT>
</P>

<P><FONT SIZE=2>This looks like a bug...</FONT>
</P>

<P><FONT SIZE=2>Just a question... what is the pixel type that you</FONT>
<BR><FONT SIZE=2>use as output for the ShiftScale image ?</FONT>
</P>

<P><FONT SIZE=2>I'm wondering that if it is a float pixel type, we</FONT>
<BR><FONT SIZE=2>may be dealing with a pixel that has a float value</FONT>
<BR><FONT SIZE=2>very close to zero in the image passed as input</FONT>
<BR><FONT SIZE=2>to the Danielsson filter.</FONT>
</P>
<BR>

<P><FONT SIZE=2>Please let us know,</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>&nbsp;&nbsp; Thanks</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>-----------------------------</FONT>
<BR><FONT SIZE=2>Radhika Sivaramakrishna wrote:</FONT>
</P>

<P><FONT SIZE=2>&gt; Hi Luis,</FONT>
<BR><FONT SIZE=2>&gt; I am observing a strange behavior in the Danielsson map filter and I am </FONT>
<BR><FONT SIZE=2>&gt; wondering if it is a bug. I have been experimenting with this for a few </FONT>
<BR><FONT SIZE=2>&gt; days now and I have found this behavior even on 3D images. I have </FONT>
<BR><FONT SIZE=2>&gt; attached an image (Mask_2D.img) that I ran the distance map filter on. I </FONT>
<BR><FONT SIZE=2>&gt; inverted this mask before running the filter. I ran it with and without </FONT>
<BR><FONT SIZE=2>&gt; setting UseImageSpacing. When I do not</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; set UseImageSpacing, I observe some strange behavior. It sets 1 in </FONT>
<BR><FONT SIZE=2>&gt; places where it should not. Could you explain what is happening? My </FONT>
<BR><FONT SIZE=2>&gt; pixel type is unsigned char. Here is a very small portion of the code </FONT>
<BR><FONT SIZE=2>&gt; that just runs the shiftscale and Danielsson Filter. In the attached </FONT>
<BR><FONT SIZE=2>&gt; results you will clearly see an extra 1 in location (8,18) which should </FONT>
<BR><FONT SIZE=2>&gt; not be. I don't know if I am using this incorrectly or something else is </FONT>
<BR><FONT SIZE=2>&gt; happening.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Thanks</FONT>
<BR><FONT SIZE=2>&gt; Radhika</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; typedef itk::Image&lt;PixelType,2&gt; ImageType2D;</FONT>
<BR><FONT SIZE=2>&gt; typedef itk::ImageFileWriter&lt; ImageType2D &gt;&nbsp; WriterType2D;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; typedef itk::ShiftScaleImageFilter &lt;ImageType2D, ImageType2D&gt; </FONT>
<BR><FONT SIZE=2>&gt; ShiftScaleFilterType2D;</FONT>
<BR><FONT SIZE=2>&gt; typedef itk::DanielssonDistanceMapImageFilter &lt;ImageType2D, ImageType2D&gt; </FONT>
<BR><FONT SIZE=2>&gt; EDMFilterType2D;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EDMFilterType2D::Pointer edmfilter2D = </FONT>
<BR><FONT SIZE=2>&gt; EDMFilterType2D::New();</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; ShiftScaleFilterType2D::Pointer ssfilter2D = ShiftScaleFilterType2D::New();</FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; ssfilter2D-&gt;SetShift(shift);</FONT>
<BR><FONT SIZE=2>&gt; ssfilter2D-&gt;SetScale(scale);</FONT>
<BR><FONT SIZE=2>&gt; edmfilter2D-&gt;SetInputIsBinary(true);</FONT>
<BR><FONT SIZE=2>&gt; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edmfilter2D-&gt;SetUseImageSpacing(true);</FONT>
<BR><FONT SIZE=2>&gt; ssfilter2D-&gt;SetInput(mask);</FONT>
<BR><FONT SIZE=2>&gt; edmfilter2D-&gt;SetInput(ssfilter2D-&gt;GetOutput());</FONT>
<BR><FONT SIZE=2>&gt; edmfilter2D-&gt;Update();</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=2>&gt; From: Luis Ibanez [<A HREF="mailto:luis.ibanez at kitware.com">mailto:luis.ibanez at kitware.com</A>]</FONT>
<BR><FONT SIZE=2>&gt; Sent: Wednesday, April 14, 2004 1:13 PM</FONT>
<BR><FONT SIZE=2>&gt; To: Radhika Sivaramakrishna</FONT>
<BR><FONT SIZE=2>&gt; Cc: ITK</FONT>
<BR><FONT SIZE=2>&gt; Subject: Re: [Insight-users] More questions on Daniellson distance map </FONT>
<BR><FONT SIZE=2>&gt; filter</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Hi Radhika,</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; The DanielssonDistanceMap takes into account diagonal distances</FONT>
<BR><FONT SIZE=2>&gt; regardless of whether the UseImageSpacing flag is enabled or not.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; What changes when the flag is enabled is that the components</FONT>
<BR><FONT SIZE=2>&gt; of the pixel spacing are taken into account. Therefore the</FONT>
<BR><FONT SIZE=2>&gt; distances are reported in physical units (e.g. millimeters)</FONT>
<BR><FONT SIZE=2>&gt; instead of pixels.&nbsp; As a consequence, enabling the flag also</FONT>
<BR><FONT SIZE=2>&gt; takes care of taking pixel anisotropy into account.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; The distances are computed as Euclidean distances, not as</FONT>
<BR><FONT SIZE=2>&gt; Manhattan distances (city-block), but are limited in precision</FONT>
<BR><FONT SIZE=2>&gt; to one-pixel. That is, there is no sub-pixel accuracy in the</FONT>
<BR><FONT SIZE=2>&gt; distance values.&nbsp; An easy way to verify the Euclidean-ness of</FONT>
<BR><FONT SIZE=2>&gt; the resulting DistanceMap is to create a dataset with a single</FONT>
<BR><FONT SIZE=2>&gt; pixel on in the middle and pass it as input to the Danielsson</FONT>
<BR><FONT SIZE=2>&gt; DistanceMap filter.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Using the DanielssonDistanceMap plugin for VolView would</FONT>
<BR><FONT SIZE=2>&gt; be a very easy way of experimenting with the distances.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Please let us know if you have further questions.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp; Thanks</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; -----------------------------</FONT>
<BR><FONT SIZE=2>&gt; Radhika Sivaramakrishna wrote:</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Hi Luis,</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Thanks for your explanation. I have a doubt: when the UseImageSpacing is</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; enabled, does this (1) take into account diagonal distances and (2)</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; nonisotropic voxels also? I thought it did both. If I want to just make</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; sure that diagonal distances are taken into account (ie I don't want to</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; do city block distances or chessboard distances), but do not want to</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; take non-isotropy into account, what should I do?</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Hope my question is clear.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Thanks</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Radhika</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; -----Original Message-----</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; From: Luis Ibanez [<A HREF="mailto:luis.ibanez at kitware.com">mailto:luis.ibanez at kitware.com</A>]</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Sent: Monday, April 12, 2004 6:46 PM</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; To: Radhika Sivaramakrishna</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Cc: ITK</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Subject: Re: [Insight-users] More questions on Daniellson distance map</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; filter</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Hi Radhika,</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; When you enable the &quot;UseImageSpacing&quot; flag, the values</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; of pixel spacing are used in the last stage of distance</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; computation. The spacing is used to multiply the distance</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; components when their squares are summed up.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; The resulting distance is then casted to the type of the</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; output image pixel type. This is done in the file:</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Insight/Code/BasicFilters/</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itkDanielssonDistanceMapImageFilter.txx:</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; in line 299:</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp; dt.Set(</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static_cast&lt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputImageType::PixelType&gt;(sqrt( distance )) );</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Note that the casting is done as a flat truncation.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; No effort is made for scaling the distances in the</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; range of the pixel type.&nbsp; Depending on the physical</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; extent of your image, this may or may not be a problem.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; If you want to compute this distance scaling in a better</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; way, you could setup the output pixel type as float,</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; and then connect the output of the DanielssonDistanceMap</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; filter to a RescaleIntensityImageFilter with output pixel</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; type = unsigned char.&nbsp; This last filter will then rescale</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; nicely the distances into the range of intensities of the</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; output image. Note that with this filter you can select</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; what values to use for representing the maximum and minimum</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; values of the distance.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; --</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; You may want to take a look at the new VolView plugin</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; for computing the Danielsson distance. The source code</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; for this plugin is available at</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InsightApplications/</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VolviewPlugins/</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vvITKDanielssonDistanceMap.cxx</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Please let us know if you have further questions,</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Thanks</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp; Luis</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; -------------------------------</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Radhika Sivaramakrishna wrote:</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; Hi,</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; I had more questions on the Danielsson distance map filter. I have </FONT>
<BR><FONT SIZE=2>&gt; set</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; the input and output of the filter to unsigned char.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; I have also put the SetUseImageSpacing flag to true. This means that</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; actual distances may be computed which are more floating point</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; numbers.&nbsp; Since I am forcing the output to unsigned char, then </FONT>
<BR><FONT SIZE=2>&gt; does this</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; mean that the actual distances are truncated to unsigned char</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; or are they rounded to it? Is there a better way to handle this?</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; Thanks</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; Radhika</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; -----------------------------------------------------</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; Confidentiality Notice.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; This email message is for the sole use of the intended </FONT>
<BR><FONT SIZE=2>&gt; recipient(s) and</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; may contain confidential and privileged information. Any unauthorized</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; review, use, disclosure or distribution is prohibited. If you are not</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; the intended recipient, please contact the sender by reply email and</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; destroy all copies of the original message. If you are the intended</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; recipient, please be advised that the content of this message is </FONT>
<BR><FONT SIZE=2>&gt; subject</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt; to access, review and disclosure by the sender's Email System</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Administrator.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; -----------------------------------------------------</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; Confidentiality Notice.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; This email message is for the sole use of the intended recipient(s) and</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; may contain confidential and privileged information. Any unauthorized</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; review, use, disclosure or distribution is prohibited. If you are not</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; the intended recipient, please contact the sender by reply email and</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; destroy all copies of the original message. If you are the intended</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; recipient, please be advised that the content of this message is subject</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt; to access, review and disclosure by the sender's Email System </FONT>
<BR><FONT SIZE=2>&gt; Administrator.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; ----------------------------------------------------- </FONT>
<BR><FONT SIZE=2>&gt; Confidentiality Notice.</FONT>
<BR><FONT SIZE=2>&gt; This email message is for the sole use of the intended recipient(s) and </FONT>
<BR><FONT SIZE=2>&gt; may contain confidential and privileged information. Any unauthorized </FONT>
<BR><FONT SIZE=2>&gt; review, use, disclosure or distribution is prohibited. If you are not </FONT>
<BR><FONT SIZE=2>&gt; the intended recipient, please contact the sender by reply email and </FONT>
<BR><FONT SIZE=2>&gt; destroy all copies of the original message. If you are the intended </FONT>
<BR><FONT SIZE=2>&gt; recipient, please be advised that the content of this message is subject </FONT>
<BR><FONT SIZE=2>&gt; to access, review and disclosure by the sender's Email System Administrator.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
</P>
<BR>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>-----------------------------------------------------&nbsp; </FONT>
<BR><FONT SIZE=2>Confidentiality Notice. </FONT>
<BR><FONT SIZE=2>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.</FONT></P>

</BODY>
</HTML>
------_=_NextPart_001_01C4234E.16A7DC9C--