From 4bf9fc7545c155ec9458ce65771c1f0b4425010d Mon Sep 17 00:00:00 2001 From: delmon Date: Thu, 24 Mar 2011 10:14:29 +0000 Subject: [PATCH] [BUG] Change to signed distance. --- tools/clitkGammaIndex.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/clitkGammaIndex.cxx b/tools/clitkGammaIndex.cxx index d6dfaa7..4748bff 100644 --- a/tools/clitkGammaIndex.cxx +++ b/tools/clitkGammaIndex.cxx @@ -8,7 +8,7 @@ using std::endl; #include #include #include -#include +#include #include "clitkGammaIndex_ggo.h" @@ -24,7 +24,7 @@ typedef itk::ChangeInformationImageFilter Scaler; typedef itk::Image ImageBin; typedef itk::Image ImageMap; -typedef itk::DanielssonDistanceMapImageFilter Mapper; +typedef itk::SignedDanielssonDistanceMapImageFilter Mapper; template void SaveImage(const ImageType *image, const std::string &filename) { @@ -109,7 +109,10 @@ void FillImageBin(ImageBin *image_bin, const Image *reference) { assert(found); #endif - image_bin->SetPixel(index_bin,255); + while (index_bin[Image::GetImageDimension()] >=0 ) { + image_bin->SetPixel(index_bin,255); + index_bin[Image::GetImageDimension()]--; + } ++iterator; } @@ -142,7 +145,7 @@ void FillImageGamma(Image *gamma, const Image *target, const ImageMap *distance) assert(found); #endif - gamma_iterator.Set(distance->GetPixel(index_map)); + gamma_iterator.Set(fabsf(distance->GetPixel(index_map))); ++gamma_iterator; ++target_iterator; @@ -291,6 +294,7 @@ int main(int argc,char * argv[]) // compute distance map Mapper::Pointer mapper = Mapper::New(); + mapper->InsideIsPositiveOn(); mapper->UseImageSpacingOn(); mapper->SetInput(image_bin); mapper->Update(); -- 2.47.1