Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
|
Adjacency relation and forward iteratior related to a matrix. More...
#include <Adjacency.hpp>
Public Member Functions | |
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... | |
Protected Attributes | |
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... | |
Adjacency relation and forward iteratior related to a matrix.
Definition at line 27 of file Adjacency.hpp.
Bial::Adjacency::Adjacency | ( | ) |
Basic Constructor.
none |
Bial::Adjacency::Adjacency | ( | size_t | dims, |
size_t | size | ||
) |
Basic Constructor.
dims | number of dimensions of the adjacency relation. Should be greater or equal to the image that will operate on. |
size | number of elements of the adjacency relation. |
Bial::Adjacency::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.
src_displacement | source displacement of the adjacency. |
tgt_displacement | target displacement of the adjacency. |
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.
mat | A matrix. |
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.
img | An image. |
Vector< size_t > Bial::Adjacency::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.
dim | Dimensions of the space where the element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement dimensions. |
size_t Bial::Adjacency::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.
dim | Dimensions of the space where the element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement dimensions. |
Vector< size_t > Bial::Adjacency::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.
mat | The matrix where the adjacent element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement matrix. |
size_t Bial::Adjacency::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.
mat | The matrix where the adjacent element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement matrix. |
Vector< size_t > Bial::Adjacency::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.
img | The image where the adjacent element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement image. |
size_t Bial::Adjacency::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.
img | The image where the adjacent element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement image. |
Vector< size_t > Bial::Adjacency::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.
dim | Dimensions of the space where the element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement dimensions. |
size_t Bial::Adjacency::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.
dim | Dimensions of the space where the element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement dimensions. |
Vector< size_t > Bial::Adjacency::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.
mat | The matrix where the adjacent element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement matrix. |
size_t Bial::Adjacency::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.
mat | The matrix where the adjacent element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement matrix. |
Vector< size_t > Bial::Adjacency::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.
img | The image where the adjacent element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement image. |
size_t Bial::Adjacency::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.
img | The image where the adjacent element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement image. |
size_t Bial::Adjacency::Dims | ( | ) | const |
Returns the number of dimensions of the adjacency relation.
none. |
float Bial::Adjacency::Displacement | ( | size_t | elem, |
size_t | dim | ||
) | const |
Returns the displacement in dimention dim for adjacent elem.
elem | Adjacency element index. |
dim | Displacement dimension. |
float Bial::Adjacency::operator() | ( | size_t | elem, |
size_t | dim | ||
) | const |
float& Bial::Adjacency::operator() | ( | size_t | elem, |
size_t | dim | ||
) |
Vector< size_t > Bial::Adjacency::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.
dim | Dimensions of the space domain where the adjacent element should be found. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement dimensions. |
size_t Bial::Adjacency::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.
dim | Dimensions of the space where the element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement dimensions. |
Vector< size_t > Bial::Adjacency::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.
mat | The matrix where the adjacent element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement matrix. |
size_t Bial::Adjacency::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.
mat | The matrix where the adjacent element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement matrix. |
Vector< size_t > Bial::Adjacency::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.
img | The image where the adjacent element should be defined. |
index | The indexes of the source element. |
adj_index | Adjacency relation index in the displacement image. |
size_t Bial::Adjacency::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.
mat | The image where the adjacent element should be defined. |
position | The global position of the source element. |
adj_index | Adjacency relation index in the displacement image. |
O& Bial::Adjacency::Print | ( | O & | os | ) | const |
Prints adjacency to output stream os.
os | an output stream. |
O& Bial::Adjacency::PrintDimensions | ( | O & | os | ) | const |
Prints adjacency relation dimensions to output stream os.
os | an output stream. |
size_t Bial::Adjacency::Size | ( | ) | const |
Returns the number of elements of the adjacency relation.
none. |
size_t Bial::Adjacency::size | ( | ) | const |
Same as Size( ). Just for coherence with Image.size( ).
none. |
Vector< size_t > Bial::Adjacency::SortByDistance | ( | bool | increasing_order = true | ) |
Sort adjacency elements in increasing (or decreasing) order with respect to the distance from t reference element.
increasing_order | true for sorting in reverse mode. |
|
protected |
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)
Definition at line 37 of file Adjacency.hpp.