Fraxinus  18.10
An IGT application
Spline3D< T > Class Template Reference

#include <intersection.hpp>

Public Member Functions

 Spline3D (size_t npoints)
 
 ~Spline3D ()
 
void setPoint (int idx, T const pt[3])
 
void setTransform (bool b)
 
bool getTransform () const
 
void setAxis (int axis)
 
int getAxis () const
 
size_t getLength () const
 
void setPoints (vector< T > const &x, vector< T > const &y, vector< T > const &z)
 
void applyConvolution (vector< T > const &mask)
 
void compute ()
 
int length () const
 
bool intersect (T &t, Plane3D &plane, T pointOnPlane[3]) const
 
void derivativeSingle (T t, T point[3]) const
 
void evaluateSingle (T t, T point[3]) const
 
Intersection< T > findIntersection (const MetaImage< inData_t > *img) const
 
void findAllIntersections (const vector< MetaImage< inData_t > > &imgs)
 
IntersectionSet< T > & getIntersections ()
 
const IntersectionSet< T > & getConstIntersections () const
 

Static Public Member Functions

static vector< Spline3D< T > > * build (vtkSmartPointer< vtkPolyData > data)
 

Protected Member Functions

int findRoots (int p, Plane3D &plane, T roots[2]) const
 

Protected Attributes

std::vector< T > m_points [3]
 The points to interpolate. More...
 
std::vector< T > m_cpoints [3]
 The control points. More...
 
IntersectionSet< T > m_intersections
 The intersections (as filled by findAllIntersections) More...
 
bool m_initialized
 True if m_cpoints is valid. More...
 
bool m_transform
 Whether to transform when finding vector from plane matrix. More...
 
int m_axis
 Which axis to use from plane matrix. More...
 

Detailed Description

template<typename T>
class Spline3D< T >

A class representing a quadratic 3D B-spline curve. It is templated: the parameter T is the type of the values it interpolates as well as the type of the parameter

Definition at line 11 of file intersection.hpp.

Constructor & Destructor Documentation

template<typename T>
Spline3D< T >::Spline3D ( size_t  npoints)
inline

Constructor Initialize a 3D spline with n_points number of breakpoints

Parameters
npointsthe number of points

Definition at line 36 of file spline3d.hpp.

template<typename T>
Spline3D< T >::~Spline3D ( )
inline

Default constructor - initialize to 0 points Destructor Frees the splines and does cleanup

Definition at line 56 of file spline3d.hpp.

Member Function Documentation

template<typename T>
void Spline3D< T >::applyConvolution ( vector< T > const &  mask)
inline

Apply an 1d spatial convolution to the points to interpolate

Parameters
Maskto use for convolution - must be of length 3.

Definition at line 141 of file spline3d.hpp.

template<typename T>
static vector<Spline3D<T> >* Spline3D< T >::build ( vtkSmartPointer< vtkPolyData >  data)
inlinestatic

Contstruct a set of splines representing the centerline described as a set of lines in *data. The algorithm will detect when centerlines split and make separate spline for the branch.

Parameters
dataA set of points with lines between them
Returns
a set of 3D splines

Definition at line 323 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::compute ( )
inline

Initializes the underlying spline structure with the provided data. Needs to be called after adding points to the spline before evaluating it. If it isn't, it will be done automatically

Definition at line 169 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::derivativeSingle ( t,
point[3] 
) const
inline

Get the derivative of the curve at position t

Parameters
tThe position to find the derivative for
pointThe gradient vector at t=t

Definition at line 272 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::evaluateSingle ( t,
point[3] 
) const
inline

Evaluate the curve at position t

Parameters
tthe parameter position to evaluate at
pointThe spatial position at parameter position t

Definition at line 293 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::findAllIntersections ( const vector< MetaImage< inData_t > > &  imgs)
inline

Find all intersections for a set of images. The result can be retrieved by getIntersections() and getConstIntersections

Parameters
imgsVector of images to intersect with the curve

Definition at line 516 of file spline3d.hpp.

template<typename T>
Intersection<T> Spline3D< T >::findIntersection ( const MetaImage< inData_t > *  img) const
inline

Find an intersection with a MetaImage

Parameters
imgThe image to find an intersection with
Returns
Intersection instance where the image intersects with the curve. If no intersection was found, the isValid() method of the returned instance will return false.
See also
Spline3D<T>::intersect()

Definition at line 467 of file spline3d.hpp.

template<typename T>
int Spline3D< T >::findRoots ( int  p,
Plane3D plane,
roots[2] 
) const
inlineprotected

Find the roots of the quadratic equation that can be built by inserting the basis functions into the plane equation

Parameters
pThe position in m_points such that m_points[p] and m_points[p+1] are on opposite sides of the plane
planeThe plane (from which we get the coefficients)
rootsThe roots will be returned here
Returns
the number of roots found

Definition at line 562 of file spline3d.hpp.

template<typename T>
int Spline3D< T >::getAxis ( ) const
inline

Retrieve which axis of plane matrix is to be used for angle recovery

Returns
0 for X axis, 1 for Y axis, 2 for Z axis

Definition at line 109 of file spline3d.hpp.

template<typename T>
const IntersectionSet<T>& Spline3D< T >::getConstIntersections ( ) const
inline

Get the set of intersections that was found with findAllIntersections()

Returns
The set of intersections found (empty if none)

Definition at line 545 of file spline3d.hpp.

template<typename T>
IntersectionSet<T>& Spline3D< T >::getIntersections ( )
inline

Get the set of intersections that was found with findAllIntersections()

Returns
The set of intersections found (empty if none)

Definition at line 536 of file spline3d.hpp.

template<typename T>
size_t Spline3D< T >::getLength ( ) const
inline

Get the length of the spline

Definition at line 118 of file spline3d.hpp.

template<typename T>
bool Spline3D< T >::getTransform ( ) const
inline

Return whether plane matrix will be transformed when retrieving the vector to use for angle recovery

Definition at line 89 of file spline3d.hpp.

template<typename T>
bool Spline3D< T >::intersect ( T &  t,
Plane3D plane,
pointOnPlane[3] 
) const
inline

Find an intersection between this curve and a plane. The method is to first find two adjacent points in m_points (the points to interpolate) that is on different sides of the plane. Then we call findRoots() to find the exact location between those two points.

Parameters
tThe position to start at. Will contain the intersection position after
planeThe plane to intersect with
pointOnPlanewill contain a point that is both on the curve and on the plane.
Returns
true if an intersection was found, false otherwise.

Definition at line 206 of file spline3d.hpp.

template<typename T>
int Spline3D< T >::length ( ) const
inline

Get number of points to interpolate (and thus, how far the parameter may move)

Returns
Number of points to interpolate

Definition at line 187 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::setAxis ( int  axis)
inline

Set which axis of plane matrix to use for angle recovery

Parameters
axis0 for X axis, 1 for Y axis, 2 for Z axis

Definition at line 99 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::setPoint ( int  idx,
T const  pt[3] 
)
inline

Set a point to interpolate

Parameters
idxIndex to set
ptPoint to set

Definition at line 64 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::setPoints ( vector< T > const &  x,
vector< T > const &  y,
vector< T > const &  z 
)
inline

Set all points in this spline

Parameters
xX coordinates
yY coordinates
zZ coordinates

Definition at line 127 of file spline3d.hpp.

template<typename T>
void Spline3D< T >::setTransform ( bool  b)
inline

Set whether to transform the plane matrix when retrieving the vector to use for angle recovery true to transform, false otherwise

Definition at line 79 of file spline3d.hpp.

Member Data Documentation

template<typename T>
int Spline3D< T >::m_axis
protected

Which axis to use from plane matrix.

Definition at line 652 of file spline3d.hpp.

template<typename T>
std::vector<T> Spline3D< T >::m_cpoints[3]
protected

The control points.

Definition at line 642 of file spline3d.hpp.

template<typename T>
bool Spline3D< T >::m_initialized
protected

True if m_cpoints is valid.

Definition at line 647 of file spline3d.hpp.

template<typename T>
IntersectionSet<T> Spline3D< T >::m_intersections
protected

The intersections (as filled by findAllIntersections)

Definition at line 645 of file spline3d.hpp.

template<typename T>
std::vector<T> Spline3D< T >::m_points[3]
protected

The points to interpolate.

Definition at line 640 of file spline3d.hpp.

template<typename T>
bool Spline3D< T >::m_transform
protected

Whether to transform when finding vector from plane matrix.

Definition at line 650 of file spline3d.hpp.


The documentation for this class was generated from the following files: