OpenWalnut  1.5.0dev
WIntegrationParameterization.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WINTEGRATIONPARAMETERIZATION_H
26 #define WINTEGRATIONPARAMETERIZATION_H
27 
28 #include <memory>
29 #include <vector>
30 
31 #include "WRasterParameterization.h"
32 #include "core/common/math/linearAlgebra/WVectorFixed.h"
33 
34 /**
35  * Stores the direction if a line in a separate dataset for each voxel.
36  */
38 {
39 public:
40  /**
41  * Default constructor.
42  *
43  * \param grid the grid used for the new dataset.
44  */
45  explicit WIntegrationParameterization( std::shared_ptr< WGridRegular3D > grid );
46 
47  /**
48  * Destructor.
49  */
51 
52  /**
53  * This method allows this parameterization to update. It gets called for every voxel which is rasterized by the WRasterAlgorithm.
54  *
55  * \param voxel the voxel to parameterize
56  * \param voxelIdx the voxel index in the common grid calculated using "voxel" (this is for convenience)
57  * \param axis Along which axis the traversal takes place. Since when walking in e.g. X-direction there are not supporting voxels in the
58  * \param value the new voxel value
59  * \param start Start point of the line segment (used to computed the distance)
60  * \param end End point of the line segment (used to computed the distance)
61  */
62  virtual void parameterizeVoxel( const WVector3i& voxel, size_t voxelIdx, const int axis, const double value,
63  const WPosition& start,
64  const WPosition& end );
65 
66  /**
67  * Gets the dataset representing the parameterization.
68  *
69  * \return the dataset.
70  */
71  virtual std::shared_ptr< WDataSetScalar > getDataSet();
72 
73  /**
74  * Gets called for each new line getting rasterized. Here, it is used to reset the internal length integrator
75  *
76  * \param line the new line.
77  */
78  virtual void newLine( const WLine& line );
79 
80  /**
81  * Gets called for each new line segment getting rasterized, as one segment can have multiple voxels.
82  *
83  * \param start start point of the new line segment
84  * \param end end point of the new line segment
85  */
86  virtual void newSegment( const WPosition& start, const WPosition& end );
87 
88 protected:
89  /**
90  * Stores the current length of the fiber at each voxel.
91  */
92  std::vector< double > m_lengthValues;
93 
94  /**
95  * The current length of a line.
96  */
97  double m_curLength;
98 
99 private:
100 };
101 
102 #endif // WINTEGRATIONPARAMETERIZATION_H
Stores the direction if a line in a separate dataset for each voxel.
virtual void parameterizeVoxel(const WVector3i &voxel, size_t voxelIdx, const int axis, const double value, const WPosition &start, const WPosition &end)
This method allows this parameterization to update.
double m_curLength
The current length of a line.
std::vector< double > m_lengthValues
Stores the current length of the fiber at each voxel.
WIntegrationParameterization(std::shared_ptr< WGridRegular3D > grid)
Default constructor.
virtual void newSegment(const WPosition &start, const WPosition &end)
Gets called for each new line segment getting rasterized, as one segment can have multiple voxels.
virtual std::shared_ptr< WDataSetScalar > getDataSet()
Gets the dataset representing the parameterization.
virtual void newLine(const WLine &line)
Gets called for each new line getting rasterized.
A line is an ordered sequence of WPositions.
Definition: WLine.h:42
A fixed size matrix class.
Definition: WMatrixFixed.h:150
This only is a 3d double vector.
This class is the base for all specific parameterization algorithms.