Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
Bial::Kernel Class Reference

Kernel and forward iteratior related to a matrix. More...

#include <Kernel.hpp>

Inheritance diagram for Bial::Kernel:
Inheritance graph
Collaboration diagram for Bial::Kernel:
Collaboration graph

Public Member Functions

 Kernel ()
 Basic Constructor. More...
 
 Kernel (const Adjacency &adj)
 Basic Constructor. More...
 
 Kernel (size_t dims, size_t size)
 Basic Constructor. More...
 
template<class D >
 Kernel (const Matrix< D > &mat)
 Basic Constructor. Build a kernel based on a matrix. Non-zero elements are set as adjacents and coefficients are matrix values. Kernel centralized in dim / 2. More...
 
template<class D >
 Kernel (const Image< D > &img)
 Basic Constructor. Build a kernel based on a image spatial dimensions. Non-zero elements are set as adjacents and coefficients are image values. Kernel centralized in dim / 2. More...
 
template<class D >
KernelIterator begin (const Matrix< D > &mtx, size_t pixel_index) const
 returns an iterator to first valid adjacent element. More...
 
template<class D >
KernelIterator end (const Matrix< D > &mtx, size_t pixel_index) const
 Returns an iterator to position after the end of elements. More...
 
template<class D >
KernelIterator begin (const Image< D > &img, size_t pixel_index) const
 returns an iterator to first valid adjacent element. More...
 
template<class D >
KernelIterator end (const Image< D > &img, size_t pixel_index) const
 Returns an iterator to position after the end of elements. More...
 
void Normalize ()
 Normalizes the sum of the indexes of this kernel. More...
 
Kernel Normalize () const
 Returns a normalized kernel of this kernel. More...
 
void SignalNormalize ()
 Normalizes positive and negative coefficients of this kernel separately. More...
 
Kernel SignalNormalize () const
 Returns a kernel with positive and negative coefficients normalized separately. More...
 
float Value (size_t idx) const
 Returns the coefficient value of index idx. More...
 
void Value (size_t idx, float value)
 Assigns value to the coefficient of index idx. More...
 
template<class O >
O & PrintDimensions (O &os) const
 Prints kernel dimensions to output stream os. More...
 
template<class O >
O & Print (O &os) const
 Prints kernel to output stream os. More...
 
- Public Member Functions inherited from Bial::Adjacency
 Adjacency ()
 Basic Constructor. More...
 
 Adjacency (size_t dims, size_t size)
 Basic Constructor. More...
 
 Adjacency (const Vector< size_t > &src_displacement, const Vector< size_t > &tgt_displacement)
 Basic Constructor. Build a n-dimensional box from src_displacement to tgt_displacement. More...
 
template<class D >
 Adjacency (const Matrix< D > &mat)
 Basic Constructor. Build an adjacency based on a matrix. Non-zero elements are set as adjacents a coefficients are matrix values. Adjacency centralized in dim / 2. More...
 
template<class D >
 Adjacency (const Image< D > &img)
 Basic Constructor. Build an adjacency based on an image. Non-zero elements are set as adjacents a coefficients are image values. Adjacency centralized in dim / 2. More...
 
 Adjacency (const Image< Color > &img)
 
float operator() (size_t elem, size_t dim) const
 Returns data pointed by index ( elem, dim ). More...
 
float & operator() (size_t elem, size_t dim)
 Returns the reference for data pointed by index ( elem, dim ). More...
 
Vector< size_t > operator() (const Vector< size_t > &dim, const Vector< size_t > &index, size_t adj_index) const
 Returns a vector containing the indexes of the adjacent element to the given source element in spa domain. If the adjacent element is out of the space bounds it returns a copy of dim vector. More...
 
size_t operator() (const Vector< size_t > &dim, size_t position, size_t adj_index) const
 Returns the global index of the element in space 'dim' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the space bounds, than matrix size is returned. More...
 
template<class D >
Vector< size_t > operator() (const Matrix< D > &mat, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the indexes of the element in matrix 'mat' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the matrix bounds, than NULL is returned. More...
 
template<class D >
size_t operator() (const Matrix< D > &mat, size_t position, size_t adj_index) const
 Returns the global index of the element in matrix 'mat' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the matrix bounds, than matrix size is returned. More...
 
template<class D >
Vector< size_t > operator() (const Image< D > &img, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the indexes of the element in image 'img' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the image bounds, than NULL is returned. More...
 
template<class D >
size_t operator() (const Image< D > &img, size_t position, size_t adj_index) const
 Returns the global index of the element in image 'img' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the image bounds, than image size is returned. More...
 
Vector< size_t > SortByDistance (bool increasing_order=true)
 Sort adjacency elements in increasing (or decreasing) order with respect to the distance from t reference element. More...
 
float Displacement (size_t elem, size_t dim) const
 Returns the displacement in dimention dim for adjacent elem. More...
 
size_t Dims () const
 Returns the number of dimensions of the adjacency relation. More...
 
size_t Size () const
 Returns the number of elements of the adjacency relation. More...
 
size_t size () const
 Same as Size( ). Just for coherence with Image.size( ). More...
 
Vector< size_t > Adj2 (const Vector< size_t > &dim, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the first two indexes of the element in space 'dim' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the space bounds, than NULL is returned. More...
 
size_t Adj2 (const Vector< size_t > &dim, size_t position, size_t adj_index) const
 Returns the global index of the element in space 'dim' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the space bounds, than matrix size is returned. More...
 
template<class D >
Vector< size_t > Adj2 (const Matrix< D > &mat, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the first two indexes of the element in matrix 'mat' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the matrix bounds, than NULL is returned. More...
 
template<class D >
size_t Adj2 (const Matrix< D > &mat, size_t position, size_t adj_index) const
 Returns the global index of the element in matrix 'mat' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the matrix bounds, than matrix size is returned. More...
 
template<class D >
Vector< size_t > Adj2 (const Image< D > &img, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the first two indexes of the element in image 'img' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the image bounds, than NULL is returned. More...
 
template<class D >
size_t Adj2 (const Image< D > &img, size_t position, size_t adj_index) const
 Returns the global index of the element in image 'img' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the image bounds, than image size is returned. More...
 
Vector< size_t > Adj3 (const Vector< size_t > &dim, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the first three indexes of the element in space 'dim' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the space bounds, than NULL is returned. More...
 
size_t Adj3 (const Vector< size_t > &dim, size_t position, size_t adj_index) const
 Returns the global index of the element in space 'dim' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the space bounds, than matrix size is returned. More...
 
template<class D >
Vector< size_t > Adj3 (const Matrix< D > &mat, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the first three indexes of the element in matrix 'mat' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the matrix bounds, than NULL is returned. More...
 
template<class D >
size_t Adj3 (const Matrix< D > &mat, size_t position, size_t adj_index) const
 Returns the global index of the element in matrix 'mat' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the matrix bounds, than matrix size is returned. More...
 
template<class D >
Vector< size_t > Adj3 (const Image< D > &img, const Vector< size_t > &index, size_t adj_index) const
 Returns a Vector containing the first three indexes of the element in image 'img' that is adjacent to element of indexes 'index' with respect to index 'adj_index'. If the adjacent element is out of the image bounds, than NULL is returned. More...
 
template<class D >
size_t Adj3 (const Image< D > &img, size_t position, size_t adj_index) const
 Returns the global index of the element in image 'img' that is adjacent to element 'position' with respect to index 'adj_index'. If the adjacent element is out of the image bounds, than image size is returned. More...
 
template<class O >
O & PrintDimensions (O &os) const
 Prints adjacency relation dimensions to output stream os. More...
 
template<class O >
O & Print (O &os) const
 Prints adjacency to output stream os. More...
 

Additional Inherited Members

- Protected Attributes inherited from Bial::Adjacency
Matrix< float > relation
 2D matrix. First dimension refers to the number of dimensions of adjacency relation and the second dimension refers to the size of the adjacency relation, that is, the number of elements in it. Example: relation(dims, size) More...
 

Detailed Description

Kernel and forward iteratior related to a matrix.

Definition at line 24 of file Kernel.hpp.

Constructor & Destructor Documentation

Bial::Kernel::Kernel ( )

Basic Constructor.

Date
2013/Nov/19
Parameters
none
Returns
none.
Warning
Uninitialized kernel is created.
Bial::Kernel::Kernel ( const Adjacency adj)

Basic Constructor.

Date
2013/Nov/19
Parameters
none
Returns
none.
Warning
Uninitialized kernel is created.
Bial::Kernel::Kernel ( size_t  dims,
size_t  size 
)

Basic Constructor.

Date
2013/Nov/19
Parameters
dimsnumber of dimensions of the kernel. Should be greater or equal to the image that it will operate on.
sizenumber of elements of the kernel.
Returns
none.
Warning
Uninitialized kernel is created.
template<class D >
Bial::Kernel::Kernel ( const Matrix< D > &  mat)

Basic Constructor. Build a kernel based on a matrix. Non-zero elements are set as adjacents and coefficients are matrix values. Kernel centralized in dim / 2.

Date
2013/Nov/19
Parameters
matA matrix.
Returns
none.
Warning
Uninitialized kernel is created.
template<class D >
Bial::Kernel::Kernel ( const Image< D > &  img)

Basic Constructor. Build a kernel based on a image spatial dimensions. Non-zero elements are set as adjacents and coefficients are image values. Kernel centralized in dim / 2.

Date
2014/Apr/18
Parameters
imgAn image.
Returns
none.
Warning
Uninitialized kernel is created.

Member Function Documentation

template<class D >
KernelIterator Bial::Kernel::begin ( const Matrix< D > &  mtx,
size_t  pixel_index 
) const

returns an iterator to first valid adjacent element.

Date
2012/Sep/24
Parameters
mtxA matrix for adjacency relation iteration.
pixel_indexThe pixel whose adjacency will be iterated.
Returns
Iterator to first valid adjacent element.
Warning
none.
template<class D >
KernelIterator Bial::Kernel::begin ( const Image< D > &  img,
size_t  pixel_index 
) const

returns an iterator to first valid adjacent element.

Date
2014/Apr/18
Parameters
imgAn image for adjacency relation iteration.
pixel_indexThe pixel whose adjacency will be iterated.
Returns
Iterator to first valid adjacent element.
Warning
none.
template<class D >
KernelIterator Bial::Kernel::end ( const Matrix< D > &  mtx,
size_t  pixel_index 
) const

Returns an iterator to position after the end of elements.

Date
2012/Sep/24
Parameters
mtxA matrix for adjacency relation iteration.
pixel_indexThe pixel whose adjacency will be iterated.
Returns
Iterator to position after the end of elements.
Warning
none.
template<class D >
KernelIterator Bial::Kernel::end ( const Image< D > &  img,
size_t  pixel_index 
) const

Returns an iterator to position after the end of elements.

Date
2014/Apr/18
Parameters
imgAn image for adjacency relation iteration.
pixel_indexThe pixel whose adjacency will be iterated.
Returns
Iterator to position after the end of elements.
Warning
none.
void Bial::Kernel::Normalize ( )

Normalizes the sum of the indexes of this kernel.

Date
2013/Nov/22
Parameters
none.
Returns
none.
Warning
none.
Kernel Bial::Kernel::Normalize ( ) const

Returns a normalized kernel of this kernel.

Date
2013/Nov/22
Parameters
none.
Returns
Normalized a kernel.
Warning
none.
template<class O >
O& Bial::Kernel::Print ( O &  os) const

Prints kernel to output stream os.

Date
2015/Mar/26
Parameters
osan output stream.
Returns
The output stream.
Warning
none.
template<class O >
O& Bial::Kernel::PrintDimensions ( O &  os) const

Prints kernel dimensions to output stream os.

Date
2013/Nov/19
Parameters
osan output stream.
Returns
os output stream.
Warning
none.
void Bial::Kernel::SignalNormalize ( )

Normalizes positive and negative coefficients of this kernel separately.

Date
2013/Nov/22
Parameters
none.
Returns
none.
Warning
none.
Kernel Bial::Kernel::SignalNormalize ( ) const

Returns a kernel with positive and negative coefficients normalized separately.

Date
2013/Nov/22
Parameters
none.
Returns
Signal normalized a kernel.
Warning
none.
float Bial::Kernel::Value ( size_t  idx) const

Returns the coefficient value of index idx.

Date
2013/Nov/19
Parameters
idxKernel element index.
Returns
The Coefficient value of index idx.
Warning
idx is not verified for adjacency bounds.
void Bial::Kernel::Value ( size_t  idx,
float  value 
)

Assigns value to the coefficient of index idx.

Date
2013/Nov/19
Parameters
idxKernel element index.
valueCoefficient value.
Returns
none.
Warning
idx is not verified for adjacency bounds.

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