anatomist  5.1.2
3D neuroimaging data viewer
Spline Class Reference

A spline used to store gradient components waveforms. More...

#include <anatomist/gradientwidget/spline.h>

Public Member Functions

 Spline ()
 Constructor. More...
 
 ~Spline ()
 Destructor. More...
 
int getNodesCnt () const
 Get the number of nodes in the spline. More...
 
void clear ()
 Remove all spline nodes. More...
 
int findNode (QSize gradSize, QPoint ptPos, QSize ptSize) const
 Find a node at the specified position. More...
 
void findSegment (QSize gradSize, QPoint ptPos, int &p1, int &p2) const
 Find a segment at the specified position. More...
 
void addNode (double x, double y)
 Add a node to the spline. More...
 
int insertNode (double x, double y)
 Insert a node into the spline. More...
 
void setNode (int index, double x, double y)
 Change the position of a node. More...
 
void removeNode (int index)
 Remove a node. More...
 
void insertAt (int index)
 Insert a node at the given position. More...
 
double getNodeX (int index) const
 Get the x coordinate of the given node. More...
 
double getNodeY (int index) const
 Get the y coordinate of the given node. More...
 
double getLimitMin (int index) const
 Get the minimum x coordinate of the given node. More...
 
double getLimitMax (int index) const
 Get the maximum x coordinate of the given node. More...
 
void invert ()
 Invert the nodes in the spline. More...
 
void generateSpline (double *buffer, int count) const
 Generate the spline waveform. More...
 
QString toString () const
 Encode the spline data as a string. More...
 
void fromString (const QString &string)
 Decode the spline data from a string. More...
 

Detailed Description

A spline used to store gradient components waveforms.

Definition at line 17 of file spline.h.

Constructor & Destructor Documentation

◆ Spline()

Spline::Spline ( )

Constructor.

◆ ~Spline()

Spline::~Spline ( )

Destructor.

Member Function Documentation

◆ addNode()

void Spline::addNode ( double  x,
double  y 
)
inline

Add a node to the spline.

Note
The nodes must be added in order of non-descending x coordinates. The valid range of both coordinates is [0..1].
Parameters
xThe x coordinate of the node.
yThe y coordinate of the node.

Definition at line 81 of file spline.h.

◆ clear()

void Spline::clear ( )
inline

Remove all spline nodes.

Definition at line 44 of file spline.h.

◆ findNode()

int Spline::findNode ( QSize  gradSize,
QPoint  ptPos,
QSize  ptSize 
) const

Find a node at the specified position.

Parameters
gradSizeThe size of the gradient's area.
ptPosPosition of the point close to the node.
ptSizeSize of the node.
Returns
The index of node or -1 if not found.

◆ findSegment()

void Spline::findSegment ( QSize  gradSize,
QPoint  ptPos,
int &  p1,
int &  p2 
) const

Find a segment at the specified position.

Parameters
gradSizeThe size of the gradient's area.
ptPosPosition of the point close to the node.
ptSizeSize of the node.
p1Pointer to the index of first node or -1 if not found
p2Pointer to the index of second node or -1 if not found

◆ fromString()

void Spline::fromString ( const QString &  string)

Decode the spline data from a string.

Parameters
stringThe encoded spline data.

◆ generateSpline()

void Spline::generateSpline ( double *  buffer,
int  count 
) const

Generate the spline waveform.

Parameters
[out]bufferThe array to fill.
countThe size of the array.

◆ getLimitMax()

double Spline::getLimitMax ( int  index) const
inline

Get the maximum x coordinate of the given node.

Parameters
indexThe index of the node.
Returns
The maximum allowed position of the node.

Definition at line 169 of file spline.h.

◆ getLimitMin()

double Spline::getLimitMin ( int  index) const
inline

Get the minimum x coordinate of the given node.

Parameters
indexThe index of the node.
Returns
The minimum allowed position of the node.

Definition at line 156 of file spline.h.

◆ getNodesCnt()

int Spline::getNodesCnt ( ) const
inline

Get the number of nodes in the spline.

Returns
The number of nodes.

Definition at line 36 of file spline.h.

◆ getNodeX()

double Spline::getNodeX ( int  index) const
inline

Get the x coordinate of the given node.

Parameters
indexThe index of the node.
Returns
The horizontal position of the node.

Definition at line 134 of file spline.h.

◆ getNodeY()

double Spline::getNodeY ( int  index) const
inline

Get the y coordinate of the given node.

Parameters
indexThe index of the node.
Returns
The vertical position of the node.

Definition at line 145 of file spline.h.

◆ insertAt()

void Spline::insertAt ( int  index)
inline

Insert a node at the given position.

Parameters
indexThe index of the position to insert the node.

Definition at line 123 of file spline.h.

◆ insertNode()

int Spline::insertNode ( double  x,
double  y 
)

Insert a node into the spline.

Parameters
xThe x coordinate of the node.
yThe y coordinate of the node.
Returns
The index of the inserted node.

◆ invert()

void Spline::invert ( )

Invert the nodes in the spline.

◆ removeNode()

void Spline::removeNode ( int  index)
inline

Remove a node.

Parameters
indexThe index of the node to remove.

Definition at line 113 of file spline.h.

◆ setNode()

void Spline::setNode ( int  index,
double  x,
double  y 
)
inline

Change the position of a node.

Parameters
indexThe index of the node.
xThe new x coordinate of the node.
yThe new y coordinate of the node.

Definition at line 102 of file spline.h.

◆ toString()

QString Spline::toString ( ) const

Encode the spline data as a string.

Returns
The encoded spline data.

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