~ubuntu-branches/ubuntu/precise/insighttoolkit/precise

« back to all changes in this revision

Viewing changes to Code/BasicFilters/itkSignedDanielssonDistanceMapImageFilter.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-12-19 20:16:49 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081219201649-drt97guwl2ryt0cn

* New upstream version.
  - patches/nifti-versioning.patch: Remove.  Applied upstream.
  - control:
  - rules: Update version numbers, package names.

* control: Build-depend on uuid-dev (gdcm uses it).

* copyright: Update download URL.

* rules: Adhere to parallel=N in DEB_BUILD_OPTIONS by setting MAKEFLAGS.

* compat: Set to 7.
* control: Update build-dep on debhelper to version >= 7.

* CMakeCache.txt.debian: Set CMAKE_BUILD_TYPE to "RELEASE" so that we
  build with -O3 (not -O2), necessary to optimize the templated code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   Insight Segmentation & Registration Toolkit
4
4
  Module:    $RCSfile: itkSignedDanielssonDistanceMapImageFilter.h,v $
5
5
  Language:  C++
6
 
  Date:      $Date: 2006-03-30 15:36:25 $
7
 
  Version:   $Revision: 1.4 $
 
6
  Date:      $Date: 2008-10-17 20:49:56 $
 
7
  Version:   $Revision: 1.5 $
8
8
 
9
9
  Copyright (c) Insight Software Consortium. All rights reserved.
10
10
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
25
25
//Simple functor to invert an image for Outside Danielsson distance map
26
26
namespace itk
27
27
{
28
 
  namespace Functor
29
 
    {
30
 
    template <class InputPixelType> class InvertIntensityFunctor
31
 
    {
32
 
    public:
33
 
      InputPixelType operator()( InputPixelType input )
34
 
        {
35
 
        if (input)
36
 
          {
37
 
          return NumericTraits<InputPixelType>::Zero;
38
 
          }
39
 
        else
40
 
          {
41
 
          return NumericTraits<InputPixelType>::One;
42
 
          }
43
 
        }
44
 
    };
45
 
  }
 
28
namespace Functor
 
29
{
 
30
template <class InputPixelType> class InvertIntensityFunctor
 
31
{
 
32
public:
 
33
  InputPixelType operator()( InputPixelType input )
 
34
    {
 
35
    if (input)
 
36
      {
 
37
      return NumericTraits<InputPixelType>::Zero;
 
38
      }
 
39
    else
 
40
      {
 
41
      return NumericTraits<InputPixelType>::One;
 
42
      }
 
43
    }
 
44
};
 
45
}
46
46
}
47
47
 
48
48
 
50
50
{
51
51
 
52
52
/** \class SignedDanielssonDistanceMapImageFilter
53
 
*
54
 
* This class is parametrized over the type of the input image
55
 
* and the type of the output image.
56
 
*
57
 
* This filter computes the distance map of the input image 
58
 
* as an approximation with pixel accuracy to the Euclidean distance.
59
 
*
60
 
* For purposes of evaluating the signed distance map, the input is assumed 
61
 
* to be binary composed of pixels with value 0 and non-zero. 
62
 
*
63
 
* The inside is considered as having negative distances. Outside is treated
64
 
* as having positive distances. To change the convention, 
65
 
* use the InsideIsPositive(bool) function.
66
 
*
67
 
* As a convention, the distance is evaluated from the boundary of the ON pixels.
68
 
*
69
 
* The filter returns
70
 
* - A signed distance map with the approximation to the euclidean distance.
71
 
* - A voronoi partition. (See itkDanielssonDistanceMapImageFilter) 
72
 
* - A vector map containing the component of the vector relating
73
 
*   the current pixel with the closest point of the closest object
74
 
*   to this pixel. Given that the components of the distance are
75
 
*   computed in "pixels", the vector is represented by an
76
 
*   itk::Offset.  That is, physical coordinates are not used.
77
 
*   (See itkDanielssonDistanceMapImageFilter)
78
 
*   
79
 
* This filter internally uses the DanielssonDistanceMap filter.
80
 
* This filter is N-dimensional.
81
 
82
 
* \sa itkDanielssonDistanceMapImageFilter
83
 
*
84
 
* \ingroup ImageFeatureExtraction 
85
 
*
86
 
*/
 
53
 *
 
54
 * This class is parametrized over the type of the input image
 
55
 * and the type of the output image.
 
56
 *
 
57
 * This filter computes the distance map of the input image 
 
58
 * as an approximation with pixel accuracy to the Euclidean distance.
 
59
 *
 
60
 * For purposes of evaluating the signed distance map, the input is assumed 
 
61
 * to be binary composed of pixels with value 0 and non-zero. 
 
62
 *
 
63
 * The inside is considered as having negative distances. Outside is treated
 
64
 * as having positive distances. To change the convention, 
 
65
 * use the InsideIsPositive(bool) function.
 
66
 *
 
67
 * As a convention, the distance is evaluated from the boundary of the ON pixels.
 
68
 *
 
69
 * The filter returns
 
70
 * - A signed distance map with the approximation to the euclidean distance.
 
71
 * - A voronoi partition. (See itkDanielssonDistanceMapImageFilter) 
 
72
 * - A vector map containing the component of the vector relating
 
73
 *   the current pixel with the closest point of the closest object
 
74
 *   to this pixel. Given that the components of the distance are
 
75
 *   computed in "pixels", the vector is represented by an
 
76
 *   itk::Offset.  That is, physical coordinates are not used.
 
77
 *   (See itkDanielssonDistanceMapImageFilter)
 
78
 *   
 
79
 * This filter internally uses the DanielssonDistanceMap filter.
 
80
 * This filter is N-dimensional.
 
81
 * 
 
82
 * \sa itkDanielssonDistanceMapImageFilter
 
83
 *
 
84
 * \ingroup ImageFeatureExtraction 
 
85
 *
 
86
 */
87
87
 
88
88
template <class TInputImage,class TOutputImage>
89
89
class ITK_EXPORT SignedDanielssonDistanceMapImageFilter :
91
91
{
92
92
public:
93
93
  /** Standard class typedefs. */
94
 
  typedef SignedDanielssonDistanceMapImageFilter    Self;
 
94
  typedef SignedDanielssonDistanceMapImageFilter       Self;
95
95
  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
96
 
  typedef SmartPointer<Self> Pointer;
97
 
  typedef SmartPointer<const Self> ConstPointer;
 
96
  typedef SmartPointer<Self>                           Pointer;
 
97
  typedef SmartPointer<const Self>                     ConstPointer;
98
98
 
99
99
  /** Method for creation through the object factory */
100
100
  itkNewMacro(Self);