OpenWalnut  1.5.0dev
WCenterlineParameterization.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 WCENTERLINEPARAMETERIZATION_H
26 #define WCENTERLINEPARAMETERIZATION_H
27 
28 #include <memory>
29 #include <vector>
30 
31 #include "WRasterParameterization.h"
32 #include "core/common/datastructures/WFiber.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  * \param centerline the centerline of the cluster
45  */
46  WCenterlineParameterization( std::shared_ptr< WGridRegular3D > grid, std::shared_ptr< WFiber > centerline );
47 
48  /**
49  * Destructor.
50  */
52 
53  /**
54  * This method allows this parameterization to update. It gets called for every voxel which is rasterized by the WRasterAlgorithm.
55  *
56  * \param voxel the voxel to parameterize
57  * \param voxelIdx the voxel index in the common grid calculated using "voxel" (this is for convenience)
58  * \param axis Along which axis the traversal takes place. Since when walking in e.g. X-direction there are not supporting voxels in the
59  * \param value the new voxel value
60  * \param start Start point of the line segment (used to computed the distance)
61  * \param end End point of the line segment (used to computed the distance)
62  */
63  virtual void parameterizeVoxel( const WVector3i& voxel, size_t voxelIdx, const int axis, const double value,
64  const WPosition& start,
65  const WPosition& end );
66 
67  /**
68  * Gets the dataset representing the parameterization.
69  *
70  * \return the dataset.
71  */
72  virtual std::shared_ptr< WDataSetScalar > getDataSet();
73 
74  /**
75  * Gets called for each new line getting rasterized. Here, it is used to reset the internal length integrator
76  *
77  * \param line the new line.
78  */
79  virtual void newLine( const WLine& line );
80 
81  /**
82  * Gets called for each new line segment getting rasterized, as one segment can have multiple voxels.
83  *
84  * \param start start point of the new line segment
85  * \param end end point of the new line segment
86  */
87  virtual void newSegment( const WPosition& start, const WPosition& end );
88 
89  /**
90  * Gets called whenever all lines have been rasterized.
91  */
92  virtual void finished();
93 
94 protected:
95  /**
96  * Stores the current length of the centerline fiber at each voxel.
97  */
98  std::vector< double > m_paramValues;
99 
100  /**
101  * The values with applied selective dilatation.
102  */
103  std::vector< double > m_paramFinalValues;
104 
105  /**
106  * Stores whether the voxel has been set in the past or not.
107  */
108  std::vector< bool > m_paramSetValues;
109 
110  /**
111  * The centerline of the cluster
112  */
113  std::shared_ptr< WFiber > m_centerline;
114 
115  /**
116  * The current start parameter for the current segment.
117  */
119 
120  /**
121  * The current end parameter for the current segment.
122  */
124 
125 private:
126 };
127 
128 #endif // WCENTERLINEPARAMETERIZATION_H
Stores the direction if a line in a separate dataset for each voxel.
std::vector< bool > m_paramSetValues
Stores whether the voxel has been set in the past or not.
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.
double m_currentStartParameter
The current start parameter for the current segment.
virtual ~WCenterlineParameterization()
Destructor.
std::vector< double > m_paramFinalValues
The values with applied selective dilatation.
virtual std::shared_ptr< WDataSetScalar > getDataSet()
Gets the dataset representing the parameterization.
double m_currentEndParameter
The current end parameter for the current segment.
WCenterlineParameterization(std::shared_ptr< WGridRegular3D > grid, std::shared_ptr< WFiber > centerline)
Default constructor.
std::shared_ptr< WFiber > m_centerline
The centerline of the cluster.
virtual void newLine(const WLine &line)
Gets called for each new line getting rasterized.
std::vector< double > m_paramValues
Stores the current length of the centerline fiber at 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.
virtual void finished()
Gets called whenever all lines have been 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.