[Insight-users] SignedMaurerDistanceMapImageFilter bugged?
Dan Mueller
dan.muel at gmail.com
Mon Mar 21 11:59:17 EDT 2011
Hi Dženan,
Changing the output type from short to float avoids the issue (see attached).
To me this looks like a bug related to use with integer output images:
http://www.itk.org/Bug/
Regards, Dan
2011/3/21 Dženan Zukić <dzenanz at gmail.com>:
> 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;
> }
> _____________________________________
> Powered by 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
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin_synthetic2D_out.png
Type: image/png
Size: 21007 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110321/424d6dc5/attachment.png>
More information about the Insight-users
mailing list