17#ifndef __filter_dilate_h__
18#define __filter_dilate_h__
24#include "filter/base.h"
52 template <
class HeaderType>
53 Dilate (
const HeaderType& in) :
60 template <
class HeaderType>
69 template <
class InputImageType,
class OutputImageType>
70 void operator() (InputImageType& input, OutputImageType& output)
74 std::shared_ptr <Image<bool> > out;
77 for (
unsigned int pass = 0; pass <
npass; pass++) {
79 for (
auto l =
Loop (*in) (*in, *out); l; ++l)
80 out->value() =
dilate (*in);
90 void set_npass (
unsigned int npasses)
100 if (in.value())
return true;
102 if (in.index(0) > 0) { in.index(0)--; val = in.value(); in.index(0)++;
if (val)
return true; }
103 if (in.index(1) > 0) { in.index(1)--; val = in.value(); in.index(1)++;
if (val)
return true; }
104 if (in.index(2) > 0) { in.index(2)--; val = in.value(); in.index(2)++;
if (val)
return true; }
105 if (in.index(0) < in.
size(0)-1) { in.index(0)++; val = in.value(); in.index(0)--;
if (val)
return true; }
106 if (in.index(1) < in.
size(1)-1) { in.index(1)++; val = in.value(); in.index(1)--;
if (val)
return true; }
107 if (in.index(2) < in.
size(2)-1) { in.index(2)++; val = in.value(); in.index(2)--;
if (val)
return true; }
static constexpr uint8_t Bit
a filter to dilate a mask
bool dilate(Image< bool > &in)
static Image scratch(const Header &template_header, const std::string &label="scratch image")
ssize_t size(size_t axis) const
implements a progress meter to provide feedback to the user
FORCE_INLINE LoopAlongAxes Loop()
void copy(InputImageType &&source, OutputImageType &&destination, size_t from_axis=0, size_t to_axis=std::numeric_limits< size_t >::max())