diff --git a/pyVSNR/__init__.py b/pyVSNR/__init__.py index 42a2a5e..a5b196b 100644 --- a/pyVSNR/__init__.py +++ b/pyVSNR/__init__.py @@ -79,9 +79,9 @@ def vsnr2d(img, filters, nite=20, beta=10., nblocks='auto'): u0 = img.flatten() u = np.zeros_like(u0) - psis_p = (c_float * len(psis))(*psis) - u0_p = (c_float * len(u0))(*u0) - u_p = (c_float * len(u))(*u) + psis_ = (c_float * len(psis))(*psis) + u0_ = (c_float * len(u0))(*u0) + u_ = (c_float * len(u))(*u) # 'auto' nblocks definition nblocks_max = get_nblocks() @@ -92,9 +92,16 @@ def vsnr2d(img, filters, nite=20, beta=10., nblocks='auto'): # calculation vmax = u0.max() - get_vsnr2d()(psis_p, length, u0_p, n0, n1, nite, beta, u_p, nblocks, vmax) + try: + get_vsnr2d()(psis_, length, u0_, n0, n1, nite, beta, u_, nblocks, vmax) + except OSError: + dir_path = os.path.dirname(os.path.realpath(__file__)) + msg = '\n!!! Problem when running the cuda libvsnr2d.dll !!!\n' + msg += 'You probably need to recompile the .dll\n' + msg += f'See the README.txt for compilation instructions in {dir_path}' + print(msg) # reshaping - img_corr = np.array(u_p).reshape(n0, n1).astype(float) + img_corr = np.array(u_).reshape(n0, n1).astype(float) return img_corr diff --git a/setup.cfg b/setup.cfg index e1fe0fb..05a29d0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pyVSNR -version = 1.0.1 +version = 1.0.2 maintainer = Patrick QUEMERE maintainer_email = patrick.quemere@cea.fr description = VSNR algorithm for image destripping diff --git a/setup.py b/setup.py index 124ee81..2e39595 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="pyVSNR", - version='1.0.0', + version='1.0.2', license='GPLv3', setup_requires=['setuptools_scm'], include_package_data=True,