CTL
0.6.1
Computed Tomography Library
|
The TVRegularizer class provides an approximation of a total variation (TV) minimizing regularizer. More...
#include <regularizers.h>
Public Types | |
enum | { Type = 2012 } |
enum | NeighborHood { Box3x3x3, NearestOnly } |
![]() | |
enum | { Type = 2000 } |
![]() | |
enum | { Type = -1, UserType = 65536 } |
Public Member Functions | |
int | type () const override |
void | filter (VoxelVolume< float > &volume) override |
TVRegularizer (float maxChangeIn10HU=1.0f, NeighborHood neighbors=NearestOnly) | |
Constructs a TVRegularizer with a maximum filter effect of maxChangeIn10HU times 10 HU on each voxel, according to an anisotropic version of total variation (TV) minimization in the voxel's neighborhood of type neighbors. More... | |
void | setNeighborHoodType (NeighborHood neighbors) |
Sets the neighborhood type used for computation of the TV gradient to neighbors. More... | |
void | setRegularizationStrength (float maxChangeIn10HU) |
Sets the strength of the filter effect to strength. More... | |
QVariant | parameter () const override |
void | setParameter (const QVariant ¶meter) override |
Sets the parameters contained in parameter (a QVariantMap). More... | |
![]() | |
void | fromVariant (const QVariant &variant) override |
QVariant | toVariant () const override |
![]() | |
virtual | ~SerializationInterface ()=default |
Private Member Functions | |
void | applyTV3 (VoxelVolume< float > &volume) |
Applies the TV filtering (wrt. to the filter strength) on a 3x3x3 neighborhood. | |
void | applyTVNN (VoxelVolume< float > &volume) |
Applies the TV filtering (wrt. to the filter strength) considering only the (six) nearest neighbors of a voxel. | |
Static Private Member Functions | |
static QMetaEnum | metaEnum () |
QMetaEnum object used to decode/encode neighborhood enum values. | |
Private Attributes | |
float | _strength = 10.0f |
NeighborHood | _neighbors = NearestOnly |
Static Private Attributes | |
static constexpr float | _step = 0.02269f / 1000.0f |
Friends | |
template<class > | |
struct | SerializationHelper::RegisterWithSerializationHelper |
Additional Inherited Members | |
![]() | |
AbstractVolumeFilter (const AbstractVolumeFilter &)=default | |
AbstractVolumeFilter (AbstractVolumeFilter &&)=default | |
AbstractVolumeFilter & | operator= (const AbstractVolumeFilter &)=default |
AbstractVolumeFilter & | operator= (AbstractVolumeFilter &&)=default |
![]() | |
SerializationInterface ()=default | |
SerializationInterface (const SerializationInterface &)=default | |
SerializationInterface (SerializationInterface &&)=default | |
SerializationInterface & | operator= (const SerializationInterface &)=default |
SerializationInterface & | operator= (SerializationInterface &&)=default |
The TVRegularizer class provides an approximation of a total variation (TV) minimizing regularizer.
This is the CPU version of the TVRegularizer; for the GPU version, see OCL::TVRegularizer.
This class implements an anisotropic version of total variation (TV) regularization.
The strength of the regularization effect is controlled via the regularization parameter. This defines the maximum change in multiples of 10 Hounsfield units (HU) that can be applied to a single voxel in one execution of filter().
This change is applied proportionally, depending on the average number of neighbors of that voxel that have a positive / negative difference to the voxel. Hence, if all surrounding voxels have higher/lower values than the voxel of interest, its value will be increased/decreased by regularizationStrength * 10 HU. If the tendency of neighbor values is mixed, only the corresponding fraction of change is applied, respectively. The voxel's neighborhood that is considered for this operation can be selected from:
|
explicit |
Constructs a TVRegularizer with a maximum filter effect of maxChangeIn10HU times 10 HU on each voxel, according to an anisotropic version of total variation (TV) minimization in the voxel's neighborhood of type neighbors.
For details on the neighborhood type, see setNeighborHoodType().
|
overridevirtual |
This performs an anisotropic version of total variation (TV) regularization on volume.
volume must have a minimum size of 3x3x3 voxels; throws std::domain_error
otherwise.
The strength of the regularization effect is controlled via the regularization parameter. This defines the maximum change in multiples of 10 Hounsfield units (HU) that can be applied to a single voxel. Regularization strength can be specified during construction or through setRegularizationStrength().
The computed change is applied proportionally, depending on the average number of neighbors of that voxel that have a positive / negative difference to the voxel. Hence, if all surrounding voxels have higher/lower values than the voxel of interest, its value will be increased/decreased by 'regularizationStrength' * 10 HU. If the tendency of neighbor values is mixed, only the corresponding fraction of change is applied, respectively.
See setNeighborHoodType() for details on the different neighborhood types (or filter sizes).
Implements CTL::AbstractVolumeFilter.
void CTL::TVRegularizer::setNeighborHoodType | ( | TVRegularizer::NeighborHood | neighbors | ) |
Sets the neighborhood type used for computation of the TV gradient to neighbors.
The voxel's neighborhood that is considered for computation of the TV gradient can be selected from:
|
overridevirtual |
Sets the parameters contained in parameter (a QVariantMap).
Note: it is not recommended to set parameters of the filter this way. Consider using the regular setter methods instead (see setRegularizationStrength() and setNeighborHoodType()).
The value passed to parameter must be a QVariantMap containing one or multiple of the following (key, value)-pairs:
float
] the regularization strength),string
] a valid neighborhood type).The neighborhood type can be either "Box3x3x3" or "NearestOnly".
Example: setting filter strength to 0.75 and the 3x3x3 neighborhood type
Reimplemented from CTL::AbstractVolumeFilter.
void CTL::TVRegularizer::setRegularizationStrength | ( | float | maxChangeIn10HU | ) |
Sets the strength of the filter effect to strength.
The parameter strength defines the maximum change in multiples of 10 Hounsfield units (HU, at 50 keV) that can be applied to a single voxel in one execution of filter(). [1.0 means the maximum change is +-10 HU]
For details on the considered neighboring voxels, see setNeighborHoodType().
|
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::AbstractVolumeFilter.