OpenWalnut  1.5.0dev
WRasterParameterization.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 WRASTERPARAMETERIZATION_H
26 #define WRASTERPARAMETERIZATION_H
27 
28 #include <memory>
29 
30 #include "core/common/math/WLine.h"
31 #include "core/common/math/linearAlgebra/WPosition.h"
32 #include "core/common/math/linearAlgebra/WVectorFixed.h"
33 #include "core/dataHandler/WDataSetScalar.h"
34 #include "core/dataHandler/WGridRegular3D.h"
35 
36 /**
37  * This class is the base for all specific parameterization algorithms. Derive from it to write your own class, which is able to create a new
38  * dataset basing on the parameterization of several lines. This might be useful for datasets which contain the current fiber direction at a
39  * voxel, datasets integrating the length of fibers along a fiber or parameterizing the volume using the centerline.
40  */
42 {
43 public:
44  /**
45  * Default constructor. It needs a grid as the parameterization volume HAS to be in the same grid.
46  *
47  * \param grid the grid to use for parameterization.
48  */
49  explicit WRasterParameterization( std::shared_ptr< WGridRegular3D > grid );
50 
51  /**
52  * Destructor.
53  */
54  virtual ~WRasterParameterization();
55 
56  /**
57  * This method allows this parameterization to update. It gets called for every voxel which is rasterized by the WRasterAlgorithm.
58  *
59  * \param voxel the voxel to parameterize
60  * \param voxelIdx the voxel index in the common grid calculated using "voxel" (this is for convenience)
61  * \param axis Along which axis the traversal takes place. Since when walking in e.g. X-direction there are not supporting voxels in the
62  * \param value the new voxel value
63  * \param start Start point of the line segment (used to computed the distance)
64  * \param end End point of the line segment (used to computed the distance)
65  */
66  virtual void parameterizeVoxel( const WVector3i& voxel, size_t voxelIdx, const int axis, const double value,
67  const WPosition& start,
68  const WPosition& end ) = 0;
69 
70  /**
71  * Gets the dataset representing the parameterization.
72  *
73  * \return the dataset.
74  */
75  virtual std::shared_ptr< WDataSetScalar > getDataSet() = 0;
76 
77  /**
78  * Gets called for each new line getting rasterized.
79  *
80  * \param line the new line.
81  */
82  virtual void newLine( const WLine& line );
83 
84  /**
85  * Gets called for each new line segment getting rasterized, as one segment can have multiple voxels.
86  *
87  * \param start start point of the new line segment
88  * \param end end point of the new line segment
89  */
90  virtual void newSegment( const WPosition& start, const WPosition& end );
91 
92  /**
93  * This method gets called whenever all lines got rasterized.
94  */
95  virtual void finished();
96 
97 protected:
98  /**
99  * The grid, which needs to be used for the created dataset and to which the parameterizeVoxel method is relating to.
100  */
101  std::shared_ptr< WGridRegular3D > m_grid;
102 
103 private:
104 };
105 
106 #endif // WRASTERPARAMETERIZATION_H
107 
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.
virtual ~WRasterParameterization()
Destructor.
std::shared_ptr< WGridRegular3D > m_grid
The grid, which needs to be used for the created dataset and to which the parameterizeVoxel method is...
virtual void parameterizeVoxel(const WVector3i &voxel, size_t voxelIdx, const int axis, const double value, const WPosition &start, const WPosition &end)=0
This method allows this parameterization to update.
WRasterParameterization(std::shared_ptr< WGridRegular3D > grid)
Default constructor.
virtual void finished()
This method gets called whenever all lines got rasterized.
virtual std::shared_ptr< WDataSetScalar > getDataSet()=0
Gets the dataset representing the parameterization.
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 void newLine(const WLine &line)
Gets called for each new line getting rasterized.