summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Wrappers/Python/src/cpu_regularizers.pyx66
1 files changed, 35 insertions, 31 deletions
diff --git a/Wrappers/Python/src/cpu_regularizers.pyx b/Wrappers/Python/src/cpu_regularizers.pyx
index e306ab3..e7ff78c 100644
--- a/Wrappers/Python/src/cpu_regularizers.pyx
+++ b/Wrappers/Python/src/cpu_regularizers.pyx
@@ -18,51 +18,55 @@ import cython
import numpy as np
cimport numpy as np
-cdef extern float TV_ROF(float *A, float *B, int dimX, int dimY, int dimZ, int iterationsNumb, float tau, float lambda);
+cdef extern float TV_ROF(float *A, float *B, int dimX, int dimY, int dimZ,
+ int iterationsNumb, float tau, float flambda);
-def ROF_TV(inputData, iterations, regularization_parameter, marching_step_parameter):
+def ROF_TV(inputData, iterations, regularization_parameter,
+ marching_step_parameter):
if inputData.ndim == 2:
- return ROF_TV_2D(inputData, iterations, regularization_parameter,
- marching_step_parameter)
- elif inputData.ndim == 3:
- return ROF_TV_3D(inputData, iterations, regularization_parameter,
- marching_step_parameter)
+ return ROF_TV_2D(inputData, iterations, regularization_parameter,
+ marching_step_parameter)
+ elif inputData.ndim == 3:
+ return ROF_TV_3D(inputData, iterations, regularization_parameter,
+ marching_step_parameter)
def ROF_TV_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
int iterations,
- float regularization_parameter
- float marching_step_parameter
+ float regularization_parameter,
+ float marching_step_parameter
):
-
- cdef long dims[2]
+
+ cdef long dims[2]
dims[0] = inputData.shape[0]
dims[1] = inputData.shape[1]
-
- cdef np.ndarray[np.float32_t, ndim=2, mode="c"] B = \
- np.zeros([dims[0],dims[1]], dtype='float32')
-
- #/* Run ROF iterations for 2D data */
- TV_ROF(&A[0,0], &B[0,0], dims[0], dims[1], 1, iterations, marching_step_parameter, regularization_parameter)
-
- return B
+
+ cdef np.ndarray[np.float32_t, ndim=2, mode="c"] B = \
+ np.zeros([dims[0],dims[1]], dtype='float32')
+
+ #/* Run ROF iterations for 2D data */
+ TV_ROF(&inputData[0,0], &B[0,0], dims[0], dims[1], 1, iterations,
+ marching_step_parameter, regularization_parameter)
+
+ return B
-
+
def ROF_TV_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
int iterations,
- float regularization_parameter
- float marching_step_parameter
+ float regularization_parameter,
+ float marching_step_parameter
):
- cdef long dims[2]
+ cdef long dims[2]
dims[0] = inputData.shape[0]
dims[1] = inputData.shape[1]
- dims[2] = inputData.shape[2]
-
- cdef np.ndarray[np.float32_t, ndim=3, mode="c"] B = \
- np.zeros([dims[0],dims[1],dims[2]], dtype='float32')
+ dims[2] = inputData.shape[2]
+
+ cdef np.ndarray[np.float32_t, ndim=3, mode="c"] B = \
+ np.zeros([dims[0],dims[1],dims[2]], dtype='float32')
- #/* Run ROF iterations for 3D data */
- TV_ROF(&A[0,0, 0], &B[0,0, 0], dims[0], dims[1], dims[2], iterations, marching_step_parameter, regularization_parameter)
+ #/* Run ROF iterations for 3D data */
+ TV_ROF(&inputData[0,0, 0], &B[0,0, 0], dims[0], dims[1], dims[2], iterations,
+ marching_step_parameter, regularization_parameter)
- return B
-
+ return B
+