-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathChanVeseSegmentation.h
56 lines (47 loc) · 1.76 KB
/
ChanVeseSegmentation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Robert Crandall
// Chan-Vese Segmentation
#ifndef CHAN_VESE_H
#define CHAN_VESE_H
#include "Image.h"
#include <cmath>
// Define structure containing parameters of
struct CVsetup
{
double dt; // time step
double h; // pixel spacing
double lambda1;
double lambda2;
double mu; // contour length weighting parameter
double nu; // region area weighting parameter
unsigned int p; // length weight exponent
};
// Compute gray level averages in foreground and background regions defined by level set function phi
void GetRegionAverages(Image<unsigned char>* img,
Image<double>* phi,
double epsilon,
double &c1,
double &c2);
// Compute coefficients needed in Chan-Vese segmentation algorithm given current level set function
void GetChanVeseCoefficients(Image<double>* phi,
struct CVsetup* pCVinputs,
unsigned int i,
unsigned int j,
double L,
double& F1,
double& F2,
double& F3,
double& F4,
double& F,
double& deltaPhi);
// Reinitialize a function to the signed distance function to its zero contour
void ReinitPhi(Image<double>* phiIn,
Image<double>** psiOut,
double dt,
double h,
unsigned int numIts);
// Main segmentation algorithm
void ChanVeseSegmentation(Image<unsigned char>* img,
Image<double>* phi0,
Image<double>** phi,
struct CVsetup* pCVinputs);
#endif