#include <Segmentation.h>
Public Types | |
| typedef BaseImage< DIM, Pixel > | ImageType |
|
typedef Initializer< DIM, float > | Initializer |
| typedef LevelSet< DIM, float > | LevelSet |
| typedef LevelSet::Index | Index |
|
typedef SegmentationModule< DIM, float > | SegmentationModule |
| typedef std::vector< SegmentationModule * > | Modules |
| typedef float(*) | ModuleAssembler (Modules &, const LevelSet &, const Index &, int &) |
| typedef Schemes< DIM, float > | Schemes |
|
typedef Pixels::RGB< unsigned char > | RGBPixel |
| typedef BaseImage< DIM, RGBPixel > | ColorImageType |
Public Member Functions | |
Constructors - Destructor | |
| Segmentation (LevelSet *_phi, Initializer *_init, ImageType *_data=NULL, BaseImage< DIM, bool > *_mask=NULL, float _dt=0.5f, int _reinit_freq=1) | |
| Constructor. | |
| virtual | ~Segmentation () |
| Destructor. | |
Access/Modif data terms | |
| void | add_module (SegmentationModule &_sm) |
| Add a module to the list of modules. | |
| void | remove_module (SegmentationModule &_sm) |
| Remove the module from the list of modules. | |
| void | set_module_assembler (ModuleAssembler _assembler) |
| Set the module assembler. | |
| void | set_level_set (LevelSet &_phi) |
| Set the LevelSet. | |
| void | set_initializer (Initializer &_init) |
| Set the Initializer. | |
| void | set_data_term (ImageType &_data) |
| Set the data term. | |
| void | set_mask (BaseImage< DIM, bool > &_mask) |
| Add a mask to the segmentation process, the level set will evolve only in this mask. | |
| float & | dt () |
| Time step of the evolution. | |
| int & | reinit_freq () |
| Frequence of reinitialization of the band. | |
Results of the segmentation | |
| ColorImageType | get_result (RGBPixel neg=RGBPixel(0, 0, 0), RGBPixel pos=RGBPixel(255, 255, 255)) |
| Return an image on which the contour is drawn on the original image. | |
| ImageType | get_binary_result () |
| Return a binary image of the result of the segmentation. | |
| ImageType | get_speed (int _module=0) |
| Return an image representing the speed induced by the segmentation module '_module'. i=0 mean the final speed, combined by the module assembler. | |
| float | get_energy () |
| Compute and return the energy of the segmentation. | |
segmentation | |
| void | segment (int nbiter=30, std::string evodir="", RGBPixel neg=RGBPixel(0, 0, 0), RGBPixel pos=RGBPixel(255, 255, 255)) |
| Start the segmentation. if nbiter < 0, stop at convergence (if no convergence, may not stop). | |
| bool | stop_condition (int iter, int nbiter) |
| if true, stop of the segmentation process . CAUTION ! have to be done before reinitialisation process | |
| void | init () |
| Initialize the segmentation (not protected because used in the GUI). | |
| void | iterate (int iter, int nbiter) |
| Compute one iteration (not protected because used in the GUI). | |
Protected Attributes | |
Member data | |
| LevelSet * | m_phi |
| Level set. | |
| BaseImage< DIM, float > | m_dphi |
| Variations of the level set. | |
| Initializer * | m_init |
| Initializer. | |
| ImageType * | m_data |
| Image to segment. | |
| std::vector< SegmentationModule * > | m_sm |
| List of segmentation modules. | |
| ModuleAssembler | m_assembler |
| Functor that compute the final speed given the modules, LevelSet and position. | |
| BaseImage< DIM, bool > * | m_mask |
| Boolean mask where the segmentation is to be applied (TODO si not null, croper absolument toutes les images). | |
| int | m_reinit_freq |
| Frequence of reinitialization of the band. | |
| float | m_dt |
| Time step of the evolution. | |
| bool | m_stop_condition |
| if true, stop of the segmentation process | |
The constructor takes 3 objects in parameters :
The 'modules' are the object that are giving speed term to the level set.
2D_Gaussian.C, 2D_GeodesicActiveContour.C, 2D_LocalGaussian.C, 2D_LocalStats.C, 2D_Parzen.C, 2D_SoftShapePrior.C, and 3D_ChanVese.C.
Definition at line 61 of file Segmentation.h.
| Segmentation | ( | LevelSet * | _phi, | |
| Initializer * | _init, | |||
| ImageType * | _data = NULL, |
|||
| BaseImage< DIM, bool > * | _mask = NULL, |
|||
| float | _dt = 0.5f, |
|||
| int | _reinit_freq = 1 | |||
| ) | [inline] |
Constructor.
| _phi | level set that will segment the image |
| _init | Reinitializer of the level-set |
| _data | Image to segment (NULL if no data term) |
| _mask | Binary mask to restrict evolution of the level set (NULL if no mask) |
| _dt | Time step of the evolution (TODO automatic estimation via CFL conditions => a mettre direct dans m_assembler !!!! ) |
| _reinit_freq | frequence of Reinitialization of the LevelSet |
Definition at line 175 of file Segmentation.h.
00176 :m_phi(_phi), m_dphi(_phi->shape()), m_init(_init), m_data(_data), m_assembler(&sum), m_mask(_mask), m_reinit_freq(_reinit_freq), m_dt(_dt), m_stop_condition(false) 00177 { 00178 if (_data != NULL && _data->shape() != _phi->shape()) { 00179 std::cerr << "Error : Shape of the data term and shape of the LevelSet don't match" << std::endl; 00180 exit(1); 00181 } 00182 if (_mask != NULL && _mask->shape() != _phi->shape()) { 00183 std::cerr << "Error : Shape of the mask and shape of the LevelSet don't match" << std::endl; 00184 exit(1); 00185 } 00186 }