CTL
0.6.1
Computed Tomography Library
|
The SeparableProductModel class represents the product of individual (1D) models in each dimension. More...
#include <datamodels2d.h>
Public Types | |
enum | { Type = 1100 } |
![]() | |
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 |
SeparableProductModel (std::shared_ptr< AbstractDataModel > xModel, std::shared_ptr< AbstractDataModel > yModel) | |
Constructs a SeparableProductModel; a model representing the product of two one-dimensional models. More... | |
AbstractDataModel & | xModel () |
Returns a (modifiable) reference to the model in x-dimension. More... | |
AbstractDataModel & | yModel () |
Returns a (modifiable) reference to the model in y-dimension. More... | |
QVariant | parameter () const override |
void | setParameter (const QVariant ¶meter) override |
Sets the parameters contained in parameter (a QVariantMap). More... | |
QVariant | toVariant () const override |
![]() | |
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 | |
std::shared_ptr< AbstractDataModel > | _xModel |
std::shared_ptr< AbstractDataModel > | _yModel |
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 SeparableProductModel class represents the product of individual (1D) models in each dimension.
This model maps input in each dimension according to the corresponding model and returns the product of both values. This can be used to construct models that have no inter-dependency between both dimensions (i.e. they are separable).
CTL::SeparableProductModel::SeparableProductModel | ( | std::shared_ptr< AbstractDataModel > | xModel, |
std::shared_ptr< AbstractDataModel > | yModel | ||
) |
Constructs a SeparableProductModel; a model representing the product of two one-dimensional models.
This creates a model that is defined by the two one-dimensional models xModel and yModel that describe the function individually in each dimension.
This model maps input in each dimension according to the corresponding model and returns the product of both values. This can be used to construct models that have no inter-dependency between both dimensions (i.e. they are separable).
Example: create a product of a 1D Gaussian (in x direction) and a rect function (in y direction)
|
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 two (key, value)-pairs:
-("x model", [QVariant
] variant of xModel), -("y model", [QVariant
] variant of yModel).
Note that the QVariants for xModel and yModel must be instances carrying the full serialization information (such as it would be returned, e.g., from xModel().toVariant()).
Direct use of this method is not recommended. To set individual parameters of the two underlying data models, consider using their individual setParameter() methods.
Example: create a product of a 1D Gaussian and a rect function; set the standard deviation of the Gaussian to 4.0 and its amplitude to 10.0.
Reimplemented from CTL::AbstractDataModel2D.
|
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 product of the value returned by the individual models given their corresponding input values.
Same as: xModel().valueAt(x) * yModel().valueAt(y)
Implements CTL::AbstractDataModel2D.
AbstractDataModel & CTL::SeparableProductModel::xModel | ( | ) |
Returns a (modifiable) reference to the model in x-dimension.
This can be used to change the parameters of the x model.
AbstractDataModel & CTL::SeparableProductModel::yModel | ( | ) |
Returns a (modifiable) reference to the model in y-dimension.
This can be used to change the parameters of the y model.