diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2018-02-18 21:47:24 +0000 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2018-02-20 16:18:46 +0000 |
commit | 750db2c6cc7b3561b741d9cd6cfc924daac2a154 (patch) | |
tree | 7715a9eae7083b6e3de8dae70755c0e28c333096 | |
parent | deac578f1919cba530d4dd0a92ea4975eb8ed43b (diff) | |
download | regularization-750db2c6cc7b3561b741d9cd6cfc924daac2a154.tar.gz regularization-750db2c6cc7b3561b741d9cd6cfc924daac2a154.tar.bz2 regularization-750db2c6cc7b3561b741d9cd6cfc924daac2a154.tar.xz regularization-750db2c6cc7b3561b741d9cd6cfc924daac2a154.zip |
fix wrapper build
-rw-r--r-- | Wrappers/Python/src/cpu_regularizers.pyx | 66 |
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 + |