#include <NormalDistributionForce.h>
Inheritance diagram for lsseg::NormalDistributionForce:
Public Member Functions | |
NormalDistributionForce (bool multireg_mode=false) | |
Constructor making a NormalDistributionForce-generator which will have to be initialized with the init() function before being usable. | |
NormalDistributionForce (const Image< double > *img, Mask *mask=0, bool multireg_mode=false) | |
Constructor. | |
virtual | ~NormalDistributionForce () |
virtual void | init (const Image< double > *img, const Mask *mask=0) |
Initialize the ForceGenerator. | |
virtual void | update (const LevelSetFunction &phi) |
Update the force field based on a given segmentation of an image. | |
virtual double | force2D (int x, int y) const |
Get the normal force value of a (x, y) location in the current normal force field. | |
virtual double | force3D (int x, int y, int z) const |
Get the normal force value of a (x, y, z) location in the current normal force field. | |
virtual double | force (size_t ix) const |
Get the normal force value of a particular pixel, specified by its internal storage index. | |
virtual void | force (LevelSetFunction &, const Mask *mask=0) const |
Get the complete normal force field as a LevelSetFunction. | |
Private Member Functions | |
void | report () const |
void | compute_averages (const LevelSetFunction &) |
function called by the update() function. Computes the pixel averages for each channel and each region, and writes the result to the mu_out_ and mu_in_ arrays. | |
void | compute_deviations (const LevelSetFunction &) |
function called by the update() function. Computes the pixel mean deviation for each channel and each region, and writes the result to the inv_sigma_in_ and inv_sigma_out_ arrays. It also precomputes the values in precalc_log_ array. | |
Private Attributes | |
const Image< double > * | img_ |
pointer to the Image to be segmented | |
const Mask * | mask_ |
pointer to a Mask specifying which parts of the image are considered to be active | |
const bool | multi_region_mode_ |
flag specifying whether this object is intended to be used in a multi-region setting (see here for an explanation), or if it is to be used in the classical two-region problem. | |
std::vector< double > | mu_in_ |
average pixel value inside the closed region; one entry per image channel. | |
std::vector< double > | mu_out_ |
average pixel value outside the closed region; one entry per image channel. | |
std::vector< double > | inv_sigma_in_ |
The inverse of the mean deviation inside the closed region; one entry per image channel. | |
std::vector< double > | inv_sigma_out_ |
The inverse of the mean deviation outside the closed region; one entry per image channel. | |
std::vector< double > | precalc_log_ |
precalculate the logarithm component (defined by the regions' mean pixel deviations) of the force. This expression is slightly different according to whether we work in a two-region or multiple-region setting. |
This model can be seen as an elaboration of the model presented by Chan and Vese in [Chan99], with an additional parameter (standard deviation) describing the pixel distribution inside each region. Thus, contrary to the Chan-Vese approach, it can discern between regions having the same average pixel values, as long as the standard deviation of the pixels are different in the two regions. How the force defined by this ForceGenerator is derived from the Mumford-Shah functional is explained e.g. on page 113 and 114 in the thesis by Brox: [Brox05].
Definition at line 74 of file NormalDistributionForce.h.
lsseg::NormalDistributionForce::NormalDistributionForce | ( | bool | multireg_mode = false |
) | [inline] |
Constructor making a NormalDistributionForce-generator which will have to be initialized with the init() function before being usable.
multireg_mode | The NormalDistributionForce-generator is written to also work in a multiregion setting (ie. when segmenting an image into more than two parts using a region competition approach If you construct this object with the intention of using it in a multiregion setting, set multireg_mode to true . Otherwise (if you intend to use the classical setting with two regions), leave it at false . For more about the multiregion setting, refer to the appropriate section of the page on How Segmentation in LSSEG Works. |
Definition at line 91 of file NormalDistributionForce.h.
lsseg::NormalDistributionForce::NormalDistributionForce | ( | const Image< double > * | img, | |
Mask * | mask = 0 , |
|||
bool | multireg_mode = false | |||
) |
Constructor.
img | pointer to the image to be segmented | |
mask | (pointer to) an optional Mask that specifies which part(s) of the image are active. (No forces will be computed for the inactive part(s) of an image). If this pointer is left at zero, the whole of img is considered to be active. | |
multireg_mode | The NormalDistributionForce-generator is written to work in a multiregion setting (ie. when segmenting an image into more than two parts using a region competition approach). If you construct this object with the intention of using it in a multiregion setting, set multireg_mode to true . Otherwise (if you intend to use the classical setting with two regions), leave it at false . For more about the multiregion setting, refer to the appropriate section of the page on How Segmentation in LSSEG Works. |
Definition at line 55 of file NormalDistributionForce.C.
virtual lsseg::NormalDistributionForce::~NormalDistributionForce | ( | ) | [inline, virtual] |
Definition at line 115 of file NormalDistributionForce.h.
void lsseg::NormalDistributionForce::compute_averages | ( | const LevelSetFunction & | ) | [inline, private] |
function called by the update() function. Computes the pixel averages for each channel and each region, and writes the result to the mu_out_ and mu_in_ arrays.
Definition at line 174 of file NormalDistributionForce.C.
void lsseg::NormalDistributionForce::compute_deviations | ( | const LevelSetFunction & | ) | [inline, private] |
function called by the update() function. Computes the pixel mean deviation for each channel and each region, and writes the result to the inv_sigma_in_ and inv_sigma_out_ arrays. It also precomputes the values in precalc_log_ array.
Definition at line 224 of file NormalDistributionForce.C.
void lsseg::NormalDistributionForce::force | ( | LevelSetFunction & | , | |
const Mask * | mask = 0 | |||
) | const [virtual] |
Get the complete normal force field as a LevelSetFunction.
phi | the LevelSetFunction which will, upon completion of the function, contain the force field currently contained in the ForceGenerator |
mask | (pointer to) an optional Mask that specifies which part(s) of the force field are active. (The inactive parts will not be filled into the LevelSetFunction ). If this pointer is left at zero, the whole of the force field is considered to be active. |
Implements lsseg::ForceGenerator.
Definition at line 142 of file NormalDistributionForce.C.
double lsseg::NormalDistributionForce::force | ( | size_t | ix | ) | const [virtual] |
Get the normal force value of a particular pixel, specified by its internal storage index.
The internal storage index of any pixel can be found by applying the Image::indexOf() member function.
Implements lsseg::ForceGenerator.
Definition at line 109 of file NormalDistributionForce.C.
double lsseg::NormalDistributionForce::force2D | ( | int | x, | |
int | y | |||
) | const [virtual] |
Get the normal force value of a (x, y) location in the current normal force field.
for
3D images, z
is here set to be 0. The method is not overloaded due to performance reasons. For true 3D fields, use the force3D() function instead. Implements lsseg::ForceGenerator.
Definition at line 95 of file NormalDistributionForce.C.
double lsseg::NormalDistributionForce::force3D | ( | int | x, | |
int | y, | |||
int | z | |||
) | const [virtual] |
Get the normal force value of a (x, y, z) location in the current normal force field.
Implements lsseg::ForceGenerator.
Definition at line 102 of file NormalDistributionForce.C.
void lsseg::NormalDistributionForce::init | ( | const Image< double > * | img, | |
const Mask * | mask = 0 | |||
) | [virtual] |
Initialize the ForceGenerator.
img | (pointer to) the image that the ForceGenerator should use to derive the force field (i.e. the Image to be segmented). | |
mask | (pointer to) an optional Mask that specifies which part(s) of the image are active. (No forces will be computed for the inactive part(s) of an image). If this pointer is left at zero, the whole of img is considered to be active. |
Implements lsseg::ForceGenerator.
Definition at line 65 of file NormalDistributionForce.C.
void lsseg::NormalDistributionForce::report | ( | ) | const [inline, private] |
void lsseg::NormalDistributionForce::update | ( | const LevelSetFunction & | phi | ) | [virtual] |
Update the force field based on a given segmentation of an image.
phi | this LevelSetFunction should be of the same shape as the Image that the ForceGenerator derives the force field from, and it specifies a segmentation of the Image. Taking this segmentation of the Image into consideration, the ForceGenerator computes the new force field. |
Implements lsseg::ForceGenerator.
Definition at line 84 of file NormalDistributionForce.C.
const Image<double>* lsseg::NormalDistributionForce::img_ [private] |
std::vector<double> lsseg::NormalDistributionForce::inv_sigma_in_ [private] |
The inverse of the mean deviation inside the closed region; one entry per image channel.
Definition at line 146 of file NormalDistributionForce.h.
std::vector<double> lsseg::NormalDistributionForce::inv_sigma_out_ [private] |
The inverse of the mean deviation outside the closed region; one entry per image channel.
Definition at line 150 of file NormalDistributionForce.h.
const Mask* lsseg::NormalDistributionForce::mask_ [private] |
pointer to a Mask specifying which parts of the image are considered to be active
Definition at line 131 of file NormalDistributionForce.h.
std::vector<double> lsseg::NormalDistributionForce::mu_in_ [private] |
average pixel value inside the closed region; one entry per image channel.
Definition at line 139 of file NormalDistributionForce.h.
std::vector<double> lsseg::NormalDistributionForce::mu_out_ [private] |
average pixel value outside the closed region; one entry per image channel.
Definition at line 142 of file NormalDistributionForce.h.
const bool lsseg::NormalDistributionForce::multi_region_mode_ [private] |
flag specifying whether this object is intended to be used in a multi-region setting (see here for an explanation), or if it is to be used in the classical two-region problem.
Definition at line 136 of file NormalDistributionForce.h.
std::vector<double> lsseg::NormalDistributionForce::precalc_log_ [private] |
precalculate the logarithm component (defined by the regions' mean pixel deviations) of the force. This expression is slightly different according to whether we work in a two-region or multiple-region setting.
Definition at line 155 of file NormalDistributionForce.h.