diff options
author | TomasKulhanek <tomas.kulhanek@stfc.ac.uk> | 2018-12-07 00:21:35 +0000 |
---|---|---|
committer | TomasKulhanek <tomas.kulhanek@stfc.ac.uk> | 2018-12-07 00:21:35 +0000 |
commit | 7e205f44f2942ec165afe8e60b10a4ff69f72e19 (patch) | |
tree | bf436cbb8856fb9be41186c6bc0dd3973d51ded3 /Wrappers/Python/src | |
parent | a1c76dc0abd20d78497ca368a7637c684807903a (diff) | |
download | regularization-7e205f44f2942ec165afe8e60b10a4ff69f72e19.tar.gz regularization-7e205f44f2942ec165afe8e60b10a4ff69f72e19.tar.bz2 regularization-7e205f44f2942ec165afe8e60b10a4ff69f72e19.tar.xz regularization-7e205f44f2942ec165afe8e60b10a4ff69f72e19.zip |
raise exception instead of exit 1
Diffstat (limited to 'Wrappers/Python/src')
-rw-r--r-- | Wrappers/Python/src/gpu_regularisers.pyx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Wrappers/Python/src/gpu_regularisers.pyx b/Wrappers/Python/src/gpu_regularisers.pyx index 302727e..3457796 100644 --- a/Wrappers/Python/src/gpu_regularisers.pyx +++ b/Wrappers/Python/src/gpu_regularisers.pyx @@ -25,7 +25,7 @@ cdef extern void TGV_GPU_main(float *Input, float *Output, float lambdaPar, floa cdef extern void LLT_ROF_GPU_main(float *Input, float *Output, float lambdaROF, float lambdaLLT, int iterationsNumb, float tau, int N, int M, int Z); cdef extern void NonlDiff_GPU_main(float *Input, float *Output, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, int penaltytype, int N, int M, int Z); cdef extern void dTV_FGP_GPU_main(float *Input, float *InputRef, float *Output, float lambdaPar, int iterationsNumb, float epsil, float eta, int methodTV, int nonneg, int printM, int N, int M, int Z); -cdef extern void Diffus4th_GPU_main(float *Input, float *Output, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, int N, int M, int Z); +cdef extern int Diffus4th_GPU_main(float *Input, float *Output, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, int N, int M, int Z); cdef extern void PatchSelect_GPU_main(float *Input, unsigned short *H_i, unsigned short *H_j, float *Weights, int N, int M, int SearchWindow, int SimilarWin, int NumNeighb, float h); # Total-variation Rudin-Osher-Fatemi (ROF) @@ -522,7 +522,8 @@ def Diff4th_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData, # Run Anisotropic Fourth-Order diffusion for 2D data # Running CUDA code here - Diffus4th_GPU_main(&inputData[0,0], &outputData[0,0], regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter, dims[1], dims[0], 1) + if (Diffus4th_GPU_main(&inputData[0,0], &outputData[0,0], regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter, dims[1], dims[0], 1)>0): + raise RuntimeError('Runtime error!') return outputData def Diff4th_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData, @@ -540,7 +541,8 @@ def Diff4th_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData, # Run Anisotropic Fourth-Order diffusion for 3D data # Running CUDA code here - Diffus4th_GPU_main(&inputData[0,0,0], &outputData[0,0,0], regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter, dims[2], dims[1], dims[0]) + if (Diffus4th_GPU_main(&inputData[0,0,0], &outputData[0,0,0], regularisation_parameter, edge_parameter, iterationsNumb, time_marching_parameter, dims[2], dims[1], dims[0])>0): + RuntimeError('Runtime error!') return outputData #****************************************************************# |