This class is for one level of the multigrid framework. More...
#include <ofMultiGridLevel.h>
Public Member Functions | |
| MultiGridLevel (size_t dimensions, i3d::Vector3d< float >spacing, i3d::Vector3d< size_t > size, size_t levelIndex, bool linearData=static_cast< bool >(true), bool linearSmooth=static_cast< bool >(true)) | |
| ~MultiGridLevel () | |
| i3d::Image3d< VOXEL > * | GetRightHandSide (size_t i) |
| VOXEL | GetRightHandSide (size_t rhsIndex, size_t itemIndex) |
| i3d::Image3d< VOXEL > * | GetRightHandSideBackup (size_t i) |
| void | SaveRightHandSide (char *FName, size_t ind) |
| i3d::Image3d< VOXEL > * | GetTemp (size_t i) |
| size_t | GetTotalSize () |
| i3d::Image3d< VOXEL > * | GetSolution (size_t i) |
| i3d::Image3d< VOXEL > * | GetSolutionBackup (size_t i) |
| size_t | GetLevelIndex () |
| SparseMatrixDiagStorage< VOXEL > * | GetMatrix (size_t i, size_t j) |
| void | SetSolution (size_t SolIndex, size_t ItemIndex, VOXEL Value) |
| VOXEL | GetSolution (size_t SolIndex, size_t ItemIndex) |
| i3d::Image3d< VOXEL > * | GetInverseMatrix (size_t i, size_t j) |
| i3d::Image3d< VOXEL > * | GetAdditionalSpace (size_t i) |
| void | SetAdditionalSpace (size_t i, i3d::Image3d< VOXEL > *img) |
| void | AllocateAdditionalSpace (size_t count, size_t m=std::numeric_limits< size_t >::max()) |
| void | SetTensorBackup (MotionTensor< VOXEL > *mt) |
| MotionTensor< VOXEL > * | GetTensorBackup () |
| void | SetVisited (bool v) |
| bool | GetVisited () |
| void | SetMatrixComputed (bool mc) |
| bool | GetMatrixComputed () |
| i3d::Vector3d< float > & | GetSpacing () |
| i3d::Vector3d< size_t > & | GetSize () |
| size_t | GetDimensions () |
| std::valarray< i3d::Image3d < VOXEL > * > & | GetResults () |
| i3d::Image3d< VOXEL > * | GetResults (size_t axe) |
| void | SetResults (i3d::Image3d< VOXEL > *w, size_t axe) |
| bool | GetLinear () |
Private Attributes | |
| std::valarray< i3d::Image3d < VOXEL > * > | m_solution |
| std::valarray< i3d::Image3d < VOXEL > * > | m_solutionBackup |
| std::valarray< i3d::Image3d < VOXEL > * > | m_rightHandSide |
| std::valarray< i3d::Image3d < VOXEL > * > | m_rightHandSideBackup |
| std::valarray< i3d::Image3d < VOXEL > * > | m_temp |
| std::valarray < SparseMatrixDiagStorage < VOXEL > * > | m_matrices |
| std::valarray< i3d::Image3d < VOXEL > * > | m_additionalSpace |
| MotionTensor< VOXEL > * | m_tensorBackup |
| size_t | m_dimensions |
| i3d::Vector3d< float > | m_spacing |
| i3d::Vector3d< size_t > | m_size |
| size_t | m_totalSize |
| size_t | m_levelIndex |
| size_t | m_numberOfMatrices |
| bool | m_linearData |
| bool | m_linearSmooth |
| bool | m_visited |
| bool | m_matrixComputed |
This class is for one level of the multigrid framework.
It contain all necessary data and methods to handle them.
The implementation of this class is based on PhD. thesis
A. Bruhn Variational Optic Flow Computation: Accurate Modelling and Efficient Numerics Department of Mathematics and Computer Science, Universitaet des Saarlandes, Saarbruecken, July 2006
| MultiGridLevel< VOXEL >::MultiGridLevel | ( | size_t | dimensions, | |
| i3d::Vector3d< float > | spacing, | |||
| i3d::Vector3d< size_t > | size, | |||
| size_t | levelIndex, | |||
| bool | linearData = static_cast <bool> (true), |
|||
| bool | linearSmooth = static_cast <bool> (true) | |||
| ) |
Constructor.
| [in] | dimensions | Dimension of the underlying image (2 or 3) |
| [in] | spacing | Spacing of the voxels in the underlying image sequence |
| [in] | size | Size of the underlying images |
| [in] | levelIndex | Level index of the level in the multigrid framework. The greater the number is the coarser the level is. Zero is for the finest level. |
| [in] | linearData | True if the data term is linear (default value). False if the data term is nonlinear. |
| [in] | linearSmooth | True if the smoothing term is linear (default value). False if the data term is nonlinear. |
| MultiGridLevel< VOXEL >::~MultiGridLevel | ( | ) |
Destructor The member data structures are deleted in the destructor.
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetRightHandSide | ( | size_t | i | ) | [inline] |
Returns pointer to the right hand side of the linear (or nonlinear) system.
In fact, it return the x,y or z component of the right-hand side vector.
| [in] | i | which component should be returned. [0 - x, 1 - y, 2 - z]. |
| VOXEL MultiGridLevel< VOXEL >::GetRightHandSide | ( | size_t | rhsIndex, | |
| size_t | itemIndex | |||
| ) | [inline] |
Get the value of the particular item in the right hand side vector.
| [in] | rhsIndex | index of the right hand side vector [0 - x, 1 - y, 2 - z]. |
| [in] | itemIndex | index of the item in the solution vector. [0 - number of unknowns]. |
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetRightHandSideBackup | ( | size_t | i | ) | [inline] |
Returns pointer to the backup of the right hand side of the nonlinear system.
The backup is needed in the nonlinear optic flow multigrid computations, which are more complex than linear computations. In fact, it return the x,y or z component of the right-hand side vector.
| [in] | i | which component should be returned. [0 - x, 1 - y, 2 - z]. |
| void MultiGridLevel< VOXEL >::SaveRightHandSide | ( | char * | FName, | |
| size_t | ind | |||
| ) |
Save the ith-component of the right hand side of the linear or nonlinear system.
This routine serves mainly for debuging purposes. It has no sense in the production enviroment.
| [in] | FName | Full name of the image file. The indth-component is saved to the image file. |
| [in] | ind | which component should be saved. [0 - x, 1 - y, 2 - z] |
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetTemp | ( | size_t | i | ) | [inline] |
Get the temporal space.
The temporal space is used for restriction, prolongation and residual computations. The results of this computations are saved in this data structure.
| [in] | i | Index of the temporal space which should be returned. [0 - x, 1 - y, 2 - z] |
| size_t MultiGridLevel< VOXEL >::GetTotalSize | ( | ) | [inline] |
Get the total size (in voxels) of the underlying images.
It is also the number of unknowns in the underlying linear or nonlinear system.
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetSolution | ( | size_t | i | ) | [inline] |
Returns pointer to the actual solution of the linear (or nonlinear) system at this level.
In fact, it return the x,y or z component of the actual solution vector.
| [in] | i | which component should be returned. [0 - x, 1 - y, 2 - z]. |
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetSolutionBackup | ( | size_t | i | ) | [inline] |
Returns pointer to the actual solution backup of the nonlinear system at this level.
The backup of the solution is neede in the nonlinear case which is more complex to solve. In fact, it return the x,y or z component of the actual backup solution vector.
| [in] | i | which component should be returned. [0 - x, 1 - y, 2 - z]. |
| size_t MultiGridLevel< VOXEL >::GetLevelIndex | ( | ) | [inline] |
Get the index of this level.
The levels in the multigrid frameword are identified by the level index.
| SparseMatrixDiagStorage<VOXEL>* MultiGridLevel< VOXEL >::GetMatrix | ( | size_t | i, | |
| size_t | j | |||
| ) | [inline] |
Get the (i,j) submatrix of the matrix of the [non]linear system.
The matrix is composed of 2x2 sobmatrices in 2D and 3x3 in 3D.
| [in] | i | index of the row of the submatrix. |
| [in] | j | index of the column of the submatrix. |
| void MultiGridLevel< VOXEL >::SetSolution | ( | size_t | SolIndex, | |
| size_t | ItemIndex, | |||
| VOXEL | Value | |||
| ) | [inline] |
Set the value of the solution in the solution vector.
| [in] | SolIndex | index of the solution vector [0 - x, 1 - y, 2 - z]. |
| [in] | ItemIndex | index of the item in the solution vector. [0 - number of unknowns]. |
| [in] | Value | the value which should be saved in the solution vector. |
| VOXEL MultiGridLevel< VOXEL >::GetSolution | ( | size_t | SolIndex, | |
| size_t | ItemIndex | |||
| ) | [inline] |
Get the value of the solution in the solution vector.
| [in] | SolIndex | index of the solution vector [0 - x, 1 - y, 2 - z]. |
| [in] | ItemIndex | index of the item in the solution vector. [0 - number of unknowns]. |
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetInverseMatrix | ( | size_t | i, | |
| size_t | j | |||
| ) | [inline] |
Get the (i,j) submatrix of the inversed matrix of the [non]linear system.
The inversed matrix is computed only in the linear case. The matrix is composed of 2x2 sobmatrices in 2D and 3x3 in 3D.
| [in] | i | index of the row of the submatrix. |
| [in] | j | index of the column of the submatrix. |
| i3d::Image3d<VOXEL>* MultiGridLevel< VOXEL >::GetAdditionalSpace | ( | size_t | i | ) | [inline] |
Returns the pointer to i3d::Image3d which serves as an additional space.
The additional space is neede in the warping cases of the variational optic flow methods. The additional space has the size of the number of unknowns.
| [in] | i | Index of the additional space. |
| void MultiGridLevel< VOXEL >::SetAdditionalSpace | ( | size_t | i, | |
| i3d::Image3d< VOXEL > * | img | |||
| ) |
Set the pointer of the i3d::Image3d which serves as an additional space.
The additional space is neede in the warping cases of the variational optic flow methods. The additional space has the size of the number of unknowns.
| [in] | i | Index of the additional space. |
| [in] | img | Pointer to the i3d::Image3d which should be saved in the additional space array. |
| void MultiGridLevel< VOXEL >::AllocateAdditionalSpace | ( | size_t | count, | |
| size_t | m = std::numeric_limits<size_t>::max() | |||
| ) |
Allocate the needed additional space.
Unified methods which allocates the additional space for the warping variants of the variational optical flow methods.
| [in] | count | The number of additional images where can be something saved. |
| [in] | m | the index of the additional image. Images with index smaller than this number are fully allocated. The pointers for the images with index greater or equal to this number are only allocated and initialized to NULL. |
| void MultiGridLevel< VOXEL >::SetTensorBackup | ( | MotionTensor< VOXEL > * | mt | ) |
Set the pointer to the backup of the motion tensor.
The backup of the motion tensor is neeed in the fully nonlinear optical flow methods (the data and smoothing term is nonlinear).
| [in] | mt | Pointer to the motion tensor. |
| MotionTensor< VOXEL > * MultiGridLevel< VOXEL >::GetTensorBackup | ( | ) |
Get the pointer to the motion tensor backup.
The backup of the motion tensor is neeed in the fully nonlinear optical flow methods (the data and smoothing term is nonlinear).
| void MultiGridLevel< VOXEL >::SetVisited | ( | bool | v | ) |
Set whether this level was already visited by the multigrid computation framework.
| [in] | v | True if this level was visited. False if the levels was not visited. |
| bool MultiGridLevel< VOXEL >::GetVisited | ( | ) |
Get whether this level was already visited by the multigrid computation framework.
| void MultiGridLevel< VOXEL >::SetMatrixComputed | ( | bool | mc | ) |
Set whether the matrix which belong to this level was already computed.
| [in] | mc | True if the matrix was already computed. False otherwise. |
| bool MultiGridLevel< VOXEL >::GetMatrixComputed | ( | ) |
Get whether the matrix which belongs to this level was already computed.
| i3d::Vector3d<float>& MultiGridLevel< VOXEL >::GetSpacing | ( | ) | [inline] |
Get the spacing of the images at this level.
| i3d::Vector3d<size_t>& MultiGridLevel< VOXEL >::GetSize | ( | ) | [inline] |
Get the size of the images and unknown arrays, etc.
at this level.
| size_t MultiGridLevel< VOXEL >::GetDimensions | ( | ) | [inline] |
Get the number of dimensions of the underlying image sequence.
| std::valarray< i3d::Image3d <VOXEL> *>& MultiGridLevel< VOXEL >::GetResults | ( | ) | [inline] |
Get the valarray with the computation results at this level.
| Image3d< VOXEL > * MultiGridLevel< VOXEL >::GetResults | ( | size_t | axe | ) |
Get the x,y or z component with the computation results at this level.
| [in] | axe | Index of the component which should be returned. [0 - x, 1 - y, 2 - z]. |
| void MultiGridLevel< VOXEL >::SetResults | ( | i3d::Image3d< VOXEL > * | w, | |
| size_t | axe | |||
| ) |
Set the x,y or z component with the computation results at this level.
| [in] | w | Pointer to the i3d::Image3d with the solution. |
| [in] | axe | Onto whic axe should be the solution altered with the new one. [0 -x, 1 - y, 2 - z]. |
| bool MultiGridLevel< VOXEL >::GetLinear | ( | ) | [inline] |
Get whether this level is level of linear multigrid or level of nonlinear multigrid.
std::valarray< i3d::Image3d <VOXEL> *> MultiGridLevel< VOXEL >::m_solution [private] |
std::valarray with the pointers to the vectors of the solution
std::valarray< i3d::Image3d <VOXEL> *> MultiGridLevel< VOXEL >::m_solutionBackup [private] |
std::valarray with the pointers to the vectors of the solution backup
std::valarray< i3d::Image3d <VOXEL> *> MultiGridLevel< VOXEL >::m_rightHandSide [private] |
std::valarray with the pointers to the vectors with the right hand side
std::valarray< i3d::Image3d <VOXEL> *> MultiGridLevel< VOXEL >::m_rightHandSideBackup [private] |
std::valarray with the pointers to the vectors with the right hand side backup
std::valarray< i3d::Image3d <VOXEL> *> MultiGridLevel< VOXEL >::m_temp [private] |
std::valarray with pointers to the temporal space which is used in the restriction, prolongation and residual computations
std::valarray< SparseMatrixDiagStorage <VOXEL> *> MultiGridLevel< VOXEL >::m_matrices [private] |
std::valarray with pointers to the submatrices
std::valarray< i3d::Image3d <VOXEL> *> MultiGridLevel< VOXEL >::m_additionalSpace [private] |
std::valarray with the pointers to the additional space
MotionTensor<VOXEL>* MultiGridLevel< VOXEL >::m_tensorBackup [private] |
pointer to the motion tensor backup.
size_t MultiGridLevel< VOXEL >::m_dimensions [private] |
number of the dimensions of the solved problem (2 or 3).
i3d::Vector3d<float> MultiGridLevel< VOXEL >::m_spacing [private] |
spacing of the underlying images (tensors unknown arrays, ...).
i3d::Vector3d<size_t> MultiGridLevel< VOXEL >::m_size [private] |
size of the images.
size_t MultiGridLevel< VOXEL >::m_totalSize [private] |
the total number of unknowns (voxels) at this level.
size_t MultiGridLevel< VOXEL >::m_levelIndex [private] |
The index of this level at the multigrid framework.
size_t MultiGridLevel< VOXEL >::m_numberOfMatrices [private] |
Number of matrices (3 for 2D, 6 for 3D).
bool MultiGridLevel< VOXEL >::m_linearData [private] |
Is the data term linear (true) or not (false).
bool MultiGridLevel< VOXEL >::m_linearSmooth [private] |
Is the smoothing term linear (true) or not (false).
bool MultiGridLevel< VOXEL >::m_visited [private] |
Was this level already visited by the multigrid computation framework?
bool MultiGridLevel< VOXEL >::m_matrixComputed [private] |
Was the matrix already computed at this level?
1.7.1