Skip to content

Commit 5fb5be3

Browse files
authored
Merge pull request #122 from vais-ral/matlab_fix
fix to cmakelists file
2 parents e871292 + 1207b14 commit 5fb5be3

File tree

5 files changed

+5
-48
lines changed

5 files changed

+5
-48
lines changed

build/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ rm -r ../build_proj
66
mkdir ../build_proj
77
cd ../build_proj/
88
#make clean
9-
export CIL_VERSION=19.04
9+
export CIL_VERSION=19.06
1010
# install Python modules without CUDA
11-
#cmake ../ -DBUILD_PYTHON_WRAPPER=ON -DBUILD_MATLAB_WRAPPER=OFF -DBUILD_CUDA=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
11+
# cmake ../ -DBUILD_PYTHON_WRAPPER=ON -DBUILD_MATLAB_WRAPPER=OFF -DBUILD_CUDA=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
1212
# install Python modules with CUDA
1313
cmake ../ -DBUILD_PYTHON_WRAPPER=ON -DBUILD_MATLAB_WRAPPER=OFF -DBUILD_CUDA=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
1414
# install Matlab modules without CUDA
15-
#cmake ../ -DBUILD_PYTHON_WRAPPER=OFF -DMatlab_ROOT_DIR=/dls_sw/apps/matlab/r2014a/ -DBUILD_MATLAB_WRAPPER=ON -DBUILD_CUDA=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
15+
# cmake ../ -DBUILD_PYTHON_WRAPPER=OFF -DMatlab_ROOT_DIR=/dls_sw/apps/matlab/r2014a/ -DBUILD_MATLAB_WRAPPER=ON -DBUILD_CUDA=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
1616
# install Matlab modules with CUDA
1717
# cmake ../ -DBUILD_PYTHON_WRAPPER=OFF -DMatlab_ROOT_DIR=/dls_sw/apps/matlab/r2014a/ -DBUILD_MATLAB_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
1818
# cmake ../ -DBUILD_PYTHON_WRAPPER=OFF -DMatlab_ROOT_DIR=/home/algol/SOFT/MATLAB9/ -DBUILD_MATLAB_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install

demos/Matlab_demos/demoMatlab_denoise.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
clear; close all
33
fsep = '/';
44

5-
Path1 = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
65
Path2 = sprintf(['..' fsep 'data' fsep], 1i);
76
Path3 = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'supp'], 1i);
7+
Path1 = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
88
addpath(Path1);
99
addpath(Path2);
1010
addpath(Path3);

src/Core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ add_library(cilreg SHARED
6868
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/SB_TV_core.c
6969
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/TGV_core.c
7070
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/Diffusion_core.c
71-
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/MASK_merge_core.c
7271
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/Diffus4th_order_core.c
7372
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/LLT_ROF_core.c
7473
${CMAKE_CURRENT_SOURCE_DIR}/regularisers_CPU/ROF_TV_core.c

src/Python/ccpi/filters/regularisers.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
script which assigns a proper device core function based on a flag ('cpu' or 'gpu')
33
"""
44

5-
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
5+
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
66
try:
77
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
88
gpu_enabled = True
@@ -212,15 +212,4 @@ def NDF_INP(inputData, maskData, regularisation_parameter, edge_parameter, itera
212212

213213
def NVM_INP(inputData, maskData, SW_increment, iterations):
214214
return NVM_INPAINT_CPU(inputData, maskData, SW_increment, iterations)
215-
216-
def MASK_CORR(maskdata, select_classes, total_classesNum, CorrectionWindow, device='cpu'):
217-
if device == 'cpu':
218-
return MASK_CORR_CPU(maskdata, select_classes, total_classesNum, CorrectionWindow)
219-
elif device == 'gpu' and gpu_enabled:
220-
return MASK_CORR_CPU(maskdata, select_classes, total_classesNum, CorrectionWindow)
221-
else:
222-
if not gpu_enabled and device == 'gpu':
223-
raise ValueError ('GPU is not available')
224-
raise ValueError('Unknown device {0}. Expecting gpu or cpu'\
225-
.format(device))
226215

src/Python/src/cpu_regularisers.pyx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ cdef extern float SB_TV_CPU_main(float *Input, float *Output, float *infovector,
2424
cdef extern float LLT_ROF_CPU_main(float *Input, float *Output, float *infovector, float lambdaROF, float lambdaLLT, int iterationsNumb, float tau, float epsil, int dimX, int dimY, int dimZ);
2525
cdef extern float TGV_main(float *Input, float *Output, float *infovector, float lambdaPar, float alpha1, float alpha0, int iterationsNumb, float L2, float epsil, int dimX, int dimY, int dimZ);
2626
cdef extern float Diffusion_CPU_main(float *Input, float *Output, float *infovector, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, int penaltytype, float epsil, int dimX, int dimY, int dimZ);
27-
cdef extern float Mask_merge_main(unsigned char *MASK, unsigned char *MASK_upd, unsigned char *CORRECTEDRegions, unsigned char *SelClassesList, int SelClassesList_length, int classesNumb, int CorrectionWindow, int dimX, int dimY, int dimZ);
2827
cdef extern float Diffus4th_CPU_main(float *Input, float *Output, float *infovector, float lambdaPar, float sigmaPar, int iterationsNumb, float tau, float epsil, int dimX, int dimY, int dimZ);
2928
cdef extern float dTV_FGP_CPU_main(float *Input, float *InputRef, float *Output, float *infovector, float lambdaPar, int iterationsNumb, float epsil, float eta, int methodTV, int nonneg, int dimX, int dimY, int dimZ);
3029
cdef extern float TNV_CPU_main(float *Input, float *u, float lambdaPar, int maxIter, float tol, int dimX, int dimY, int dimZ);
@@ -707,36 +706,6 @@ def NVM_INP_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
707706

708707
return (outputData, maskData_upd)
709708

710-
##############################################################################
711-
#****************************************************************#
712-
#********Mask (segmented image) correction module **************#
713-
#****************************************************************#
714-
def MASK_CORR_CPU(maskData, select_classes, total_classesNum, CorrectionWindow):
715-
if maskData.ndim == 2:
716-
return MASK_CORR_CPU_2D(maskData, select_classes, total_classesNum, CorrectionWindow)
717-
elif maskData.ndim == 3:
718-
return 0
719-
720-
def MASK_CORR_CPU_2D(np.ndarray[np.uint8_t, ndim=2, mode="c"] maskData,
721-
np.ndarray[np.uint8_t, ndim=1, mode="c"] select_classes,
722-
int total_classesNum,
723-
int CorrectionWindow):
724-
725-
cdef long dims[2]
726-
dims[0] = maskData.shape[0]
727-
dims[1] = maskData.shape[1]
728-
729-
select_classes_length = select_classes.shape[0]
730-
731-
cdef np.ndarray[np.uint8_t, ndim=2, mode="c"] mask_upd = \
732-
np.zeros([dims[0],dims[1]], dtype='uint8')
733-
cdef np.ndarray[np.uint8_t, ndim=2, mode="c"] corr_regions = \
734-
np.zeros([dims[0],dims[1]], dtype='uint8')
735-
736-
# Run the function to process given MASK
737-
Mask_merge_main(&maskData[0,0], &mask_upd[0,0], &corr_regions[0,0], &select_classes[0], select_classes_length,
738-
total_classesNum, CorrectionWindow, dims[1], dims[0], 1)
739-
return (mask_upd,corr_regions)
740709

741710
##############################################################################
742711

0 commit comments

Comments
 (0)