[Insight-users] Problems with Maurer Distance Transform

Christian Werner christian.werner at rwth-aachen.de
Sun Apr 25 14:01:43 EDT 2010


Thank you very much. That double datatype turned out to be the reason 
for all the trouble I had. Your code works perfectly.

What I am trying now is to replace the Rescaling with a simple 
conversion because I need the real distance in pixels, unscaled. I tried 
itkCastImage but that yields bad results, maybe because the Maurer 
Filter produces negative values...? You already have funny behaviour if 
you just replace the Rescaler with a Caster in your code and with my 
image. "Funny" but still somehow right. However, if I am doing this on 
my volume data, where I actually need it for, it goes completely 
useless. (with the rescaling I have good results on my volume, too)

Any idea?



Luis Ibanez wrote:
>
> Hi Christian,
>
>
> As described in the Insight Journal paper:
>
> "N-D Linear Time Exact Signed Euclidean Distance Transform"
> Tustison N.J., Siqueira M., Gee J.C.
> University of Pennsylvania
> http://www.insight-journal.org/browse/publication/77
> http://hdl.handle.net/1926/171
>
>
> where the ITK implementation of the Maurer filter was
> introduced,
>
>
> The Maurer filter computes the exact euclidean distance
> (down to numerical precision), while the Danielsson
> distance filter only approximates the distance up to a
> 1 pixel spacing values.
>
>
> It is therefore, not surprising that you find differences
> between the distance values reported by these two
> filters....
>
> However, the output that you are reporting for the
> Signed Maurer distance really looks plain wrong     :-(
>
>
> It would seem that you have a problem in the
> instantiation of the filter.
>
>
> I just ran the Signed Maurer from a modified version
> of the Test in
>
>         Insight/Testing/Code/BasicFilters
>
> and using your input image (BTW: Thanks a lot for
> providing the input image and output images, that
> makes things a lot easier)  and it works fine for me.
>
>
> Please find attached to this email the source
> code that I used, and the output that I get from
> the rescaled distance.  
>
>
> Note that the distance is produced as an image
> of pixel type double, so the command line that
> I used was:
>
>
> MaurerDistance input_image.png distance.mha \
> maurer_output_uchar.png
>
> The exact distances are stored in the distance.mha
> file ( the MetaImage file format supports pixel type
> "double"), while the .png image holds a rescaled
> version of the distance, that is just intended for
> visualization (that rescaled one is the one attached
> to this email).
>
> I had to pass the .png file through GIMP in order
> to compress it further as a jpg file, to be able to
> attach it to this email. The mailing list restricts
> email size to 40Kb.
>
> --
>
> Please note also the setting of the filter:
>
>   filter->SetSquaredDistance( false );
>   filter->SetUseImageSpacing( false );
>   filter->SetInsideIsPositive( false );
>
>
> Please give it a try at this code and let us know
> if you find any problem.
>
>
>      Thanks
>
>
>           Luis
>
>
> -----------------------------------------------------------------------------------
> On Sun, Apr 25, 2010 at 11:58 AM, Christian Werner 
> <christian.werner at rwth-aachen.de 
> <mailto:christian.werner at rwth-aachen.de>> wrote:
>
>     Hi!
>
>     I need a nice DistanceTransformation function. Danielsson is fine
>     but slooooow. Then I tried the SignedMaurerDistanceMapImageFilter
>     which is quite fast. Unfortunately the results are quite
>     different. It seems the DanielsonDistanceMapImageFilter yields
>     better results. What am I doing wrong?
>
>     I am passing no input parameter to the filters, I just put them in
>     the pipeline. Maybe I am missing important parameters? They are
>     both used the exactly same way:
>
>      ///// typedef typename itk::DanielssonDistanceMapImageFilter<
>     ImageType, ImageType > FilterType;
>      typedef typename itk::SignedMaurerDistanceMapImageFilter<
>     ImageType, ImageType > FilterType;
>      typename FilterType::Pointer filter = FilterType::New();
>      filter->SetInput( itkImporter->GetOutput() );
>
>     Any idea?
>
>
>     Best regards,
>     Christian
>
>     _____________________________________
>     Powered by www.kitware.com <http://www.kitware.com>
>
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
>
>     Kitware offers ITK Training Courses, for more information visit:
>     http://www.kitware.com/products/protraining.html
>
>     Please keep messages on-topic and check the ITK FAQ at:
>     http://www.itk.org/Wiki/ITK_FAQ
>
>     Follow this link to subscribe/unsubscribe:
>     http://www.itk.org/mailman/listinfo/insight-users
>
>
> ------------------------------------------------------------------------
>



More information about the Insight-users mailing list