/usr/include/InsightToolkit/Common/itkConstantBoundaryCondition.h is in libinsighttoolkit3-dev 3.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkConstantBoundaryCondition.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkConstantBoundaryCondition_h
#define __itkConstantBoundaryCondition_h
#include "itkNeighborhood.h"
#include "itkNumericTraits.h"
#include "itkImageBoundaryCondition.h"
namespace itk
{
/** \class ConstantBoundaryCondition
* \brief This boundary condition returns a constant value for out-of-bounds
* image pixels.
*
* For example, invoking this function object with a constant value of zero
* (the default) on each out-of-bounds element of a 7x5 iterator that masks a
* region at an image corner
* (iterator is centered on the 2):
*
* * * * * * * *
* * * * * * * *
* * * 1 2 3 4 5 (where * denotes pixels that lie
* * * 3 3 5 5 6 outside of the image boundary)
* * * 4 4 6 7 8
*
* would produce the following neighborhood of values:
*
* 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0
* 0 0 1 2 3 4 5
* 0 0 3 3 5 5 6
* 0 0 4 4 6 7 8
*
*
* \note If you are using an image with Array as the pixel type, you will need
* to set the constant explicitly with an array of the appropriate length. This
* is also true if your image type is a VectorImage.
*
* \sa ImageBoundaryCondition
*
* \ingroup DataRepresentation
* \ingroup ImageObjects
*/
template<class TImage>
class ITK_EXPORT ConstantBoundaryCondition
: public ImageBoundaryCondition<TImage>
{
public:
/** Self & superclass typedefs */
typedef ConstantBoundaryCondition Self;
typedef ImageBoundaryCondition<TImage> Superclass;
/** Extract information from the image type */
typedef typename Superclass::PixelType PixelType;
typedef typename Superclass::PixelPointerType PixelPointerType;
typedef typename Superclass::IndexType IndexType;
typedef typename Superclass::OffsetType OffsetType;
typedef typename Superclass::NeighborhoodType NeighborhoodType;
typedef typename Superclass::NeighborhoodAccessorFunctorType
NeighborhoodAccessorFunctorType;
/** Save the image dimension. */
itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
/** Default constructor. */
ConstantBoundaryCondition()
{ m_Constant = NumericTraits<PixelType>::Zero; }
/** Computes and returns appropriate out-of-bounds values from
* neighborhood iterator data. */
virtual PixelType operator()(const OffsetType&,
const OffsetType&,
const NeighborhoodType *) const
{ return m_Constant; }
/** Computes and returns the appropriate pixel value from
* neighborhood iterator data, using the functor. */
virtual PixelType operator()(
const OffsetType& ,
const OffsetType& ,
const NeighborhoodType *,
const NeighborhoodAccessorFunctorType & ) const
{ return m_Constant; }
/** Set the value of the constant. */
void SetConstant(const PixelType &c)
{ m_Constant = c; }
/** Get the value of the constant. */
const PixelType &GetConstant() const
{ return m_Constant; }
/** Tell if the boundary condition can index to any location within
* the associated iterator's neighborhood or if it has some limited
* subset (such as none) that it relies upon. */
bool RequiresCompleteNeighborhood() { return false; }
private:
PixelType m_Constant;
};
} // end namespace itk
#endif
|