From c5d537b582894484f497e11bb883ff596efff268 Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Fri, 20 Apr 2018 11:45:47 +0100 Subject: energy function calculation for TV models --- Core/regularisers_CPU/utils.c | 29 +++++++++ Core/regularisers_CPU/utils.h | 1 + Wrappers/Matlab/demos/demoMatlab_3Ddenoise.m | 3 + Wrappers/Matlab/demos/demoMatlab_denoise.m | 8 ++- Wrappers/Matlab/mex_compile/compileCPU_mex.m | 3 + .../mex_compile/regularisers_CPU/TV_energy.c | 69 ++++++++++++++++++++++ 6 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 Wrappers/Matlab/mex_compile/regularisers_CPU/TV_energy.c diff --git a/Core/regularisers_CPU/utils.c b/Core/regularisers_CPU/utils.c index a141cf4..f21d383 100644 --- a/Core/regularisers_CPU/utils.c +++ b/Core/regularisers_CPU/utils.c @@ -62,3 +62,32 @@ float TV_energy2D(float *U, float *U0, float *E_val, float lambda, int dimX, int E_val[0] = E_Grad + E_Data; return *E_val; } + +float TV_energy3D(float *U, float *U0, float *E_val, float lambda, int dimX, int dimY, int dimZ) +{ + int i, j, k, i1, j1, k1, index; + float NOMx_2, NOMy_2, NOMz_2, E_Grad=0.0f, E_Data=0.0f; + + /* first calculate \grad U_xy*/ + for(j=0; j