Filtering and combining

These classes and functions are related to filtering and combining of 2D and 3D images. More...

## Data Structures

class | C2DFifoFilterPlugin
| The plug-in base class for the FIFO filters. More...
class | C2DFuzzyClusterSolver
| A solver for the fuzzy segmentation smoothness constraint. More...
class | C2DImageFifoFilter
| The class to provide filtering of series of 2D images as if they where 3D images. More...
class | C2DSolveCG
| solve_sCG – a class providing a CG solver More...
struct | FDeformer2D
class | solve_sCG
| a class providing a CG solver More...
class | TCST2DKernel< T >
| Base class for cos/sin transformation filters. More...
class | TDataFilter< D >
| Generic interface class to data filters. More...
class | TDataFilterPlugin< Image >
| Generic image filter plugin base. More...
class | TFifoFilter< T >
| Generic base class for out-of-core FIFO filters. More...
struct | TFilter< R >
| base class for all filer type functors. More...
class | TFilterChain< Handler >
| create and use a chain of filters More...
class | TImageCreator< T >
| The base class for generic image creation. More...
class | TWatershed< dim >
| templated version of the standard watershed algorithm More...
class | TWatershedFilterPlugin< dim >
| plugin for the templated version of the standard watershed algorithm More...

## Typedefs

typedef THandlerSingleton< TFactoryPluginHandler< C2DFifoFilterPlugin > > | C2DFifoFilterPluginHandler
| Plugin handler for the FIFO filters.
typedef TDataFilter< C2DImage > | C2DFilter
typedef TDataFilterPlugin< C2DImage > | C2DFilterPlugin
typedef THandlerSingleton< TFactoryPluginHandler< C2DFilterPlugin > > | C2DFilterPluginHandler
typedef TImageCombiner< C2DImage > | C2DImageCombiner
| 2D Image combiner
typedef TFilterChain< C2DFilterPluginHandler > | C2DImageFilterChain
typedef TDataFilter< C3DImage > | C3DFilter
| Base class for 3D image filters. Filters are implemented as plug-ins.
typedef TDataFilterPlugin< C3DImage > | C3DFilterPlugin
| The 3D filter plugin type.
typedef THandlerSingleton< TFactoryPluginHandler< C3DFilterPlugin > > | C3DFilterPluginHandler
| The 3D filter plugin handler.
typedef TImageCombiner< C3DImage > | C3DImageCombiner
| Base class for plug-ins that combine two 3D images in certain ways.
typedef TFilterChain< C3DFilterPluginHandler > | C3DImageFilterChain
| 3D filter chain to apply various filters in one run
typedef TFilterChain< CMeshFilterPluginHandler > | CMeshFilterChain
typedef TDataFilterPlugin< CTriangleMesh > | CMeshFilterPlugin
typedef THandlerSingleton< TFactoryPluginHandler< CMeshFilterPlugin > > | CMeshFilterPluginHandler
typedef std::shared_ptr< C2DFilter > | P2DFilter
typedef TFifoFilter< P2DImage >::Pointer | P2DImageFifoFilter
| Pointer type for the FIFO filter.
typedef std::shared_ptr< C3DFilter > | P3DFilter
| The 3D filter shared pointer.
typedef std::shared_ptr< CMeshFilter > | PMeshFilter

## Functions

template<typename F, typename A, typename B>
static F::result_type | accumulate (F &f, const A &a, const B &b)
| *‍/
template<typename F, typename B>
static F::result_type | accumulate (F &f, const B &data)
template<typename S>
std::vector< P3DFilter > | create_filter_chain (const std::vector< S > &chain)
| Convenience function to create a filter chain from a series of filter descriptions.
| DEFINE_Image_Creator (C3DImage)
| The 3D specialization of the TImageCreator template.
bool | fborder (long index, long nx, long ny, long nz)
| function defining field borders
template<typename F, typename A, typename B>
static F::result_type | filter (const F &f, const A &a, const B &b)
| *‍/
template<typename F, typename B>
static F::result_type | filter (const F &f, const B &b)
template<typename F, typename B, typename O>
static F::result_type | filter_and_output (const F &f, const B &a, O &b)
template<typename F, typename B>
static F::result_type | filter_equal (const F &f, const B &a, const B &b)
template<typename F, typename B>
static void | filter_equal_inplace (const F &f, const B &a, B &b)
template<typename F, typename B>
static F::result_type | filter_inplace (const F &f, B &b)
EXPORT_2D P2DImage | fuzzy_segment_2d (const C2DImage &src, size_t noOfClasses, const SFuzzySegParams &residuum, C2DImageVector &classes, P2DImage &gain)
| Run a fuzzy c-mean segmentation with gain field correction.
EXPORT_3D P3DImage | fuzzy_segment_3d (const C3DImage &src, size_t noOfClasses, float residuum, C3DImageVector &classes)
| Fuzzy c-means segmentation with gain field estimation.
P2DImage EXPORT_2D | run_filter (const C2DImage &image, const char *filter)
P3DImage EXPORT_3D | run_filter (const C3DImage &image, const char *filter)
| convenience function: create and run a filter on an image
PTriangleMesh EXPORT_MESH | run_filter (const CTriangleMesh &mesh, const char *filter)
P2DImage EXPORT_2D | run_filter (P2DImage image, const char *filter)
PTriangleMesh | run_filter (PTriangleMesh mesh, const char *filter)
P2DImage EXPORT_2D | run_filter_chain (P2DImage image, const std::vector< const char * > &filters)
P2DImage EXPORT_2D | run_filter_chain (P2DImage image, size_t nfilters, const char *filters[]) __attribute__((deprecated))
P3DImage EXPORT_3D | run_filter_chain (P3DImage image, const std::vector< const char * > &filters)
PTriangleMesh EXPORT_MESH | run_filter_chain (PTriangleMesh mesh, const std::vector< const char * > &filters)
template<typename PData, typename... Filters>
PData | run_filters (PData image, Filters... filters)
| run a chain of filters on an input image

## Detailed Description

These classes and functions are related to filtering and combining of 2D and 3D images.

## Typedef Documentation

## C2DFifoFilterPluginHandler

typedef THandlerSingleton<TFactoryPluginHandler<C2DFifoFilterPlugin> > C2DFifoFilterPluginHandler

Plugin handler for the FIFO filters.

Definition at line 165 of file 2dimagefifofilter.hh.

## C2DFilter

typedef TDataFilter<C2DImage> C2DFilter

2D image filter

Definition at line 36 of file 2d/filter.hh.

## C2DFilterPlugin

typedef TDataFilterPlugin<C2DImage> C2DFilterPlugin

2D image filter plugin

Definition at line 42 of file 2d/filter.hh.

## C2DFilterPluginHandler

typedef THandlerSingleton<TFactoryPluginHandler<C2DFilterPlugin> > C2DFilterPluginHandler

2D filter plugin handler

Definition at line 54 of file 2d/filter.hh.

## C2DImageCombiner

typedef TImageCombiner< C2DImage > C2DImageCombiner

2D Image combiner

A class to provides the base for operations that combine two images to create a new image

Definition at line 124 of file 2d/filter.hh.

## C2DImageFilterChain

typedef TFilterChain<C2DFilterPluginHandler> C2DImageFilterChain

2D filter chain to apply various filters in one run

Definition at line 73 of file 2d/filter.hh.

## C3DFilter

typedef TDataFilter<C3DImage> C3DFilter

Base class for 3D image filters. Filters are implemented as plug-ins.

Definition at line 43 of file 3d/filter.hh.

## C3DFilterPlugin

typedef TDataFilterPlugin<C3DImage> C3DFilterPlugin

The 3D filter plugin type.

Definition at line 49 of file 3d/filter.hh.

## C3DFilterPluginHandler

typedef THandlerSingleton<TFactoryPluginHandler<C3DFilterPlugin> > C3DFilterPluginHandler

The 3D filter plugin handler.

Definition at line 55 of file 3d/filter.hh.

## C3DImageCombiner

typedef TImageCombiner< C3DImage > C3DImageCombiner

Base class for plug-ins that combine two 3D images in certain ways.

This class is the base class for all combiners that are used to combine two 3D images. The result of the combination can be anything derived from CCombinerResult.

Definition at line 70 of file 3d/filter.hh.

## C3DImageFilterChain

typedef TFilterChain<C3DFilterPluginHandler> C3DImageFilterChain

3D filter chain to apply various filters in one run

Definition at line 119 of file 3d/filter.hh.

## CMeshFilterChain

typedef TFilterChain<CMeshFilterPluginHandler> CMeshFilterChain

2D filter chain to apply various filters in one run

Definition at line 71 of file mesh/filter.hh.

## CMeshFilterPlugin

typedef TDataFilterPlugin<CTriangleMesh> CMeshFilterPlugin

2D image filter plugin

Definition at line 40 of file mesh/filter.hh.

## CMeshFilterPluginHandler

typedef THandlerSingleton<TFactoryPluginHandler<CMeshFilterPlugin> > CMeshFilterPluginHandler

2D filter plugin handler

Definition at line 52 of file mesh/filter.hh.

## P2DFilter

typedef std::shared_ptr<C2DFilter > P2DFilter

shared pointer type for the C2DFilter class

Definition at line 48 of file 2d/filter.hh.

## P2DImageFifoFilter

typedef TFifoFilter<P2DImage>::Pointer P2DImageFifoFilter

Pointer type for the FIFO filter.

Definition at line 144 of file 2dimagefifofilter.hh.

## P3DFilter

typedef std::shared_ptr<C3DFilter> P3DFilter

The 3D filter shared pointer.

Definition at line 61 of file 3d/filter.hh.

## PMeshFilter

typedef std::shared_ptr<CMeshFilter > PMeshFilter

shared pointer type for the C2DFilter class

Definition at line 46 of file mesh/filter.hh.

## Function Documentation

## accumulate() [1/2]

template<typename F, typename A, typename B>

F::result_type accumulate | ( | F & | f,
|  | const A & | a,
|  | const B & | b )

static

*‍/

A accumulatro type that handles data containers of different types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. Input objects can be of different types

Parameters

  f | a filter to be applied to the data.
  a | input data to be filtered
  b | input data to be filtered

Returns
  whathever the filter f defines as return type and provides as a result of its operator ()

Definition at line 869 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## accumulate() [2/2]

template<typename F, typename B>

F::result_type accumulate | ( | F & | f,
|  | const B & | data )

static

A accumulator function that handles data containers of different types. The data container is provided by a pointer or reference to its type independen base class. Data type dependency is introduced by using a templated derivative. The accumulator object is not const and can be used to accumulate data.

Parameters

  f | a accumulator to be applied to the data.
  data | the input data to be filtered

Returns
  whathever the filter f defines as return type and provides as a result of its operator ()

Definition at line 371 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## create_filter_chain()

template<typename S>

std::vector< P3DFilter > create_filter_chain | ( | const std::vector< S > & | chain | ) |

Convenience function to create a filter chain from a series of filter descriptions.

Parameters

  chain | the descriptions

Returns
  the filter chain as a vector

Remarks
  obsolete, should use C3DImageFilterChain

Definition at line 94 of file 3d/filter.hh.

References cvdebug(), filter(), and THandlerSingleton< TFactoryPluginHandler< C3DFilterPlugin > >::instance().

## DEFINE_Image_Creator()

DEFINE_Image_Creator | ( | C3DImage |  | ) |

The 3D specialization of the TImageCreator template.

References NS_MIA_END.

## fborder()

bool fborder | ( | long | index,
|  | long | nx,
|  | long | ny,
|  | long | nz )

extern

function defining field borders

Parameters

  index | index running from 0 to NoOfPixels
  nx | no of pixels in x
  ny | no of pixels in y
  nz | no of pixels in z

## filter() [1/2]

template<typename F, typename A, typename B>

F::result_type filter | ( | const F & | f,
|  | const A & | a,
|  | const B & | b )

static

*‍/

A filter type that handles data containers of different types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. Input objects can be of different types

Parameters

  f | a filter to be applied to the data.
  a | input data to be filtered
  b | input data to be filtered

Returns
  whathever the filter f defines as return type and provides as a result of its operator ()

Definition at line 764 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## filter() [2/2]

template<typename F, typename B>

F::result_type filter | ( | const F & | f,
|  | const B & | b )

static

A filter type that handles data containers of different types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. The filter object is const.

Template Parameters

  a | Filter that must provide a type result_type, and an operator template < typename T > F::result_type F::operator()(const D<T>& b) const; with D<T> being a derived class of B
  b | the data to be processed in form of a reference to the base class of a class template D<T>

Parameters

  f | a filter to be applied to the data.
  b | the input data to be filtered

Returns
  whathever the filter F defines as return type and provides as a result of its operator ()

Definition at line 258 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

Referenced by C2DFifoFilterPlugin::call_test(), fifof_Fixture::call_test(), create_filter_chain(), FConvert2DImageToPixeltypeO< float >::operator()(), FConvert2DImageToPixeltypeO< float >::operator()(), FConvert3DImageToPixeltypeO< float >::operator()(), FConvert3DImageToPixeltypeO< float >::operator()(), TFilterChain< Handler >::push_back(), TFilterChain< C2DFilterPluginHandler >::push_back(), TFilterChain< Handler >::push_front(), TFilterChain< C2DFilterPluginHandler >::push_front(), run_filter(), run_filter(), run_filter(), run_filter(), and run_filter().

## filter_and_output()

template<typename F, typename B, typename O>

F::result_type filter_and_output | ( | const F & | f,
|  | const B & | a,
|  | O & | b )

static

A filter type that handles data containers of equal types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. Both input objects need to use the same data type

Parameters

  f | a filter to be applied to the data.
  a | input data to be filtered
  b | output of filtered data

Definition at line 647 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## filter_equal()

template<typename F, typename B>

F::result_type filter_equal | ( | const F & | f,
|  | const B & | a,
|  | const B & | b )

static

A filter type that handles data containers of different types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. Both input objects need to use the same data type

Parameters

  f | a filter to be applied to the data.
  a | input data to be filtered
  b | input data to be filtered

Returns
  whathever the filter f defines as return type and provides as a result of its operator ()

Definition at line 520 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## filter_equal_inplace()

template<typename F, typename B>

void filter_equal_inplace | ( | const F & | f,
|  | const B & | a,
|  | B & | b )

static

A filter type that handles data containers of equal types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. Both input objects need to use the same data type

Parameters

  f | a filter to be applied to the data.
  a | input data to be filtered
  b | output of filtered data

Definition at line 578 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## filter_inplace()

template<typename F, typename B>

F::result_type filter_inplace | ( | const F & | f,
|  | B & | b )

static

The in-place type of the function typename F::result_type filter(const F& f, const B& b). A filter type that handles data containers of different types. The data container is provided by a pointer or reference to its type independedn base class. Data type dependency is introduced by using a templated derivative. The filter object is const.

Parameters

  f | a filter to be applied to the data.
  b | the input data to be filtered

Returns
  whathever the filter f defines as return type and provides as a result of its operator ()

Definition at line 315 of file core/filter.hh.

References it_bit, it_double, it_float, it_sbyte, it_sint, it_slong, it_sshort, it_ubyte, it_uint, it_ulong, and it_ushort.

## fuzzy_segment_2d()

EXPORT_2D P2DImage fuzzy_segment_2d | ( | const C2DImage & | src,
|  | size_t | noOfClasses,
|  | const SFuzzySegParams & | residuum,
|  | C2DImageVector & | classes,
|  | P2DImage & | gain )

Run a fuzzy c-mean segmentation with gain field correction.

This function runs a fuzzy c-means segmentation with B-field correction in the input data set according to D.L. Pham and J.L.Prince, "An adaptive fuzzy C-means algorithm for image segmentation in the presence of intensity inhomogeneities", Pat. Rec. Let., 20:57-68,1999

Parameters

  [in] | src | the input image
  [in] | noOfClasses | number of segmentation classes
  [in] | residuum | limit for optimization
  [out] | classes | probability images after segmentation
  [out] | gain | multiplicative gain field

Returns
  the B-field corrected image

References EXPORT_2D, and NS_MIA_END.

## fuzzy_segment_3d()

EXPORT_3D P3DImage fuzzy_segment_3d | ( | const C3DImage & | src,
|  | size_t | noOfClasses,
|  | float | residuum,
|  | C3DImageVector & | classes )

Fuzzy c-means segmentation with gain field estimation.

This function runs a fuzzy c-means segmentation with B-field correction in the input data set.

Parameters

  [in] | src | the input image
  [in] | noOfClasses | number of segmentation classes
  [in] | residuum | limit for optimization
  [out] | classes | probability images after segmentation

Returns
  the B-field corrected image

References EXPORT_3D, and NS_MIA_END.

## run_filter() [1/5]

P2DImage EXPORT_2D run_filter | ( | const C2DImage & | image,
|  | const char * | filter )

convenience function: create and run a filter on an image

Parameters

  image | input image
  filter | string defining the filter to be applied

Returns
  the filtered image

References EXPORT_2D, and filter().

Referenced by run_filter().

## run_filter() [2/5]

P3DImage EXPORT_3D run_filter | ( | const C3DImage & | image,
|  | const char * | filter )

convenience function: create and run a filter on an image

Parameters

  image | input image
  filter | string defining the filter to be applied

Returns
  the filtered image

References EXPORT_3D, and filter().

## run_filter() [3/5]

PTriangleMesh EXPORT_MESH run_filter | ( | const CTriangleMesh & | mesh,
|  | const char * | filter )

convenience function: create and run a filter on an mesh

Parameters

  mesh | input mesh
  filter | string defining the filter to be applied

Returns
  the filtered mesh

References EXPORT_MESH, and filter().

Referenced by run_filter().

## run_filter() [4/5]

P2DImage EXPORT_2D run_filter | ( | P2DImage | image,
|  | const char * | filter )

inline

convenience function: create and run a filter on an image

Parameters

  image | input image
  filter | string defining the filter to be applied

Returns
  the filtered image

Definition at line 112 of file 2d/filter.hh.

References EXPORT_2D, filter(), and run_filter().

## run_filter() [5/5]

PTriangleMesh run_filter | ( | PTriangleMesh | mesh,
|  | const char * | filter )

inline

convenience function: create and run a filter on an mesh

Parameters

  mesh | input mesh
  filter | string defining the filter to be applied

Returns
  the filtered mesh

Definition at line 98 of file mesh/filter.hh.

References filter(), and run_filter().

## run_filter_chain() [1/4]

P2DImage EXPORT_2D run_filter_chain | ( | P2DImage | image,
|  | const std::vector< const char * > & | filters )

convenience function: run a filter chain on an image

Parameters

  image | input image
  filters | vector of strings defining the filter to be applied

Returns
  the filtered image

References EXPORT_2D.

## run_filter_chain() [2/4]

P2DImage EXPORT_2D run_filter_chain | ( | P2DImage | image,
|  | size_t | nfilters,
|  | const char * | filters[] )

convenience function: run a filter chain on an image

Parameters

  image | input image
  nfilters | number of filter definitions following
  filters | array of strings defining the filter to be applied

Returns
  the filtered image

References EXPORT_2D.

## run_filter_chain() [3/4]

P3DImage EXPORT_3D run_filter_chain | ( | P3DImage | image,
|  | const std::vector< const char * > & | filters )

convenience function: run a filter chain on an image

Parameters

  image | input image
  filters | vector of strings defining the filter to be applied

Returns
  the filtered image

References EXPORT_3D, and NS_MIA_END.

## run_filter_chain() [4/4]

PTriangleMesh EXPORT_MESH run_filter_chain | ( | PTriangleMesh | mesh,
|  | const std::vector< const char * > & | filters )

convenience function: run a filter chain on an mesh

Parameters

  mesh | input mesh
  filters | vector of strings defining the filter to be applied

Returns
  the filtered mesh

References EXPORT_MESH.

## run_filters()

template<typename PData, typename... Filters>

PData run_filters | ( | PData | image,
|  | Filters... | filters )

run a chain of filters on an input image

This template is used to run a chain of filters on an input image The filters can be described by strings, or given as already created filters

Template Parameters

  PData | the image pointer type of the image to be filtered
  Filters | the filter description types or filters

Definition at line 135 of file filter_chain.hh.