CTL
0.6.1
Computed Tomography Library
|
The DefaultSubsetGenerator class is a convenience class combining the capabilities of multiple CTL subset generators. More...
#include <defaultsubsetgenerator.h>
Public Types | |
enum | { Type = 1200 } |
enum | Order { Random, Adjacent, Orthogonal180, Orthogonal360, RealOrthogonal } |
![]() | |
enum | { Type = 1100 } |
![]() | |
enum | { Type = 1000 } |
![]() | |
enum | { Type = -1, UserType = 65536 } |
Public Member Functions | |
int | type () const override |
void | setFixedNumberOfSubsets (uint nbSubsets) |
Sets the number of subsets in each iteration to nbSubsets; disables size transition. More... | |
void | setOrder (DefaultSubsetGenerator::Order order) |
Sets the selection order (creation pattern) for the creation of subsets to order. More... | |
![]() | |
int | type () const override |
TransitionSchemeExtension (AbstractFixedSizeSubsetGenerator *nestedGenerator) | |
Creates a TransitionSchemeExtension using nestedGenerator as actual subset generator. More... | |
TransitionSchemeExtension (std::unique_ptr< AbstractFixedSizeSubsetGenerator > nestedGenerator) | |
Creates a TransitionSchemeExtension using nestedGenerator as actual subset generator. More... | |
virtual void | setSetup (const AcquisitionSetup &setup) override |
Sets the AcquisitionSetup that belongs to the projection data to setup. More... | |
virtual void | setProjections (ProjectionDataView projections) override |
Sets the projections that this instance shall operate on to projections. More... | |
void | fromVariant (const QVariant &variant) override |
QVariant | toVariant () const override |
void | setTransitionPeriod (uint transitionEveryNIterations) |
Sets the transition period (i.e. the number of iterations after which the subset count is cut in half) to transitionEveryNIterations. More... | |
void | setMaximumNbSubsets (uint maxNbSubsets) |
Sets the maximum number of subsets generated to maxNbSubsets. More... | |
void | setMinimumNbSubsets (uint minNbSubsets) |
Sets the minimum number of subsets generated to minNbSubsets. More... | |
void | setSubsetBounds (uint initialNbSubsets, uint finalNbSubsets) |
Sets the number of subsets in the beginning (early iterations) and at the end of transitions (late iterations) to initialNbSubsets and finalNbSubsets, respectively. More... | |
void | setSubsetGenerator (AbstractFixedSizeSubsetGenerator *nestedGenerator) |
Sets the nested subset generator to nestedGenerator; deleted previous one. More... | |
void | setSubsetGenerator (std::unique_ptr< AbstractFixedSizeSubsetGenerator > nestedGenerator) |
Sets the nested subset generator to nestedGenerator; deleted previous one. More... | |
![]() | |
void | setData (ProjectionDataView projections, const AcquisitionSetup &setup) |
Sets the projections to projections and the corresponding acquisition setup to setup. More... | |
std::vector< ProjectionDataView > | generateSubsets (uint iteration) const |
Generates the subsets for iteration iteration. More... | |
virtual std::vector< std::vector< ProjectionDataView > > | generateAllSubsets (uint nbIterations) |
Convenience method to generate subsets for a certain number of iterations. More... | |
bool | isSubsetPermutationEnabled () const |
Returns true if subset permutation is enabled; false otherwise. | |
const ProjectionDataView & | projections () const |
Returns the ProjectionDataView that has been set via setProjections(). | |
uint | randomGeneratorSeed () const |
Returns the seed that has been used to seed the RNG of this instance. More... | |
void | setRandomGeneratorSeed (uint seed=std::random_device{}()) |
Sets the seed of the RNG to seed and actually seeds the RNG. | |
void | setSubsetPermutationEnabled (bool enabled) |
Sets the use of subset permutation to enabled. More... | |
![]() | |
virtual | ~SerializationInterface ()=default |
Friends | |
template<class > | |
struct | SerializationHelper::RegisterWithSerializationHelper |
Additional Inherited Members | |
![]() | |
std::vector< ProjectionDataView > | generateSubsetsImpl (uint iteration) const override |
Implementation of the wrapper for the subset generation routine. More... | |
virtual uint | numberOfSubsets (uint iteration) const |
Computes the number of subsets that shall be generated for iteration nb. \iteration. More... | |
void | shuffleSubsets (std::vector< ProjectionDataView > &subsets) const override |
Randomly permutes the order of the subsets in subsets. More... | |
![]() | |
AbstractSubsetGenerator () | |
Constructs an AbstractSubsetGenerator. More... | |
AbstractSubsetGenerator (const AbstractSubsetGenerator &)=default | |
AbstractSubsetGenerator (AbstractSubsetGenerator &&)=default | |
AbstractSubsetGenerator & | operator= (const AbstractSubsetGenerator &)=default |
AbstractSubsetGenerator & | operator= (AbstractSubsetGenerator &&)=default |
![]() | |
SerializationInterface ()=default | |
SerializationInterface (const SerializationInterface &)=default | |
SerializationInterface (SerializationInterface &&)=default | |
SerializationInterface & | operator= (const SerializationInterface &)=default |
SerializationInterface & | operator= (SerializationInterface &&)=default |
![]() | |
std::unique_ptr< AbstractFixedSizeSubsetGenerator > | _nestedGen |
uint | _minNbSubsets = 1u |
uint | _maxNbSubsets = 0u |
uint | _transitionPeriod = 1u |
![]() | |
ProjectionDataView | _fullProjections = ProjectionDataView::invalidView() |
The projection data view this instance operates on. | |
std::mt19937 | _rng |
random number generator (RNG) instance | |
uint | _rngSeed = 42 |
value used to seed the RNG | |
bool | _permuteSubsets = true |
state variable if subset permutation is enabled | |
The DefaultSubsetGenerator class is a convenience class combining the capabilities of multiple CTL subset generators.
The DefaultSubsetGenerator provides the capabilities of a TransitionSchemeExtension with predefined nested subset generators to make its use more convenient. This includes the SimpleSubsetGenerator as well as the OrthogonalSubsetGenerator. The corresponding generator type will be selected automatically based on the chosen subset order (or generation pattern) by means of setOrder().
By default, this class creates a subset size transition with progressing iteration count. Refer to the documentation of TransitionSchemeExtension for more details on all possible settings and and explanation of the transition pattern. In case a fixed number of subsets is desired, this can be done conveniently using setFixedNumberOfSubsets().
In total, this generator supports the following generation patterns:
Note that when using Order::RealOrthogonal, subset generation depends on the actual acquisition geometry, thus the corresponding AcquisitionSetup needs to be set in advance of generating the subsets (see setSetup()).
It is also possible to use TransitionSchemeExtension::setSubsetGenerator() to install a custom nested subset generator. However, a call to setOrder() will replace any previously installed custom generator by either SimpleSubsetGenerator or OrthogonalSubsetGenerator (depending on the selected order).
Example:
We now want to use the RealOrthogonal pattern to generate our subsets. We can do so as follows:
Enumeration for subset selection orders.
The selection order decides which views will end up in a particular subset.
Implemented through SimpleSubsetGenerator.
Enumerator | |
---|---|
Random | Randomly selects views for a subset. Implemented through SimpleSubsetGenerator. |
Adjacent | Puts adjacent views into a subset. Implemented through SimpleSubsetGenerator. |
Orthogonal180 | Selects sets of most orthogonal views, assuming a circular scan orbit with an agular range of 180 degrees. Implemented through SimpleSubsetGenerator. |
Orthogonal360 | Selects sets of most orthogonal views, assuming a circular scan orbit with an agular range of 360 degrees. Implemented through SimpleSubsetGenerator. |
RealOrthogonal | Selects sets of most orthogonal views based on the actual acquisition geometry. Implemented through OrthogonalSubsetGenerator. |
void CTL::DefaultSubsetGenerator::setFixedNumberOfSubsets | ( | uint | nbSubsets | ) |
Sets the number of subsets in each iteration to nbSubsets; disables size transition.
If nbSubsets is larger than the number of projections in the data that has been set, the number of subsets is reduced to the total count of available projections (i.e. subsets with a single view each will be generated).
Same as:
Example: generating a fixed number of 3 subsets
void CTL::DefaultSubsetGenerator::setOrder | ( | DefaultSubsetGenerator::Order | order | ) |
Sets the selection order (creation pattern) for the creation of subsets to order.
The following generation patterns are supported:
All patterns except RealOrthogonal are provided by a SimpleSubsetGenerator. These cases do not require an AcquisitionSetup being set for the generation of subsets. The case RealOrthogonal uses OrthogonalSubsetGenerator and is based on the actual acquisition geometry; thus, requiring the corresponding setup (see setSetup()).
Calling this method always results in a reset of the nested subset generator. This might be important in case a custom generator has been installed previously through TransitionSchemeExtension::setSubsetGenerator().
Example: see detailed class description
|
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::AbstractSubsetGenerator.