Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mirtk::VoxelFunction Struct Reference

#include <VoxelFunction.h>

Inherited by mirtk::AddBSplineSVFFD, mirtk::AddBSplineSVFFD3D, mirtk::AddDOFsOfBSplineSVFFD, mirtk::BinaryVoxelFunction::Add, mirtk::BinaryVoxelFunction::ComposeDisplacementFields2D< TReal, TInterpolator >, mirtk::BinaryVoxelFunction::ComposeDisplacementFields3D< TReal, TInterpolator >, mirtk::BinaryVoxelFunction::Copy, mirtk::BinaryVoxelFunction::Dilate, mirtk::BinaryVoxelFunction::Div, mirtk::BinaryVoxelFunction::Erode, mirtk::BinaryVoxelFunction::Mul, mirtk::BinaryVoxelFunction::Sub, mirtk::ConvolutionFunction::ConvolveForegroundInT< TKernel >, mirtk::ConvolutionFunction::ConvolveForegroundInX< TKernel >, mirtk::ConvolutionFunction::ConvolveForegroundInY< TKernel >, mirtk::ConvolutionFunction::ConvolveForegroundInZ< TKernel >, mirtk::ConvolutionFunction::ConvolveInT< TKernel >, mirtk::ConvolutionFunction::ConvolveInX< TKernel >, mirtk::ConvolutionFunction::ConvolveInY< TKernel >, mirtk::ConvolutionFunction::ConvolveInZ< TKernel >, mirtk::ConvolutionFunction::ConvolveWeightedImageInT< TKernel >, mirtk::ConvolutionFunction::ConvolveWeightedImageInX< TKernel >, mirtk::ConvolutionFunction::ConvolveWeightedImageInY< TKernel >, mirtk::ConvolutionFunction::ConvolveWeightedImageInZ< TKernel >, mirtk::ConvolutionFunction::ExtendedForegroundConvolution1D< TKernel >, mirtk::ConvolutionFunction::MirroredForegroundConvolution1D< TKernel >, mirtk::ConvolutionFunction::TruncatedForegroundConvolution1D< TKernel >, mirtk::EvaluateBSplineSVFFD, mirtk::EvaluateBSplineSVFFD3D, mirtk::EvaluateGlobalSVFFD, mirtk::EvaluateGlobalSVFFD3D, mirtk::MultipleVoxelTransformation::Base, mirtk::NaryVoxelFunction::EvaluateBCHFormula, mirtk::NaryVoxelFunction::EvaluateBCHUpdate, mirtk::NaryVoxelFunction::ExpVelocityFieldEuler2D< TInterpolator >, mirtk::NaryVoxelFunction::ExpVelocityFieldEuler3D< TInterpolator >, mirtk::NaryVoxelFunction::NOP, mirtk::NaryVoxelFunction::VoxelWiseWeightedSum, mirtk::TernaryVoxelFunction::Diff, mirtk::TernaryVoxelFunction::Div, mirtk::TernaryVoxelFunction::Mul, mirtk::TernaryVoxelFunction::Sum, mirtk::UnaryVoxelFunction::CastToGreyValue, mirtk::UnaryVoxelFunction::Clamp< T >, mirtk::UnaryVoxelFunction::DownsampleX< TVoxel >, mirtk::UnaryVoxelFunction::DownsampleY< TVoxel >, mirtk::UnaryVoxelFunction::DownsampleZ< TVoxel >, mirtk::UnaryVoxelFunction::InterpolateImage< TInterpolator >, mirtk::UnaryVoxelFunction::InterpolateMultiChannelImage< TInterpolator >, mirtk::UnaryVoxelFunction::InterpolateScalarImage< TInterpolator >, mirtk::UnaryVoxelFunction::LowerThreshold< T >, mirtk::UnaryVoxelFunction::Sqrt, mirtk::UnaryVoxelFunction::UpperThreshold< T >, and mirtk::VoxelReduction.

Collaboration diagram for mirtk::VoxelFunction:
Collaboration graph

Public Member Functions

void join (VoxelFunction &)
 Join results.
 
void split (VoxelFunction &)
 
 VoxelFunction ()
 Default constructor.
 

Static Public Member Functions

static bool IsReduction ()
 

Public Attributes

const ImageAttributes_Domain
 

Detailed Description

Base class for voxel functions

The basic voxel functions which are part of this library and included by the mirtkVoxelFunction.h module demonstrate the implementation and use of the ForEachVoxel function templates. These templates can be well optimized by the compiler and provide the fastest way of iterating over all voxels in a given image region (or the entire image) of one or more images. When processing multiple images at the same time, these must have the same image size.

Example usage:

// Determine intensity range of grayscale image
GreyImage image(attr);
UnaryVoxelFunction::GetMinMax minmax;
ForEachVoxel(image, minmax);
double min = minmax.GetMinAsDouble();
double max = minmax.GetMaxAsDouble();
// Add three images within a given region and store result in another
NaryVoxelFunction::Sum sum;
GreyImage input1(attr);
GreyImage input2(attr);
GreyImage input3(attr);
GreyImage output(attr);
blocked_range3d<int> region(1, 2, 0, attr._y, 0, attr._x);
ForEachVoxel(region, input1, input2, input3, output, sum);
// Subtract one image from another
// Note: Voxel function passed in this case by copy instead of reference!
// This is only possible if it is not a voxel reduction.
GreyImage minuend (attr);
GreyImage subtrahend(attr);
ParallelForEachVoxel(BinaryVoxelFunction::Sub(), subtrahend, minuend);

If a voxel function needs to consider also the intensities of neighboring voxels, it can access these by manipulating the given pointer to the current voxel to be processed. Useful helpers for this are the NeighborhoodOffsets and ImageRegion classes.

See also
NeighborhoodOffsets, ImageRegion, ForEachVoxelDomain

Definition at line 83 of file VoxelFunction.h.

Member Function Documentation

§ IsReduction()

static bool mirtk::VoxelFunction::IsReduction ( )
inlinestatic

Used by ParallelForEachVoxel to determine if voxel function has to be executed using parallel_reduce

Definition at line 106 of file VoxelFunction.h.

§ split()

void mirtk::VoxelFunction::split ( VoxelFunction )
inline

Split "constructor"

Note
A method is used instead of an actual split constructor such that subclasses which are not used for reduction do not need to implement such constructor.

Definition at line 113 of file VoxelFunction.h.

Member Data Documentation

§ _Domain

const ImageAttributes* mirtk::VoxelFunction::_Domain

Finite image domain of images processed by this voxel function

Attributes of first image which should be identical to other images, at least the number of voxels must be identical. This const pointer, when not set before by the user of the voxel function or its constructor, is set by the ForEachVoxelBody constructor called by the ForEachVoxel and ParallelForEachVoxel template functions.

These image attributes give access to commonly needed functions within the voxel function operator() implementation such as:

Definition at line 99 of file VoxelFunction.h.


The documentation for this struct was generated from the following file: