20 #ifndef MIRTK_VoxelFunction_H 21 #define MIRTK_VoxelFunction_H 23 #include "mirtk/ImageAttributes.h" 24 #include "mirtk/VoxelDomain.h" 25 #include "mirtk/Parallel.h" 26 #include "mirtk/Stream.h" 137 cerr <<
"VoxelReduction::split must be overriden by each subclass!" << endl;
138 cerr <<
"Otherwise you should use VoxelFunction with parallel_for instead." << endl;
145 cerr <<
"VoxelReduction::join must be overriden by each subclass!" << endl;
146 cerr <<
"Otherwise you should use VoxelFunction with parallel_for instead." << endl;
159 template <
class VoxelFunc>
174 _VoxelFunc(vf), _k(0), _l(0)
176 if (!_VoxelFunc.VoxelFunction::_Domain) {
177 _VoxelFunc.VoxelFunction::_Domain = &attr;
184 _VoxelFunc(o._VoxelFunc), _k(o._k), _l(o._l)
193 _VoxelFunc(o._VoxelFunc), _k(o._k), _l(o._l)
213 template <
class VoxelFunc,
class Outs
ideFunc>
243 _OutsideFunc(o._OutsideFunc)
260 namespace NaryVoxelFunction {
269 template <
class TImage>
275 template <
class TImage>
276 void operator()(
const TImage&,
int,
const void *,
const void *)
const {}
278 void operator()(
int,
int,
int,
int,
const void *,
const void *)
const {}
281 template <
class TImage>
282 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *)
const {}
284 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *)
const {}
287 template <
class TImage>
288 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *,
const void *)
const {}
290 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *,
const void *)
const {}
293 template <
class TImage>
294 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
296 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
299 template <
class TImage>
300 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
302 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
305 template <
class TImage>
306 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
308 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
311 template <
class TImage>
312 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
314 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
317 template <
class TImage>
318 void operator()(
const TImage&,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
320 void operator()(
int,
int,
int,
int,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *,
const void *)
const {}
331 #include "mirtk/ForEachUnaryVoxelFunction.h" 332 #include "mirtk/ForEachBinaryVoxelFunction.h" 333 #include "mirtk/ForEachTernaryVoxelFunction.h" 334 #include "mirtk/ForEachQuaternaryVoxelFunction.h" 335 #include "mirtk/ForEachQuinaryVoxelFunction.h" 336 #include "mirtk/ForEachSenaryVoxelFunction.h" 337 #include "mirtk/ForEachSeptenaryVoxelFunction.h" 338 #include "mirtk/ForEachOctaryVoxelFunction.h" 339 #include "mirtk/ForEachNonaryVoxelFunction.h" 342 #endif // MIRTK_VoxelFunction_H void operator()(const TImage &, int, const void *, const void *, const void *) const
Ternary voxel function operator.
void operator()(const TImage &, int, const void *, const void *, const void *, const void *, const void *, const void *, const void *, const void *, const void *) const
Nonary voxel function operator.
void operator()(int, int, int, int, const void *, const void *, const void *, const void *, const void *, const void *) const
Senary voxel function operator.
void operator()(int, int, int, int, const void *, const void *, const void *) const
Ternary voxel function operator.
void operator()(const TImage &, int, const void *, const void *) const
Binary voxel function operator.
ForEachVoxelIfBody(const VoxelFunc &vf, const OutsideFunc &of, const ImageAttributes &attr)
Constructor.
Dummy type used to distinguish split constructor from copy constructor.
void operator()(int, int, int, int, const void *, const void *, const void *, const void *, const void *, const void *, const void *, const void *, const void *) const
Nonary voxel function operator.
void operator()(int, int, int, int, const void *, const void *, const void *, const void *) const
Quaternary voxel function operator.
void operator()(int, int, int, int, const void *, const void *) const
Binary voxel function operator.
ForEachVoxelIfBody(ForEachVoxelIfBody &o, split s)
Split constructor.
void operator()(int, int, int, int, const void *, const void *, const void *, const void *, const void *, const void *, const void *) const
Septenary voxel function operator.
ForEachVoxelBody(const ForEachVoxelBody &o)
Copy constructor.
void join(ForEachVoxelBody &rhs)
Join results.
ForEachVoxelIfBody(const ForEachVoxelIfBody &o)
Copy constructor.
VoxelFunction()
Default constructor.
const ImageAttributes * _Domain
void operator()(const TImage &, int, const void *, const void *, const void *, const void *) const
Quaternary voxel function operator.
VoxelFunc _VoxelFunc
Functor executed for each voxel.
ForEachVoxelBody(const VoxelFunc &vf, const ImageAttributes &attr)
Constructor.
static bool IsReduction()
void join(VoxelFunction &)
Join results.
void operator()(const TImage &, int, const void *, const void *, const void *, const void *, const void *, const void *) const
Senary voxel function operator.
void operator()(int, int, int, int, const void *) const
Unary voxel function operator.
int _l
Indices for fixed dimensions.
void join(VoxelFunction &)
Join results.
static bool IsReduction()
void operator()(const TImage &, int, const void *, const void *, const void *, const void *, const void *) const
Quinery voxel function operator.
OutsideFunc _OutsideFunc
Functor executed for each background voxel.
void operator()(int, int, int, int, const void *, const void *, const void *, const void *, const void *, const void *, const void *, const void *) const
Octary voxel function operator.
ForEachVoxelBody(ForEachVoxelBody &o, split s)
Split constructor.
void operator()(const TImage &, int, const void *) const
Unary voxel function operator.
void operator()(const TImage &, int, const void *, const void *, const void *, const void *, const void *, const void *, const void *) const
Septenary voxel function operator.
void join(ForEachVoxelIfBody &rhs)
Join results.
void operator()(const TImage &, int, const void *, const void *, const void *, const void *, const void *, const void *, const void *, const void *) const
Octary voxel function operator.
void split(VoxelFunction &)
void split(VoxelFunction &)
Split "constructor".
void operator()(int, int, int, int, const void *, const void *, const void *, const void *, const void *) const
Quinery voxel function operator.