summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python/src
diff options
context:
space:
mode:
authoralgol <dkazanc@hotmail.com>2018-03-05 18:12:01 +0000
committeralgol <dkazanc@hotmail.com>2018-03-05 18:12:01 +0000
commit74ff5b5f319b2f7ea3e078c62041ec8a1bb28335 (patch)
tree8254d785c8c482ccb8ff36256dfa0cce0aa278e3 /Wrappers/Python/src
parent8082a76d4dfd9588590bab3fd26eae976b744a94 (diff)
downloadregularization-74ff5b5f319b2f7ea3e078c62041ec8a1bb28335.tar.gz
regularization-74ff5b5f319b2f7ea3e078c62041ec8a1bb28335.tar.bz2
regularization-74ff5b5f319b2f7ea3e078c62041ec8a1bb28335.tar.xz
regularization-74ff5b5f319b2f7ea3e078c62041ec8a1bb28335.zip
Cmake/Cython fixes to compile ROF-FGP
Diffstat (limited to 'Wrappers/Python/src')
-rw-r--r--Wrappers/Python/src/cpu_regularizers.cpp1
-rw-r--r--Wrappers/Python/src/cpu_regularizers.pyx25
-rw-r--r--Wrappers/Python/src/gpu_regularizers.pyx2
3 files changed, 13 insertions, 15 deletions
diff --git a/Wrappers/Python/src/cpu_regularizers.cpp b/Wrappers/Python/src/cpu_regularizers.cpp
index 43d5d11..b8156d5 100644
--- a/Wrappers/Python/src/cpu_regularizers.cpp
+++ b/Wrappers/Python/src/cpu_regularizers.cpp
@@ -1040,7 +1040,6 @@ BOOST_PYTHON_MODULE(cpu_regularizers_boost)
np::dtype dt2 = np::dtype::get_builtin<uint16_t>();
def("SplitBregman_TV", SplitBregman_TV);
- def("FGP_TV", FGP_TV);
def("LLT_model", LLT_model);
def("PatchBased_Regul", PatchBased_Regul);
def("TGV_PD", TGV_PD);
diff --git a/Wrappers/Python/src/cpu_regularizers.pyx b/Wrappers/Python/src/cpu_regularizers.pyx
index b8089a8..448da31 100644
--- a/Wrappers/Python/src/cpu_regularizers.pyx
+++ b/Wrappers/Python/src/cpu_regularizers.pyx
@@ -18,8 +18,8 @@ import cython
import numpy as np
cimport numpy as np
-cdef extern float TV_ROF_CPU(float *Input, float *Output, int dimX, int dimY, int dimZ, int iterationsNumb, float tau, float flambda);
-cdef extern float TV_FGP_CPU(float *Input, float *Output, float lambda, int iter, float epsil, int methodTV, int nonneg, int printM, int dimX, int dimY, int dimZ);
+cdef extern float TV_ROF_CPU_main(float *Input, float *Output, int dimX, int dimY, int dimZ, int iterationsNumb, float tau, float flambda);
+cdef extern float TV_FGP_CPU_main(float *Input, float *Output, float lambdaPar, int iter, float epsil, int methodTV, int nonneg, int printM, int dimX, int dimY, int dimZ);
# Can we use the same name here in "def" as the C function?
def TV_ROF_CPU(inputData, iterations, regularization_parameter,
@@ -45,11 +45,10 @@ def TV_ROF_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
np.zeros([dims[0],dims[1]], dtype='float32')
#/* Run ROF iterations for 2D data */
- TV_ROF_CPU(&inputData[0,0], &B[0,0], dims[0], dims[1], 1, iterations,
+ TV_ROF_CPU_main(&inputData[0,0], &B[0,0], dims[0], dims[1], 1, iterations,
marching_step_parameter, regularization_parameter)
- return B
-
+ return B
def TV_ROF_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
int iterations,
@@ -65,7 +64,7 @@ def TV_ROF_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
np.zeros([dims[0],dims[1],dims[2]], dtype='float32')
#/* Run ROF iterations for 3D data */
- TV_FGP_CPU(&inputData[0,0,0], &B[0,0,0], dims[0], dims[1], dims[2], iterations,
+ TV_ROF_CPU_main(&inputData[0,0,0], &B[0,0,0], dims[0], dims[1], dims[2], iterations,
marching_step_parameter, regularization_parameter)
return B
@@ -88,11 +87,11 @@ def TV_FGP_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
dims[0] = inputData.shape[0]
dims[1] = inputData.shape[1]
- cdef np.ndarray[np.float32_t, ndim=2, mode="c"] B = \
+ cdef np.ndarray[np.float32_t, ndim=2, mode="c"] outputData = \
np.zeros([dims[0],dims[1]], dtype='float32')
#/* Run ROF iterations for 2D data */
- TV_FGP_CPU(&inputData[0,0], &B[0,0], regularization_parameter,
+ TV_FGP_CPU_main(&inputData[0,0], &outputData[0,0], regularization_parameter,
iterations,
tolerance_param,
methodTV,
@@ -100,8 +99,7 @@ def TV_FGP_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
printM,
dims[0], dims[1], 1)
- return B
-
+ return outputData
def TV_FGP_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
float regularization_parameter,
@@ -115,15 +113,16 @@ def TV_FGP_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
dims[1] = inputData.shape[1]
dims[2] = inputData.shape[2]
- cdef np.ndarray[np.float32_t, ndim=3, mode="c"] B = \
+ cdef np.ndarray[np.float32_t, ndim=3, mode="c"] outputData = \
np.zeros([dims[0],dims[1],dims[2]], dtype='float32')
#/* Run ROF iterations for 3D data */
- TV_FGP_CPU(&inputData[0,0, 0], &B[0,0, 0], iterations,
+ TV_FGP_CPU_main(&inputData[0,0,0], &outputData[0,0, 0], regularization_parameter,
+ iterations,
tolerance_param,
methodTV,
nonneg,
printM,
dims[0], dims[1], dims[2])
- return B
+ return outputData
diff --git a/Wrappers/Python/src/gpu_regularizers.pyx b/Wrappers/Python/src/gpu_regularizers.pyx
index a14a20d..e99bfa7 100644
--- a/Wrappers/Python/src/gpu_regularizers.pyx
+++ b/Wrappers/Python/src/gpu_regularizers.pyx
@@ -26,7 +26,7 @@ cdef extern void NLM_GPU_kernel(float *A, float* B, float *Eucl_Vec,
int SearchW, int SimilW,
int SearchW_real, float denh2, float lambdaf);
cdef extern void TV_ROF_GPU(float* Input, float* Output, int N, int M, int Z, int iter, float tau, float lambdaf);
-cdef extern void TV_FGP_GPU(float *Input, float *Output, float lambda, int iter, float epsil, int methodTV, int nonneg, int printM, int N, int M, int Z);
+cdef extern void TV_FGP_GPU(float *Input, float *Output, float lambdaPar, int iter, float epsil, int methodTV, int nonneg, int printM, int N, int M, int Z);
cdef extern float pad_crop(float *A, float *Ap,
int OldSizeX, int OldSizeY, int OldSizeZ,