|
OpenWalnut 1.3.1
|
A grid that has parallelepiped cells which all have the same proportion. More...
#include <WGridRegular3D.h>
Inheritance diagram for WGridRegular3DTemplate< T >:Public Types | |
| typedef WMatrixFixed< T, 3, 1 > | Vector3Type |
| Convenience typedef for 3d vectors of the appropriate numerical type. | |
| typedef boost::shared_ptr < WGridRegular3DTemplate > | SPtr |
| Convenience typedef for a boost::shared_ptr< WGridRegular3DTemplate >. | |
| typedef boost::shared_ptr < const WGridRegular3DTemplate > | ConstSPtr |
| Convenience typedef for a boost::shared_ptr< const WGridRegular3DTemplate >. | |
| typedef boost::array< size_t, 8 > | CellVertexArray |
| Convenience typedef for a boost::array< size_t, 8 >. | |
Public Member Functions | |
| template<typename InputType > | |
| WGridRegular3DTemplate (WGridRegular3DTemplate< InputType > const &rhs) | |
| Copy constructor. | |
| WGridRegular3DTemplate (unsigned int nbPosX, unsigned int nbPosY, unsigned int nbPosZ, WGridTransformOrthoTemplate< T > const transform=WGridTransformOrthoTemplate< T >()) | |
| Defines the number of samples in each coordinate direction as ints, and the transformation of the grid via a grid transform. | |
| unsigned int | getNbCoordsX () const |
| Returns the number of samples in x direction. | |
| unsigned int | getNbCoordsY () const |
| Returns the number of samples in y direction. | |
| unsigned int | getNbCoordsZ () const |
| Returns the number of samples in z direction. | |
| T | getOffsetX () const |
| Returns the distance between samples in x direction. | |
| T | getOffsetY () const |
| Returns the distance between samples in y direction. | |
| T | getOffsetZ () const |
| Returns the distance between samples in z direction. | |
| Vector3Type | getDirectionX () const |
| Returns the vector determining the direction of samples in x direction. | |
| Vector3Type | getDirectionY () const |
| Returns the vector determining the direction of samples in y direction. | |
| Vector3Type | getDirectionZ () const |
| Returns the vector determining the direction of samples in z direction. | |
| Vector3Type | getUnitDirectionX () const |
| Returns the vector determining the unit (normalized) direction of samples in x direction. | |
| Vector3Type | getUnitDirectionY () const |
| Returns the vector determining the unit (normalized) direction of samples in y direction. | |
| Vector3Type | getUnitDirectionZ () const |
| Returns the vector determining the unit (normalized) direction of samples in z direction. | |
| Vector3Type | getOrigin () const |
| Returns the position of the origin of the grid. | |
| WMatrix< T > | getTransformationMatrix () const |
| Returns a 4x4 matrix that represents the grid's transformation. | |
| WBoundingBox | getBoundingBox () const |
Axis aligned Bounding Box that encloses this grid. | |
| Vector3Type | getPosition (unsigned int i) const |
| Returns the i-th position on the grid. | |
| Vector3Type | getPosition (unsigned int iX, unsigned int iY, unsigned int iZ) const |
| Returns the position that is the iX-th in x direction, the iY-th in y direction and the iZ-th in z direction. | |
| Vector3Type | worldCoordToTexCoord (Vector3Type point) |
| Transforms world coordinates to texture coordinates. | |
| int | getVoxelNum (const Vector3Type &pos) const |
| Returns the i'th voxel where the given position belongs too. | |
| int | getVoxelNum (const size_t x, const size_t y, const size_t z) const |
| returns the voxel index for a given discrete position in the grid | |
| int | getXVoxelCoord (const Vector3Type &pos) const |
| Computes the X coordinate of that voxel that contains the position pos. | |
| int | getYVoxelCoord (const Vector3Type &pos) const |
| Computes the Y coordinate of that voxel that contains the position pos. | |
| int | getZVoxelCoord (const Vector3Type &pos) const |
| Computes the Z coordinate of that voxel that contains the position pos. | |
| WVector3i | getVoxelCoord (const Vector3Type &pos) const |
| Computes the voxel coordinates of that voxel which contains the position pos. | |
| size_t | getCellId (const Vector3Type &pos, bool *success) const |
| Computes the id of the cell containing the position pos. | |
| CellVertexArray | getCellVertexIds (size_t cellId) const |
| Computes the ids of the vertices of a cell given by its id. | |
| boost::shared_ptr< std::vector < Vector3Type > > | getVoxelVertices (const Vector3Type &point, const T margin=0.0) const |
| Computes the vertices for a voxel cuboid around the given point: | |
| std::vector< size_t > | getNeighbours (size_t id) const |
| Return the list of neighbour voxels. | |
| std::vector< size_t > | getNeighbours27 (size_t id) const |
| Return the list of all neighbour voxels. | |
| std::vector< size_t > | getNeighboursRange (size_t id, size_t range) const |
| Return the list of all neighbour voxels. | |
| std::vector< size_t > | getNeighbours9XY (size_t id) const |
| Return the list of all neighbour voxels. | |
| std::vector< size_t > | getNeighbours9YZ (size_t id) const |
| Return the list of all neighbour voxels. | |
| std::vector< size_t > | getNeighbours9XZ (size_t id) const |
| Return the list of all neighbour voxels. | |
| bool | encloses (const Vector3Type &pos) const |
| Decides whether a certain position is inside this grid or not. | |
| bool | isNotRotated () const |
| Return whether the transformations of the grid are only translation and/or scaling. | |
| WGridTransformOrthoTemplate< T > const | getTransform () const |
| Returns the transformation used by this grid. | |
Private Member Functions | |
| int | getNVoxelCoord (const Vector3Type &pos, size_t axis) const |
| Computes for the n'th component of the voxel coordinate where the voxel contains the position pos. | |
| void | initInformationProperties () |
| Adds the specific information of this grid type to the informational properties. | |
Private Attributes | |
| unsigned int | m_nbPosX |
| Number of positions in x direction. | |
| unsigned int | m_nbPosY |
| Number of positions in y direction. | |
| unsigned int | m_nbPosZ |
| Number of positions in z direction. | |
| WGridTransformOrthoTemplate< T > const | m_transform |
| The grid's transformation. | |
Friends | |
| class | WGridRegular3DTemplate |
| class | WGridRegular3DTest |
| Only test are allowed as friends. | |
A grid that has parallelepiped cells which all have the same proportion.
I.e. the samples along a single axis are equidistant. The distance of samples may vary between axes.
Definition at line 61 of file WGridRegular3D.h.
| typedef boost::array< size_t, 8 > WGridRegular3DTemplate< T >::CellVertexArray |
Convenience typedef for a boost::array< size_t, 8 >.
Return type of getCellVertexIds.
Definition at line 89 of file WGridRegular3D.h.
| typedef boost::shared_ptr< const WGridRegular3DTemplate > WGridRegular3DTemplate< T >::ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WGridRegular3DTemplate >.
Definition at line 84 of file WGridRegular3D.h.
| typedef boost::shared_ptr< WGridRegular3DTemplate > WGridRegular3DTemplate< T >::SPtr |
Convenience typedef for a boost::shared_ptr< WGridRegular3DTemplate >.
Definition at line 79 of file WGridRegular3D.h.
| typedef WMatrixFixed< T, 3, 1 > WGridRegular3DTemplate< T >::Vector3Type |
Convenience typedef for 3d vectors of the appropriate numerical type.
Definition at line 74 of file WGridRegular3D.h.
| WGridRegular3DTemplate< T >::WGridRegular3DTemplate | ( | WGridRegular3DTemplate< InputType > const & | rhs | ) |
Copy constructor.
Copies the data from an WGridRegular3DTemplate object with arbitary numerical type.
| rhs | A WGridRegular3DTemplate object, which mustn't have the same numerical type. |
Definition at line 514 of file WGridRegular3D.h.
References WGridRegular3DTemplate< T >::initInformationProperties().
| WGridRegular3DTemplate< T >::WGridRegular3DTemplate | ( | unsigned int | nbPosX, |
| unsigned int | nbPosY, | ||
| unsigned int | nbPosZ, | ||
| WGridTransformOrthoTemplate< T > const | transform = WGridTransformOrthoTemplate< T >() |
||
| ) |
Defines the number of samples in each coordinate direction as ints, and the transformation of the grid via a grid transform.
| nbPosX | number of positions along first axis |
| nbPosY | number of positions along second axis |
| nbPosZ | number of positions along third axis |
| transform | a grid transformation |
Definition at line 525 of file WGridRegular3D.h.
References WGridRegular3DTemplate< T >::initInformationProperties().
| bool WGridRegular3DTemplate< T >::encloses | ( | const Vector3Type & | pos | ) | const [inline] |
Decides whether a certain position is inside this grid or not.
| pos | Position to test |
Definition at line 1144 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testEnclosesQuery(), and WGridRegular3DTest::testEnclosesRotated().
| WBoundingBox WGridRegular3DTemplate< T >::getBoundingBox | ( | ) | const [inline, virtual] |
Axis aligned Bounding Box that encloses this grid.
Axis aligned Bounding Box that encloses this grid.
Implements WGrid.
Definition at line 621 of file WGridRegular3D.h.
References WBoundingBoxImpl< VT >::expandBy().
| size_t WGridRegular3DTemplate< T >::getCellId | ( | const Vector3Type & | pos, |
| bool * | success | ||
| ) | const [inline] |
Computes the id of the cell containing the position pos.
Note that the upper bound of the grid does not belong to any cell
| pos | The position selecting the cell. |
| success | True if the position pos is inside the grid. |
Definition at line 751 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetCellId().
| WGridRegular3DTemplate< T >::CellVertexArray WGridRegular3DTemplate< T >::getCellVertexIds | ( | size_t | cellId | ) | const [inline] |
Computes the ids of the vertices of a cell given by its id.
| cellId | The id of the cell we want to know ther vertices of. |
z-axis y-axis
| /
| 6___/_7
|/: /|
4_:___5 |
| :...|.|
|.2 | 3
|_____|/ ____x-axis
0 1
Definition at line 765 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetCellVertexIds().
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getDirectionX | ( | ) | const [inline] |
Returns the vector determining the direction of samples in x direction.
Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) x-axis.
Definition at line 573 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testOrientation().
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getDirectionY | ( | ) | const [inline] |
Returns the vector determining the direction of samples in y direction.
Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) y-axis.
Definition at line 579 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testOrientation().
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getDirectionZ | ( | ) | const [inline] |
Returns the vector determining the direction of samples in z direction.
Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) z-axis.
Definition at line 585 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testOrientation().
| unsigned int WGridRegular3DTemplate< T >::getNbCoordsX | ( | ) | const [inline] |
Returns the number of samples in x direction.
Definition at line 537 of file WGridRegular3D.h.
Referenced by WDataSetSegmentation::getCSFProbability(), WDataSetSegmentation::getGMProbability(), WDataSetScalar::getValueAt(), WDataSetSegmentation::getWMProbability(), and WGridRegular3DTest::testGetNbCoords().
| unsigned int WGridRegular3DTemplate< T >::getNbCoordsY | ( | ) | const [inline] |
Returns the number of samples in y direction.
Definition at line 543 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetNbCoords().
| unsigned int WGridRegular3DTemplate< T >::getNbCoordsZ | ( | ) | const [inline] |
Returns the number of samples in z direction.
Definition at line 549 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetNbCoords().
| std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours | ( | size_t | id | ) | const |
Return the list of neighbour voxels.
| WOutOfBounds | If the voxel id is outside of the grid. |
| id | Number of the voxel for which the neighbours should be computed |
Definition at line 807 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testNeighbourOfVoxelNotInsideThisGrid(), WGridRegular3DTest::testNeighbourOnBackUpperRight(), WGridRegular3DTest::testNeighbourOnLeftBorderPlane(), WGridRegular3DTest::testNeighboursInsideAGrid(), and WGridRegular3DTest::testNeighboursOnFrontLowerLeft().
| std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours27 | ( | size_t | id | ) | const |
Return the list of all neighbour voxels.
| WOutOfBounds | If the voxel id is outside of the grid. |
| id | Number of the voxel for which the neighbours should be computed |
Definition at line 852 of file WGridRegular3D.h.
| std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours9XY | ( | size_t | id | ) | const |
Return the list of all neighbour voxels.
| WOutOfBounds | If the voxel id is outside of the grid. |
| id | Number of the voxel for which the neighbours should be computed |
Definition at line 953 of file WGridRegular3D.h.
| std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours9XZ | ( | size_t | id | ) | const |
Return the list of all neighbour voxels.
| WOutOfBounds | If the voxel id is outside of the grid. |
| id | Number of the voxel for which the neighbours should be computed |
Definition at line 1080 of file WGridRegular3D.h.
| std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours9YZ | ( | size_t | id | ) | const |
Return the list of all neighbour voxels.
| WOutOfBounds | If the voxel id is outside of the grid. |
| id | Number of the voxel for which the neighbours should be computed |
Definition at line 1016 of file WGridRegular3D.h.
| std::vector< size_t > WGridRegular3DTemplate< T >::getNeighboursRange | ( | size_t | id, |
| size_t | range | ||
| ) | const |
Return the list of all neighbour voxels.
| WOutOfBounds | If the voxel id is outside of the grid. |
| id | Number of the voxel for which the neighbours should be computed |
| range | neighborhood range selected. It specifies the distance to count as neighbour in each direction. |
Definition at line 912 of file WGridRegular3D.h.
| int WGridRegular3DTemplate< T >::getNVoxelCoord | ( | const Vector3Type & | pos, |
| size_t | axis | ||
| ) | const [private] |
Computes for the n'th component of the voxel coordinate where the voxel contains the position pos.
| pos | The position for which the n'th component of the voxel coordinates should be computed. |
| axis | The number of the component. (0 == x-axis, 1 == y-axis, ...) |
| T WGridRegular3DTemplate< T >::getOffsetX | ( | ) | const [inline] |
Returns the distance between samples in x direction.
Definition at line 555 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetVectorOffset().
| T WGridRegular3DTemplate< T >::getOffsetY | ( | ) | const [inline] |
Returns the distance between samples in y direction.
Definition at line 561 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetVectorOffset().
| T WGridRegular3DTemplate< T >::getOffsetZ | ( | ) | const [inline] |
Returns the distance between samples in z direction.
Definition at line 567 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetVectorOffset().
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getOrigin | ( | ) | const [inline] |
Returns the position of the origin of the grid.
Definition at line 609 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testOrientation().
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getPosition | ( | unsigned int | iX, |
| unsigned int | iY, | ||
| unsigned int | iZ | ||
| ) | const [inline] |
Returns the position that is the iX-th in x direction, the iY-th in y direction and the iZ-th in z direction.
| iX | id along first axis of position to be obtained |
| iY | id along second axis of position to be obtained |
| iZ | id along third axis of position to be obtained |
Definition at line 642 of file WGridRegular3D.h.
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getPosition | ( | unsigned int | i | ) | const [inline] |
Returns the i-th position on the grid.
| i | id of position to be obtained |
Definition at line 636 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetPositionScalarOffset().
| WGridTransformOrthoTemplate< T > const WGridRegular3DTemplate< T >::getTransform | ( | ) | const [inline] |
Returns the transformation used by this grid.
Definition at line 1170 of file WGridRegular3D.h.
| WMatrix< T > WGridRegular3DTemplate< T >::getTransformationMatrix | ( | ) | const [inline] |
Returns a 4x4 matrix that represents the grid's transformation.
Definition at line 615 of file WGridRegular3D.h.
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getUnitDirectionX | ( | ) | const [inline] |
Returns the vector determining the unit (normalized) direction of samples in x direction.
Definition at line 591 of file WGridRegular3D.h.
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getUnitDirectionY | ( | ) | const [inline] |
Returns the vector determining the unit (normalized) direction of samples in y direction.
Definition at line 597 of file WGridRegular3D.h.
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getUnitDirectionZ | ( | ) | const [inline] |
Returns the vector determining the unit (normalized) direction of samples in z direction.
Definition at line 603 of file WGridRegular3D.h.
| WVector3i WGridRegular3DTemplate< T >::getVoxelCoord | ( | const Vector3Type & | pos | ) | const [inline] |
Computes the voxel coordinates of that voxel which contains the position pos.
| pos | The position selecting the voxel. |
Definition at line 741 of file WGridRegular3D.h.
| int WGridRegular3DTemplate< T >::getVoxelNum | ( | const Vector3Type & | pos | ) | const [inline] |
Returns the i'th voxel where the given position belongs too.
A voxel is a cuboid which surrounds a point on the grid.
Voxel:
______________ ____ (0.5, 0.5, 0.5)
/: /|
/ : / |
/ : / |
/ : / |
_/____:_ ___ __/ |
| : | |
| : *<--|--------- grid point (0, 0, 0)
| :........|....|__
dz == 1| / | /
| / | / dy == 1
| / | /
_|/____________|/__
|<- dx == 1 ->|
-0.5,-0.5,-0.5
Please note the first voxel has only 1/8 of the size a normal voxel would have since all positions outside the grid do not belong to any voxel. Note: a cell is different to a voxel in terms of position. A voxel has a grid point as center whereas a cell has grid points as corners.
| pos | Position for which we want to have the voxel number. |
Definition at line 669 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testGetVoxelNumberOfPositionExactlyBetweenVoxels().
| int WGridRegular3DTemplate< T >::getVoxelNum | ( | const size_t | x, |
| const size_t | y, | ||
| const size_t | z | ||
| ) | const [inline] |
returns the voxel index for a given discrete position in the grid
| x | Position for which we want to have the voxel number. |
| y | Position for which we want to have the voxel number. |
| z | Position for which we want to have the voxel number. |
Definition at line 695 of file WGridRegular3D.h.
| boost::shared_ptr< std::vector< typename WGridRegular3DTemplate< T >::Vector3Type > > WGridRegular3DTemplate< T >::getVoxelVertices | ( | const Vector3Type & | point, |
| const T | margin = 0.0 |
||
| ) | const |
Computes the vertices for a voxel cuboid around the given point:
z-axis y-axis
| /
| h___/_g
|/: /|
d_:___c |
| :...|.|
|.e | f
|_____|/ ____x-axis
a b
As you can see the order of the points is: a, b, c, d, e, f, g, h.
| point | Center of the cuboid which must not necesarrily be a point of the grid. |
| margin | If you need to shrink the Voxel put here the delta > 0. |
Definition at line 787 of file WGridRegular3D.h.
| int WGridRegular3DTemplate< T >::getXVoxelCoord | ( | const Vector3Type & | pos | ) | const [inline] |
Computes the X coordinate of that voxel that contains the position pos.
| pos | The position which selects the voxel for which the X coordinate is computed. |
Definition at line 706 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testRotatedVoxelNum(), and WGridRegular3DTest::testRotatedVoxelOutOfGrid().
| int WGridRegular3DTemplate< T >::getYVoxelCoord | ( | const Vector3Type & | pos | ) | const [inline] |
Computes the Y coordinate of that voxel that contains the position pos.
| pos | The position which selects the voxel for which the Y coordinate is computed. |
Definition at line 719 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testRotatedVoxelNum(), and WGridRegular3DTest::testRotatedVoxelOutOfGrid().
| int WGridRegular3DTemplate< T >::getZVoxelCoord | ( | const Vector3Type & | pos | ) | const [inline] |
Computes the Z coordinate of that voxel that contains the position pos.
| pos | The position which selects the voxel for which the Z coordinate is computed. |
Definition at line 730 of file WGridRegular3D.h.
Referenced by WGridRegular3DTest::testRotatedVoxelNum(), and WGridRegular3DTest::testRotatedVoxelOutOfGrid().
| void WGridRegular3DTemplate< T >::initInformationProperties | ( | ) | [private] |
Adds the specific information of this grid type to the informational properties.
Definition at line 1176 of file WGridRegular3D.h.
Referenced by WGridRegular3DTemplate< T >::WGridRegular3DTemplate().
| bool WGridRegular3DTemplate< T >::isNotRotated | ( | ) | const [inline] |
Return whether the transformations of the grid are only translation and/or scaling.
Definition at line 1164 of file WGridRegular3D.h.
| WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::worldCoordToTexCoord | ( | Vector3Type | point | ) | [inline] |
Transforms world coordinates to texture coordinates.
| point | The point with these coordinates will be transformed. |
Definition at line 651 of file WGridRegular3D.h.
friend class WGridRegular3DTest [friend] |
Only test are allowed as friends.
Definition at line 69 of file WGridRegular3D.h.
unsigned int WGridRegular3DTemplate< T >::m_nbPosX [private] |
Number of positions in x direction.
Definition at line 499 of file WGridRegular3D.h.
unsigned int WGridRegular3DTemplate< T >::m_nbPosY [private] |
Number of positions in y direction.
Definition at line 500 of file WGridRegular3D.h.
unsigned int WGridRegular3DTemplate< T >::m_nbPosZ [private] |
Number of positions in z direction.
Definition at line 501 of file WGridRegular3D.h.
WGridTransformOrthoTemplate< T > const WGridRegular3DTemplate< T >::m_transform [private] |
The grid's transformation.
Definition at line 504 of file WGridRegular3D.h.
1.7.4