summaryrefslogtreecommitdiffstats
path: root/main_func
diff options
context:
space:
mode:
Diffstat (limited to 'main_func')
-rw-r--r--main_func/regularizers_CPU/FGP_TV_core.h30
-rw-r--r--main_func/regularizers_CPU/LLT_model_core.h3
-rw-r--r--main_func/regularizers_CPU/SplitBregman_TV_core.h28
-rw-r--r--main_func/regularizers_CPU/TGV_PD_core.h3
4 files changed, 60 insertions, 4 deletions
diff --git a/main_func/regularizers_CPU/FGP_TV_core.h b/main_func/regularizers_CPU/FGP_TV_core.h
index 697fd84..d256c9a 100644
--- a/main_func/regularizers_CPU/FGP_TV_core.h
+++ b/main_func/regularizers_CPU/FGP_TV_core.h
@@ -23,8 +23,36 @@ limitations under the License.
#include <memory.h>
#include <stdio.h>
#include "omp.h"
+#include "utils.h"
-float copyIm(float *A, float *B, int dimX, int dimY, int dimZ);
+/* C-OMP implementation of FGP-TV [1] denoising/regularization model (2D/3D case)
+*
+* Input Parameters:
+* 1. Noisy image/volume [REQUIRED]
+* 2. lambda - regularization parameter [REQUIRED]
+* 3. Number of iterations [OPTIONAL parameter]
+* 4. eplsilon: tolerance constant [OPTIONAL parameter]
+* 5. TV-type: 'iso' or 'l1' [OPTIONAL parameter]
+*
+* Output:
+* [1] Filtered/regularized image
+* [2] last function value
+*
+* Example of image denoising:
+* figure;
+* Im = double(imread('lena_gray_256.tif'))/255; % loading image
+* u0 = Im + .05*randn(size(Im)); % adding noise
+* u = FGP_TV(single(u0), 0.05, 100, 1e-04);
+*
+* to compile with OMP support: mex FGP_TV.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
+* This function is based on the Matlab's code and paper by
+* [1] Amir Beck and Marc Teboulle, "Fast Gradient-Based Algorithms for Constrained Total Variation Image Denoising and Deblurring Problems"
+*
+* D. Kazantsev, 2016-17
+*
+*/
+
+//float copyIm(float *A, float *B, int dimX, int dimY, int dimZ);
float Obj_func2D(float *A, float *D, float *R1, float *R2, float lambda, int dimX, int dimY);
float Grad_func2D(float *P1, float *P2, float *D, float *R1, float *R2, float lambda, int dimX, int dimY);
float Proj_func2D(float *P1, float *P2, int methTV, int dimX, int dimY);
diff --git a/main_func/regularizers_CPU/LLT_model_core.h b/main_func/regularizers_CPU/LLT_model_core.h
index 10f52fe..560bb9c 100644
--- a/main_func/regularizers_CPU/LLT_model_core.h
+++ b/main_func/regularizers_CPU/LLT_model_core.h
@@ -23,6 +23,7 @@ limitations under the License.
#include <memory.h>
#include <stdio.h>
#include "omp.h"
+#include "utils.h"
#define EPS 0.01
@@ -36,4 +37,4 @@ float div_upd3D(float *U0, float *U, float *D1, float *D2, float *D3, unsigned s
float calcMap(float *U, unsigned short *Map, int dimX, int dimY, int dimZ);
float cleanMap(unsigned short *Map, int dimX, int dimY, int dimZ);
-float copyIm(float *A, float *U, int dimX, int dimY, int dimZ);
+//float copyIm(float *A, float *U, int dimX, int dimY, int dimZ);
diff --git a/main_func/regularizers_CPU/SplitBregman_TV_core.h b/main_func/regularizers_CPU/SplitBregman_TV_core.h
index a7aaabb..78aef09 100644
--- a/main_func/regularizers_CPU/SplitBregman_TV_core.h
+++ b/main_func/regularizers_CPU/SplitBregman_TV_core.h
@@ -23,7 +23,33 @@ limitations under the License.
#include <stdio.h>
#include "omp.h"
-float copyIm(float *A, float *B, int dimX, int dimY, int dimZ);
+#include "utils.h"
+
+/* C-OMP implementation of Split Bregman - TV denoising-regularization model (2D/3D)
+*
+* Input Parameters:
+* 1. Noisy image/volume
+* 2. lambda - regularization parameter
+* 3. Number of iterations [OPTIONAL parameter]
+* 4. eplsilon - tolerance constant [OPTIONAL parameter]
+* 5. TV-type: 'iso' or 'l1' [OPTIONAL parameter]
+*
+* Output:
+* Filtered/regularized image
+*
+* Example:
+* figure;
+* Im = double(imread('lena_gray_256.tif'))/255; % loading image
+* u0 = Im + .05*randn(size(Im)); u0(u0 < 0) = 0;
+* u = SplitBregman_TV(single(u0), 10, 30, 1e-04);
+*
+* to compile with OMP support: mex SplitBregman_TV.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
+* References:
+* The Split Bregman Method for L1 Regularized Problems, by Tom Goldstein and Stanley Osher.
+* D. Kazantsev, 2016*
+*/
+
+//float copyIm(float *A, float *B, int dimX, int dimY, int dimZ);
float gauss_seidel2D(float *U, float *A, float *Dx, float *Dy, float *Bx, float *By, int dimX, int dimY, float lambda, float mu);
float updDxDy_shrinkAniso2D(float *U, float *Dx, float *Dy, float *Bx, float *By, int dimX, int dimY, float lambda);
float updDxDy_shrinkIso2D(float *U, float *Dx, float *Dy, float *Bx, float *By, int dimX, int dimY, float lambda);
diff --git a/main_func/regularizers_CPU/TGV_PD_core.h b/main_func/regularizers_CPU/TGV_PD_core.h
index 04ba95c..cbe7ea4 100644
--- a/main_func/regularizers_CPU/TGV_PD_core.h
+++ b/main_func/regularizers_CPU/TGV_PD_core.h
@@ -23,6 +23,7 @@ limitations under the License.
#include <memory.h>
#include <stdio.h>
#include "omp.h"
+#include "utils.h"
/* 2D functions */
float DualP_2D(float *U, float *V1, float *V2, float *P1, float *P2, int dimX, int dimY, int dimZ, float sigma);
@@ -32,4 +33,4 @@ float ProjQ_2D(float *Q1, float *Q2, float *Q3, int dimX, int dimY, int dimZ, fl
float DivProjP_2D(float *U, float *A, float *P1, float *P2, int dimX, int dimY, int dimZ, float lambda, float tau);
float UpdV_2D(float *V1, float *V2, float *P1, float *P2, float *Q1, float *Q2, float *Q3, int dimX, int dimY, int dimZ, float tau);
float newU(float *U, float *U_old, int dimX, int dimY, int dimZ);
-float copyIm(float *A, float *U, int dimX, int dimY, int dimZ);
+//float copyIm(float *A, float *U, int dimX, int dimY, int dimZ);