37#ifndef VIGRA_MULTI_MORPHOLOGY_HXX
38#define VIGRA_MULTI_MORPHOLOGY_HXX
42#include "multi_distance.hxx"
43#include "array_vector.hxx"
44#include "multi_array.hxx"
45#include "accessor.hxx"
46#include "numerictraits.hxx"
47#include "navigator.hxx"
48#include "metaprogramming.hxx"
49#include "multi_pointoperators.hxx"
50#include "functorexpression.hxx"
60template <
class DestType,
class TmpType>
61struct MultiBinaryMorphologyImpl
63 template <
class SrcIterator,
class SrcShape,
class SrcAccessor,
64 class DestIterator,
class DestAccessor>
66 exec( SrcIterator s, SrcShape
const & shape, SrcAccessor src,
67 DestIterator d, DestAccessor dest,
68 double radius,
bool dilation)
70 using namespace vigra::functor;
79 double radius2 = radius * radius;
81 ? NumericTraits<DestType>::zero()
93template <
class DestType>
103 using namespace vigra::functor;
108 DestType radius2 = detail::RequiresExplicitCast<DestType>::cast(radius * radius);
110 ? NumericTraits<DestType>::zero()
122struct MultiBinaryMorphologyImpl<
bool,
bool>
130 vigra_fail(
"multiBinaryMorphology(): Internal error (this function should never be called).");
229 typedef typename DestAccessor::value_type
DestType;
235 if(
dmax > NumericTraits<DestType>::toRealPromote(NumericTraits<DestType>::max()))
237 detail::MultiBinaryMorphologyImpl<DestType, TmpType>::exec(s, shape,
src, d,
dest, radius,
false);
241 detail::MultiBinaryMorphologyImpl<DestType, DestType>::exec(s, shape,
src, d,
dest, radius,
false);
255template <
unsigned int N,
class T1,
class S1,
262 vigra_precondition(source.shape() ==
dest.shape(),
263 "multiBinaryErosion(): shape mismatch between input and output.");
265 destMultiArray(
dest), radius );
353 typedef typename DestAccessor::value_type
DestType;
359 if(
dmax > NumericTraits<DestType>::toRealPromote(NumericTraits<DestType>::max()))
361 detail::MultiBinaryMorphologyImpl<DestType, TmpType>::exec(s, shape,
src, d,
dest, radius,
true);
365 detail::MultiBinaryMorphologyImpl<DestType, DestType>::exec(s, shape,
src, d,
dest, radius,
true);
379template <
unsigned int N,
class T1,
class S1,
386 vigra_precondition(source.shape() ==
dest.shape(),
387 "multiBinaryDilation(): shape mismatch between input and output.");
389 destMultiArray(
dest), radius );
474 typedef typename NumericTraits<typename DestAccessor::value_type>::ValueType
DestType;
475 typedef typename NumericTraits<typename DestAccessor::value_type>::Promote
TmpType;
477 enum { N = 1 + SrcIterator::level };
483 for(
int i=0;
i<N;
i++)
486 using namespace vigra::functor;
495 detail::internalSeparableMultiArrayDistTmp( s, shape,
src,
tmpArray.traverser_begin(),
506 detail::internalSeparableMultiArrayDistTmp( s, shape,
src, d,
dest,
sigmas );
521template <
unsigned int N,
class T1,
class S1,
528 vigra_precondition(source.shape() ==
dest.shape(),
529 "multiGrayscaleErosion(): shape mismatch between input and output.");
531 destMultiArray(
dest), sigma);
615 typedef typename NumericTraits<typename DestAccessor::value_type>::ValueType
DestType;
616 typedef typename NumericTraits<typename DestAccessor::value_type>::Promote
TmpType;
619 enum { N = 1 + SrcIterator::level };
625 for(
int i=0;
i<N;
i++)
628 using namespace vigra::functor;
637 detail::internalSeparableMultiArrayDistTmp( s, shape,
src,
tmpArray.traverser_begin(),
647 detail::internalSeparableMultiArrayDistTmp( s, shape,
src, d,
dest,
sigmas,
true );
662template <
unsigned int N,
class T1,
class S1,
669 vigra_precondition(source.shape() ==
dest.shape(),
670 "multiGrayscaleDilation(): shape mismatch between input and output.");
672 destMultiArray(
dest), sigma);
Class for a single RGB value.
Definition rgbvalue.hxx:128
size_type size() const
Definition tinyvector.hxx:913
void separableMultiDistSquared(...)
Euclidean distance squared on multi-dimensional arrays.
void multiGrayscaleErosion(...)
Parabolic grayscale erosion on multi-dimensional arrays.
void multiBinaryErosion(...)
Binary erosion on multi-dimensional arrays.
void transformMultiArray(...)
Transform a multi-dimensional array with a unary function or functor.
void multiGrayscaleDilation(...)
Parabolic grayscale dilation on multi-dimensional arrays.
FFTWComplex< R >::SquaredNormType squaredNorm(const FFTWComplex< R > &a)
squared norm (= squared magnitude)
Definition fftw3.hxx:1044
detail::SelectIntegerType< 32, detail::SignedIntTypes >::type Int32
32-bit signed int
Definition sized_int.hxx:175
void multiBinaryDilation(...)
Binary dilation on multi-dimensional arrays.