diff options
author | dkazanc <dkazanc@hotmail.com> | 2019-04-15 14:46:28 +0100 |
---|---|---|
committer | dkazanc <dkazanc@hotmail.com> | 2019-04-15 14:46:28 +0100 |
commit | 7c79ab71d9d9613e03e9c822b9c8dd4de98d868d (patch) | |
tree | e24e3c69f4f901442a472c793f2e537e34b805e4 /src/Python/ccpi | |
parent | 56a37d28b01078e43e742c47bba627e1a1a3ce86 (diff) | |
download | regularization-7c79ab71d9d9613e03e9c822b9c8dd4de98d868d.tar.gz regularization-7c79ab71d9d9613e03e9c822b9c8dd4de98d868d.tar.bz2 regularization-7c79ab71d9d9613e03e9c822b9c8dd4de98d868d.tar.xz regularization-7c79ab71d9d9613e03e9c822b9c8dd4de98d868d.zip |
created separate module for mask processing
Diffstat (limited to 'src/Python/ccpi')
-rw-r--r-- | src/Python/ccpi/filters/regularisers.py | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/src/Python/ccpi/filters/regularisers.py b/src/Python/ccpi/filters/regularisers.py index 610907d..2fee8b3 100644 --- a/src/Python/ccpi/filters/regularisers.py +++ b/src/Python/ccpi/filters/regularisers.py @@ -2,7 +2,7 @@ script which assigns a proper device core function based on a flag ('cpu' or 'gpu') """ -from ccpi.filters.cpu_regularisers import TV_ROF_CPU, TV_FGP_CPU, TV_SB_CPU, dTV_FGP_CPU, TNV_CPU, NDF_CPU, NDF_MASK_CPU, Diff4th_CPU, TGV_CPU, LLT_ROF_CPU, PATCHSEL_CPU, NLTV_CPU +from ccpi.filters.cpu_regularisers import TV_ROF_CPU, TV_FGP_CPU, TV_SB_CPU, dTV_FGP_CPU, TNV_CPU, NDF_CPU, Diff4th_CPU, TGV_CPU, LLT_ROF_CPU, PATCHSEL_CPU, NLTV_CPU, MASK_CORR_CPU try: from ccpi.filters.gpu_regularisers import TV_ROF_GPU, TV_FGP_GPU, TV_SB_GPU, dTV_FGP_GPU, NDF_GPU, Diff4th_GPU, TGV_GPU, LLT_ROF_GPU, PATCHSEL_GPU gpu_enabled = True @@ -127,37 +127,6 @@ def NDF(inputData, regularisation_parameter, edge_parameter, iterations, raise ValueError ('GPU is not available') raise ValueError('Unknown device {0}. Expecting gpu or cpu'\ .format(device)) -def NDF_MASK(inputData, maskdata, select_classes, total_classesNum, diffuswindow, regularisation_parameter, edge_parameter, iterations, - time_marching_parameter, penalty_type, tolerance_param, device='cpu'): - if device == 'cpu': - return NDF_MASK_CPU(inputData, - maskdata, - select_classes, - total_classesNum, - diffuswindow, - regularisation_parameter, - edge_parameter, - iterations, - time_marching_parameter, - penalty_type, - tolerance_param) - elif device == 'gpu' and gpu_enabled: - return NDF_MASK_CPU(inputData, - maskdata, - select_classes, - total_classesNum, - diffuswindow, - regularisation_parameter, - edge_parameter, - iterations, - time_marching_parameter, - penalty_type, - tolerance_param) - else: - if not gpu_enabled and device == 'gpu': - raise ValueError ('GPU is not available') - raise ValueError('Unknown device {0}. Expecting gpu or cpu'\ - .format(device)) def Diff4th(inputData, regularisation_parameter, edge_parameter, iterations, time_marching_parameter, tolerance_param, device='cpu'): if device == 'cpu': @@ -243,3 +212,15 @@ def NDF_INP(inputData, maskData, regularisation_parameter, edge_parameter, itera def NVM_INP(inputData, maskData, SW_increment, iterations): return NVM_INPAINT_CPU(inputData, maskData, SW_increment, iterations) + +def MASK_CORR(maskdata, select_classes, total_classesNum, CorrectionWindow, device='cpu'): + if device == 'cpu': + return MASK_CORR_CPU(maskdata, select_classes, total_classesNum, CorrectionWindow) + elif device == 'gpu' and gpu_enabled: + return MASK_CORR_CPU(maskdata, select_classes, total_classesNum, CorrectionWindow) + else: + if not gpu_enabled and device == 'gpu': + raise ValueError ('GPU is not available') + raise ValueError('Unknown device {0}. Expecting gpu or cpu'\ + .format(device)) + |