1 /*===================================================================
3 The Medical Imaging Interaction Toolkit (MITK)
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 See LICENSE.txt or http://www.mitk.org for details.
15 ===================================================================*/
16 #ifndef _itkDistanceMapFilter_txx
17 #define _itkDistanceMapFilter_txx
19 #include "itkDistanceMapFilter.h"
21 #include <itkSignedMaurerDistanceMapImageFilter.h>
27 template< class TInputImage, class TOutputImage >
28 DistanceMapFilter<TInputImage, TOutputImage>::DistanceMapFilter()
33 template< class TInputImage, class TOutputImage >
34 DistanceMapFilter<TInputImage, TOutputImage>::~DistanceMapFilter()
43 template< class TInputImage, class TOutputImage >
44 void DistanceMapFilter<TInputImage, TOutputImage>::GenerateData()
48 typedef itk::SignedMaurerDistanceMapImageFilter<InputImageType, OutputImageType> DistanceFilterType;
49 typename DistanceFilterType::Pointer dFilter = DistanceFilterType::New();
50 dFilter->SetInput(this->GetInput());
51 dFilter->SetUseImageSpacing(true);
52 dFilter->SetSquaredDistance(false);
53 dFilter->SetInsideIsPositive(true);
56 typename OutputImageType::Pointer outputImg = dFilter->GetOutput();
58 typedef itk::ImageRegionIterator<OutputImageType> ImageIteratorType;
60 ImageIteratorType outIt(outputImg, outputImg->GetRequestedRegion());
62 while(!outIt.IsAtEnd())
64 typename OutputImageType::PixelType p = outIt.Get();
70 Superclass::SetNthOutput( 0, outputImg );
79 #endif // _itkDistanceMapFilter_txx