CTL
0.6.1
Computed Tomography Library
|
The RectModel2D class represents a two-dimensional rectangular (rect) function. More...
#include <datamodels2d.h>
Public Types | |
enum | { Type = 1003 } |
![]() | |
enum | { Type = 1000 } |
![]() | |
enum | { Type = -1, UserType = 65536 } |
Public Member Functions | |
int | type () const override |
float | valueAt (float x, float y) const override |
Returns the value from the model at position (x, y). More... | |
AbstractDataModel2D * | clone () const override |
RectModel2D (float amplitude=1.0f, float xFrom=-0.5f, float xTo=0.5f, float yFrom=-0.5f, float yTo=0.5f) | |
Constructs a RectModel2D; a model representing a two-dimensional rectangular function. More... | |
RectModel2D (float amplitude, const SamplingRange &xRange, const SamplingRange &yRange) | |
Constructs a RectModel2D; a model representing a two-dimensional rectangular function. More... | |
RectModel2D (float amplitude, const QRectF &rect) | |
Constructs a RectModel2D; a model representing a two-dimensional rectangular function. More... | |
QVariant | parameter () const override |
void | setParameter (const QVariant ¶meter) override |
Sets the parameters contained in parameter (a QVariantMap). More... | |
QVariant | toVariant () const override |
virtual void | setParameter (const QVariant ¶meter) |
void | setParameter (const QString &name, const QVariant &value) |
![]() | |
void | setParameter (const QString &name, const QVariant &value) |
void | fromVariant (const QVariant &variant) override |
QString | name () const |
void | setName (const QString &name) |
Chunk2D< float > | sampleChunk (const SamplingRange &xRange, const SamplingRange &yRange, uint nbSamplesX, uint nbSamplesY) const |
![]() | |
virtual | ~SerializationInterface ()=default |
Private Attributes | |
float | _amplitude |
QRectF | _rect |
Friends | |
template<class > | |
struct | SerializationHelper::RegisterWithSerializationHelper |
Additional Inherited Members | |
![]() | |
AbstractDataModel2D (const AbstractDataModel2D &)=default | |
AbstractDataModel2D (AbstractDataModel2D &&)=default | |
AbstractDataModel2D & | operator= (const AbstractDataModel2D &)=default |
AbstractDataModel2D & | operator= (AbstractDataModel2D &&)=default |
![]() | |
SerializationInterface ()=default | |
SerializationInterface (const SerializationInterface &)=default | |
SerializationInterface (SerializationInterface &&)=default | |
SerializationInterface & | operator= (const SerializationInterface &)=default |
SerializationInterface & | operator= (SerializationInterface &&)=default |
![]() | |
std::shared_ptr< AbstractDataModel2D > | operator+ (std::shared_ptr< AbstractDataModel2D > lhs, std::shared_ptr< AbstractDataModel2D > rhs) |
std::shared_ptr< AbstractDataModel2D > | operator- (std::shared_ptr< AbstractDataModel2D > lhs, std::shared_ptr< AbstractDataModel2D > rhs) |
std::shared_ptr< AbstractDataModel2D > | operator * (std::shared_ptr< AbstractDataModel2D > lhs, std::shared_ptr< AbstractDataModel2D > rhs) |
std::shared_ptr< AbstractDataModel2D > | operator/ (std::shared_ptr< AbstractDataModel2D > lhs, std::shared_ptr< AbstractDataModel2D > rhs) |
std::shared_ptr< AbstractDataModel2D > & | operator+= (std::shared_ptr< AbstractDataModel2D > &lhs, const std::shared_ptr< AbstractDataModel2D > &rhs) |
std::shared_ptr< AbstractDataModel2D > & | operator-= (std::shared_ptr< AbstractDataModel2D > &lhs, const std::shared_ptr< AbstractDataModel2D > &rhs) |
std::shared_ptr< AbstractDataModel2D > & | operator *= (std::shared_ptr< AbstractDataModel2D > &lhs, const std::shared_ptr< AbstractDataModel2D > &rhs) |
std::shared_ptr< AbstractDataModel2D > & | operator/= (std::shared_ptr< AbstractDataModel2D > &lhs, const std::shared_ptr< AbstractDataModel2D > &rhs) |
The RectModel2D class represents a two-dimensional rectangular (rect) function.
This model maps input values according to a rect function in both dimensions. The start and end points of the rectangle, as well as its height can be specified in the constructor of using setParameter().
|
explicit |
Constructs a RectModel2D; a model representing a two-dimensional rectangular function.
This creates a model representing a two-dimensional rectangular function specified by amplitude, xFrom, xTo, yFrom, and yTo.
xFrom, xTo, yFrom, and yTo define the value range in which the function value will be amplitude; it is zero everywhere outside this range.
Same as RectModel2D(amplitude, QRectF(QPointF{ xFrom, yFrom }, QPointF{ xTo, yTo })).
CTL::RectModel2D::RectModel2D | ( | float | amplitude, |
const SamplingRange & | xRange, | ||
const SamplingRange & | yRange | ||
) |
Constructs a RectModel2D; a model representing a two-dimensional rectangular function.
This creates a model representing a two-dimensional rectangular function specified by amplitude, xRange, and yRange.
xRange and yRange define the value range in which the function value will be amplitude; it is zero everywhere outside these ranges.
Same as RectModel2D(amplitude, QRectF(QPointF{ xRange.start(), yRange.start() }, QPointF{ xRange.end(), yRange.end() })).
CTL::RectModel2D::RectModel2D | ( | float | amplitude, |
const QRectF & | rect | ||
) |
Constructs a RectModel2D; a model representing a two-dimensional rectangular function.
This creates a model representing a two-dimensional rectangular function specified by amplitude and rect.
The rect defines the value range in which the function value will be amplitude; it is zero everywhere outside the rect.
|
overridevirtual |
Returns the parameters of this model as a QVariant.
Default implementation returns an empty QVariant. Override in custom classes to encode all relevant information from the class' members. The returned QVariant must contain all information to fully specify the objects state. In particular, calling setParameter(parameter()) should not change the state of an object.
Reimplemented from CTL::AbstractDataModel2D.
|
overridevirtual |
Sets the parameters contained in parameter (a QVariantMap).
The value passed to parameter must be a QVariantMap containing one or multiple of the following (key, value)-pairs:
-("amplitude", [float
] amplitude), -("xFrom", [float
] xFrom), -("xTo", [float
] xTo), -("yFrom", [float
] yFrom) -("yTo", [float
] yTo).
Example: setting the end point of the rectangle to (2.0, 3.0)
Reimplemented from CTL::AbstractDataModel2D.
void CTL::AbstractDataModel2D::setParameter |
Sets the parameter with tag name to value, by passing a QVariantMap containing only the name, value pair as its sole entry to setParameter(const QVariant&).
This method is only useful if setParameter(const QVariant&) is implemented in a way that it allows for individual parameters to be set if the QVariant passed to it does only contain a selection of parameters. When overriding setParameter(const QVariant&) in custom classes, this method will be shadowed. In case you implemented setParameter(const QVariant&) in the way described above (i.e. such that setting individual parameters is possible), re-enable this method in the sub-class via
.
void CTL::AbstractDataModel2D::setParameter |
Sets the parameters of this model based on data held in parameter.
Default implementation does nothing. Override in custom classes to extract all relevant information from parameter and set class members accordingly. A call to this method (given an appropriate input parameter) should prepare the full state of the object. In particular, calling setParameter(parameter()) should not change the state of an object.
|
overridevirtual |
Interface to store all member variables in a QVariant.
Stores the object's type-id.
Reimplement this method such that it stores all newly introduced object data when sub-classing. This needs to cover everything that is necessary to fully determine the state of an object. Best practice is to invoke the base class version of this method to take care of all content originating from underlying base classes.
A typical reimplementation in sub-classes might look like this:
Reimplemented from CTL::AbstractDataModel2D.
|
inlineoverridevirtual |
Returns the type-id of the serializable object. Used in deserialization to determine the proper object type.
Add derived classes to the enumeration using the CTL_TYPE_ID macro.
Reimplemented from CTL::AbstractDataModel2D.
|
overridevirtual |
Returns the value from the model at position (x, y).
Returns the amplitude value of this instance if (x, y) lies inside the specified rectangle; returns zero if (x, y) is outside the rectangle.
Implements CTL::AbstractDataModel2D.