[Insight-users] SignedMaurerDistanceMapImageFilter bugged?

Dženan Zukić dzenanz at gmail.com
Mon Mar 21 11:43:31 EDT 2011


Hi guys,

I was testing SignedMaurerDistanceMapImageFilter today, and I ran into some
weird results. Namely, there seem to be some wrong results for my test
images. To make things more obvious, I created 2D test cases and they are
attached, as well as results.

bin_* are binary test images. They were extracted from 3D versions which
were written as intermediate debug output from my project (obtained using
BinaryThresholdImageFilter).
df_* are outputs created with the test program below. Some obvious errors
are circled in red. [The result for real life data is over the 80KB list
limitation so I had to remove it. The problems are in the lower left corner
and along the entire right edge.]

Are these know limitations, bugs which I discovered or my misinterpretation
of the purpose of this filter?

Regards,
Dženan

bugTester.cpp (uses ITK 3.20):
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkImage.h"
#include "itkContinuousIndex.h"
#include "itkSignedMaurerDistanceMapImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
#include <iostream>
using namespace std;
int main( int argc, char ** argv )
{
    typedef itk::Image<short, 2> ShortImageType;
    typedef itk::Image<unsigned short, 2> UShortImageType;
    typedef itk::Image<unsigned char, 2> VisualizingImageType;
    typedef itk::ImageFileReader< VisualizingImageType >  ReaderType;
    ReaderType::Pointer reader = ReaderType::New();
    reader->SetFileName( argv[1]  ); //read binary image stored in png
    reader->Update();

    VisualizingImageType::Pointer image=reader->GetOutput();
    typedef itk::SignedMaurerDistanceMapImageFilter<VisualizingImageType,
ShortImageType> DistanceMapType;
    DistanceMapType::Pointer dm=DistanceMapType::New();
    dm->SetInput(image);
    dm->SquaredDistanceOff();
    //dm->SetInsideIsPositive(true);
    dm->Update();

    typedef itk::RescaleIntensityImageFilter < ShortImageType,
UShortImageType > RescaleImageFilterType;
    RescaleImageFilterType::Pointer rescale = RescaleImageFilterType::New();
    rescale->SetInput( dm->GetOutput() );
    rescale->Update();

    typedef itk::ImageFileWriter<UShortImageType> WriterType;
    WriterType::Pointer writer1=WriterType::New();
    writer1->SetFileName("dfBug.png");
    writer1->SetInput(rescale->GetOutput());
    writer1->Update();

    return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110321/33defbfc/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin_realdata2D.png
Type: image/png
Size: 31593 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110321/33defbfc/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin_synthetic2D.png
Type: image/png
Size: 1280 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110321/33defbfc/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: df_synthetic_inside_positive2D_bugCircled.png
Type: image/png
Size: 12839 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110321/33defbfc/attachment-0005.png>


More information about the Insight-users mailing list