STIR
6.2.0
|
template for adding keywords to a parser and creating an object More...
#include "stir/ParseAndCreateFrom.h"
Public Member Functions | |
void | set_defaults () |
set default values for any parameters | |
void | add_to_keymap (ParserT &) |
add any relevant parameters to a parser | |
void | check_values () const |
should call error() if something is wrong | |
OutputT * | create (const InputT &) const |
create a new object More... | |
template for adding keywords to a parser and creating an object
The idea is that a reconstructor needs to be able to create an image based on some parameters and the current input data. However, this needs to be flexible for different types, as for instance, many different reconstructors produce a DiscretisedDensity object but from different input data, or vice versa.
We do this using specialisations of this class. That way, PoissonLogLikelihoodWithLinearModelForMeanAndProjData etc can be templated without having to know what the actual OutputT
is.
This of course only works if a specialisation is created for the OutputT
and InputT
of interest.
A specialisation needs to define all four member functions as the reconstruction code will otherwise break.
The default implementations don't do anything (aside from create()).
Check ParseAndCreateFrom<DiscretisedDensity<3, elemT>, ExamDataT> for an example which might make sense.
|
inline |
create a new object
This can take any parsed parameters into account.
The default just calls new
.
std::unique
pointer.