summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorDaniil Kazantsev <dkazanc3@googlemail.com>2018-08-15 21:46:44 +0100
committerGitHub <noreply@github.com>2018-08-15 21:46:44 +0100
commitccc74f7906f77c0f4483dc549bf05d2567b288fb (patch)
tree156f47a438c518a670ff0e78a855ca9fe2489a07 /Wrappers
parentae957063126a421ee0892eff18c44cf8b4e99042 (diff)
parent50739856921f8aeb980f790724b5117308bf9b0e (diff)
downloadregularization-ccc74f7906f77c0f4483dc549bf05d2567b288fb.tar.gz
regularization-ccc74f7906f77c0f4483dc549bf05d2567b288fb.tar.bz2
regularization-ccc74f7906f77c0f4483dc549bf05d2567b288fb.tar.xz
regularization-ccc74f7906f77c0f4483dc549bf05d2567b288fb.zip
Merge pull request #60 from vais-ral/cmaking
Cmaking
Diffstat (limited to 'Wrappers')
-rw-r--r--Wrappers/CMakeLists.txt7
-rwxr-xr-xWrappers/Matlab/CMakeLists.txt147
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/Diffusion_4thO.c5
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_TV.c5
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_dTV.c7
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/LLT_ROF.c5
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff.c6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff_Inp.c10
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/NonlocalMarching_Inpaint.c8
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c20
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/SB_TV.c6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/TGV.c6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/TNV.c5
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_CPU/TV_energy.c6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/Diffusion_4thO_GPU.cpp5
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_TV_GPU.cpp6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_dTV_GPU.cpp8
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/LLT_ROF_GPU.cpp6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/NonlDiff_GPU.cpp6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/ROF_TV_GPU.cpp6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/SB_TV_GPU.cpp6
-rw-r--r--Wrappers/Matlab/mex_compile/regularisers_GPU/TGV_GPU.cpp5
-rw-r--r--Wrappers/Python/CMakeLists.txt122
-rw-r--r--Wrappers/Python/conda-recipe/bld.bat15
-rw-r--r--Wrappers/Python/conda-recipe/build.sh15
-rw-r--r--Wrappers/Python/conda-recipe/meta.yaml6
-rw-r--r--Wrappers/Python/setup-regularisers.py.in4
27 files changed, 354 insertions, 99 deletions
diff --git a/Wrappers/CMakeLists.txt b/Wrappers/CMakeLists.txt
index cbe2fec..bdcb8f4 100644
--- a/Wrappers/CMakeLists.txt
+++ b/Wrappers/CMakeLists.txt
@@ -11,4 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-add_subdirectory(Python) \ No newline at end of file
+if (BUILD_MATLAB_WRAPPER)
+ add_subdirectory(Matlab)
+endif()
+if (BUILD_PYTHON_WRAPPER)
+ add_subdirectory(Python)
+endif() \ No newline at end of file
diff --git a/Wrappers/Matlab/CMakeLists.txt b/Wrappers/Matlab/CMakeLists.txt
new file mode 100755
index 0000000..0c26148
--- /dev/null
+++ b/Wrappers/Matlab/CMakeLists.txt
@@ -0,0 +1,147 @@
+project(regulariserMatlab)
+
+
+find_package(Matlab REQUIRED COMPONENTS MAIN_PROGRAM MX_LIBRARY ENG_LIBRARY )
+
+
+
+#C:\Users\ofn77899\Documents\Projects\CCPi\GitHub\CCPi-FISTA_Reconstruction\Core\regularisers_CPU
+# matlab_add_mex(
+ # NAME CPU_ROF
+ # SRC
+ # ${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c
+ # LINK_TO cilreg ${Matlab_LIBRARIES}
+ # )
+
+# target_include_directories(CPU_ROF
+ # PUBLIC ${CMAKE_SOURCE_DIR}/Core/regularisers_CPU
+ # ${CMAKE_SOURCE_DIR}/Core/regularisers_GPU
+ # ${CMAKE_SOURCE_DIR}/Core/inpainters_CPU
+ # ${CMAKE_SOURCE_DIR}/Core/
+ # ${MATLAB_INCLUDE_DIR})
+
+ # matlab_add_mex(
+ # NAME CPU_TNV
+ # SRC
+ # ${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_CPU/TNV.c
+ # LINK_TO cilreg ${Matlab_LIBRARIES}
+ # )
+
+# target_include_directories(CPU_TNV
+ # PUBLIC ${CMAKE_SOURCE_DIR}/Core/regularisers_CPU
+ # ${CMAKE_SOURCE_DIR}/Core/regularisers_GPU
+ # ${CMAKE_SOURCE_DIR}/Core/inpainters_CPU
+ # ${CMAKE_SOURCE_DIR}/Core/
+ # ${MATLAB_INCLUDE_DIR})
+
+#set (CPU_MEX_FILES "regularisers_CPU/TNV.c;regularisers_CPU/ROF_TV.c")
+#set (MEX_TARGETS "CPU_TNV;CPU_ROF")
+#list(APPEND MEX_TARGETS "CPU_TNV")
+#list(APPEND MEX_TARGETS "CPU_ROF")
+
+file(GLOB CPU_MEX_FILES
+ "${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_CPU/*.c"
+ #"${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_GPU/*.c"
+)
+
+#message("CPU_MEX_FILES " ${CPU_MEX_FILES})
+
+list(LENGTH CPU_MEX_FILES num)
+
+
+MATH(EXPR num "${num}-1")
+#set(num "-1")
+message("found ${num} files")
+
+foreach(tgt RANGE 0 ${num})
+ message("number " ${tgt})
+ list(LENGTH CPU_MEX_FILES num2)
+ message("the list is ${num2}")
+ #list(GET CPU_TARGETS ${tgt} current_target)
+ list(GET CPU_MEX_FILES ${tgt} current_file_name)
+ get_filename_component(current_file ${current_file_name} NAME)
+ string(REGEX MATCH "(.+).c" match ${current_file})
+ if (NOT ${match} EQUAL "" )
+ set (current_target ${CMAKE_MATCH_1})
+ endif()
+ message("matlab_add_mex target " ${current_file} " and " ${current_target})
+ matlab_add_mex(
+ NAME ${current_target}
+ SRC
+ ${current_file_name}
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/FGP_TV_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/SB_TV_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/TGV_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/Diffusion_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/Diffus4th_order_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/LLT_ROF_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/ROF_TV_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/FGP_dTV_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/TNV_core.c
+ #${CMAKE_SOURCE_DIR}/Core/regularisers_CPU/utils.c
+ #${CMAKE_SOURCE_DIR}/Core/inpainters_CPU/Diffusion_Inpaint_core.c
+ #${CMAKE_SOURCE_DIR}/Core/inpainters_CPU/NonlocalMarching_Inpaint_core.c
+ LINK_TO cilreg ${Matlab_LIBRARIES}
+ )
+
+target_include_directories(${current_target}
+ PUBLIC ${CMAKE_SOURCE_DIR}/Core/regularisers_CPU
+ ${CMAKE_SOURCE_DIR}/Core/regularisers_GPU
+ ${CMAKE_SOURCE_DIR}/Core/inpainters_CPU
+ ${CMAKE_SOURCE_DIR}/Core/
+ ${MATLAB_INCLUDE_DIR})
+ set_property(TARGET ${current_target} PROPERTY C_STANDARD 99)
+ list(APPEND CPU_MEX_TARGETS ${current_target})
+ INSTALL(TARGETS ${current_target} DESTINATION "${MATLAB_DEST}")
+endforeach()
+
+add_custom_target(MatlabWrapper DEPENDS ${CPU_MEX_TARGETS})
+
+if (BUILD_CUDA)
+ find_package(CUDA)
+ if (CUDA_FOUND)
+ file(GLOB GPU_MEX_FILES
+ "${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_GPU/*.cpp"
+ )
+
+ list(LENGTH GPU_MEX_FILES num)
+message("number of GPU files " ${num})
+
+ MATH(EXPR num "${num}-1")
+ #set(num "-1")
+
+ foreach(tgt RANGE ${num})
+ message("number " ${tgt})
+ list(LENGTH GPU_MEX_FILES num2)
+ message("the list is ${num2}")
+ #list(GET CPU_TARGETS ${tgt} current_target)
+ list(GET GPU_MEX_FILES ${tgt} current_file_name)
+ get_filename_component(current_file ${current_file_name} NAME)
+ string(REGEX MATCH "(.+).c" match ${current_file})
+ if (NOT ${match} EQUAL "" )
+ set (current_target ${CMAKE_MATCH_1})
+ endif()
+ message("matlab_add_mex target " ${current_file} " and " ${current_target})
+ message("matlab_add_mex " ${current_target})
+ matlab_add_mex(
+ NAME ${current_target}
+ SRC
+ ${current_file_name}
+ LINK_TO cilregcuda ${Matlab_LIBRARIES}
+ )
+
+ target_include_directories(${current_target}
+ PUBLIC ${CMAKE_SOURCE_DIR}/Core/regularisers_CPU
+ ${CMAKE_SOURCE_DIR}/Core/regularisers_GPU
+ ${CMAKE_SOURCE_DIR}/Core/inpainters_CPU
+ ${CMAKE_SOURCE_DIR}/Core/
+ ${MATLAB_INCLUDE_DIR})
+
+ list(APPEND GPU_MEX_TARGETS ${current_target})
+ INSTALL(TARGETS ${current_target} DESTINATION "${MATLAB_DEST}")
+ endforeach()
+
+ add_custom_target(MatlabWrapperGPU DEPENDS ${GPU_MEX_TARGETS})
+
+ endif()
+endif()
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/Diffusion_4thO.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/Diffusion_4thO.c
index 81c0600..66ea9be 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/Diffusion_4thO.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/Diffusion_4thO.c
@@ -42,8 +42,9 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ;
- const int *dim_array;
+ int number_of_dims, iter_numb;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
float *Input, *Output=NULL, lambda, tau, sigma;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_TV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_TV.c
index aae1cb7..642362f 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_TV.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_TV.c
@@ -44,8 +44,9 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ, methTV, printswitch, nonneg;
- const int *dim_array;
+ int number_of_dims, iter, methTV, printswitch, nonneg;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
float *Input, *Output=NULL, lambda, epsil;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_dTV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_dTV.c
index bb868c7..1a0c070 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_dTV.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/FGP_dTV.c
@@ -49,9 +49,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ, methTV, printswitch, nonneg;
- const int *dim_array;
- const int *dim_array2;
+ int number_of_dims, iter, methTV, printswitch, nonneg;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+ const mwSize *dim_array2;
float *Input, *InputRef, *Output=NULL, lambda, epsil, eta;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/LLT_ROF.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/LLT_ROF.c
index 81b717d..ab45446 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/LLT_ROF.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/LLT_ROF.c
@@ -46,8 +46,9 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iterationsNumb, dimX, dimY, dimZ;
- const int *dim_array;
+ int number_of_dims, iterationsNumb;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
float *Input, *Output=NULL, lambdaROF, lambdaLLT, tau;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff.c
index e05f5d4..ec35b8b 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff.c
@@ -43,8 +43,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ, penaltytype;
- const int *dim_array;
+ int number_of_dims, iter_numb, penaltytype;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, tau, sigma;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff_Inp.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff_Inp.c
index eaab4a7..9833392 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff_Inp.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlDiff_Inp.c
@@ -45,9 +45,11 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ, penaltytype, i, inpaint_elements;
- const int *dim_array;
- const int *dim_array2;
+ int number_of_dims, iter_numb, penaltytype, i, inpaint_elements;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+ const mwSize *dim_array2;
+
float *Input, *Output=NULL, lambda, tau, sigma;
unsigned char *Mask;
@@ -95,7 +97,7 @@ void mexFunction(
}
inpaint_elements = 0;
- for (i=0; i<dimY*dimX*dimZ; i++) if (Mask[i] == 1) inpaint_elements++;
+ for (i=0; i<(int)(dimY*dimX*dimZ); i++) if (Mask[i] == 1) inpaint_elements++;
if (inpaint_elements == 0) mexErrMsgTxt("The mask is full of zeros, nothing to inpaint");
Diffusion_Inpaint_CPU_main(Input, Mask, Output, lambda, sigma, iter_numb, tau, penaltytype, dimX, dimY, dimZ);
} \ No newline at end of file
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlocalMarching_Inpaint.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlocalMarching_Inpaint.c
index 36cf05c..b3f2c98 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlocalMarching_Inpaint.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/NonlocalMarching_Inpaint.c
@@ -42,9 +42,11 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, dimX, dimY, dimZ, iterations, SW_increment;
- const int *dim_array;
- const int *dim_array2;
+ int number_of_dims, iterations, SW_increment;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+ const mwSize *dim_array2;
+
float *Input, *Output=NULL;
unsigned char *Mask, *Mask_upd=NULL;
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c
index 6b9e1ea..55ef2b1 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c
@@ -1,3 +1,4 @@
+
/*
* This work is part of the Core Imaging Library developed by
* Visual Analytics and Imaging System Group of the Science Technology
@@ -43,11 +44,12 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ;
- const int *dim_array;
- float *Input, *Output=NULL, lambda, tau;
+ int number_of_dims, iter_numb;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array_i;
+ float *Input, *Output=NULL, lambda, tau;
- dim_array = mxGetDimensions(prhs[0]);
+ dim_array_i = mxGetDimensions(prhs[0]);
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
/*Handling Matlab input data*/
@@ -59,15 +61,17 @@ void mexFunction(
if (mxGetClassID(prhs[0]) != mxSINGLE_CLASS) {mexErrMsgTxt("The input image must be in a single precision"); }
if(nrhs != 4) mexErrMsgTxt("Four inputs reqired: Image(2D,3D), regularization parameter, iterations number, marching step constant");
/*Handling Matlab output data*/
- dimX = dim_array[0]; dimY = dim_array[1]; dimZ = dim_array[2];
+ dimX = dim_array_i[0]; dimY = dim_array_i[1]; dimZ = dim_array_i[2];
/* output arrays*/
if (number_of_dims == 2) {
dimZ = 1; /*2D case*/
/* output image/volume */
- Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(2, dim_array, mxSINGLE_CLASS, mxREAL));
+ Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(2, dim_array_i, mxSINGLE_CLASS, mxREAL));
}
- if (number_of_dims == 3) Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array, mxSINGLE_CLASS, mxREAL));
-
+ if (number_of_dims == 3) {
+ Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array_i, mxSINGLE_CLASS, mxREAL));
+ }
+
TV_ROF_CPU_main(Input, Output, lambda, iter_numb, tau, dimX, dimY, dimZ);
} \ No newline at end of file
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/SB_TV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/SB_TV.c
index d284cac..8636322 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/SB_TV.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/SB_TV.c
@@ -42,8 +42,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ, methTV, printswitch;
- const int *dim_array;
+ int number_of_dims, iter, methTV, printswitch;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, epsil;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/TGV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/TGV.c
index 9516869..5459bf5 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/TGV.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/TGV.c
@@ -43,8 +43,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY;
- const int *dim_array;
+ int number_of_dims, iter;
+ mwSize dimX, dimY;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, alpha0, alpha1, L2;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/TNV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/TNV.c
index e0584c4..acea75d 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/TNV.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/TNV.c
@@ -41,8 +41,9 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ;
- const int *dim_array;
+ int number_of_dims, iter;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
float *Input, *Output=NULL, lambda, epsil;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/TV_energy.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/TV_energy.c
index f9eb2ce..d457f46 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_CPU/TV_energy.c
+++ b/Wrappers/Matlab/mex_compile/regularisers_CPU/TV_energy.c
@@ -36,8 +36,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, dimX, dimY, dimZ, type;
- const int *dim_array;
+ int number_of_dims, type;
+
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
float *Input, *Input0, lambda;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/Diffusion_4thO_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/Diffusion_4thO_GPU.cpp
index 0edc067..0cc042b 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/Diffusion_4thO_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/Diffusion_4thO_GPU.cpp
@@ -42,8 +42,9 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ;
- const int *dim_array;
+ int number_of_dims, iter_numb;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
float *Input, *Output=NULL, lambda, tau, sigma;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_TV_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_TV_GPU.cpp
index 9ed9ae0..c174e75 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_TV_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_TV_GPU.cpp
@@ -43,8 +43,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ, methTV, printswitch, nonneg;
- const int *dim_array;
+ int number_of_dims, iter, methTV, printswitch, nonneg;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, epsil;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_dTV_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_dTV_GPU.cpp
index 5b80616..3f5a4b3 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_dTV_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/FGP_dTV_GPU.cpp
@@ -47,9 +47,11 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ, methTV, printswitch, nonneg;
- const int *dim_array;
- const int *dim_array2;
+ int number_of_dims, iter, methTV, printswitch, nonneg;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+ const mwSize *dim_array2;
+
float *Input, *InputRef, *Output=NULL, lambda, epsil, eta;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/LLT_ROF_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/LLT_ROF_GPU.cpp
index 37563b0..e8da4ce 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/LLT_ROF_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/LLT_ROF_GPU.cpp
@@ -46,8 +46,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iterationsNumb, dimX, dimY, dimZ;
- const int *dim_array;
+ int number_of_dims, iterationsNumb;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambdaROF, lambdaLLT, tau;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/NonlDiff_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/NonlDiff_GPU.cpp
index bfba9ea..1cd0cdc 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/NonlDiff_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/NonlDiff_GPU.cpp
@@ -46,8 +46,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ, penaltytype;
- const int *dim_array;
+ int number_of_dims, iter_numb, penaltytype;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, tau, sigma;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/ROF_TV_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/ROF_TV_GPU.cpp
index f60ba7b..bd01d55 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/ROF_TV_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/ROF_TV_GPU.cpp
@@ -42,8 +42,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter_numb, dimX, dimY, dimZ;
- const int *dim_array;
+ int number_of_dims, iter_numb;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, tau;
dim_array = mxGetDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/SB_TV_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/SB_TV_GPU.cpp
index 60847d9..9d1328f 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/SB_TV_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/SB_TV_GPU.cpp
@@ -42,8 +42,10 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY, dimZ, methTV, printswitch;
- const int *dim_array;
+ int number_of_dims, iter, methTV, printswitch;
+ mwSize dimX, dimY, dimZ;
+ const mwSize *dim_array;
+
float *Input, *Output=NULL, lambda, epsil;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Matlab/mex_compile/regularisers_GPU/TGV_GPU.cpp b/Wrappers/Matlab/mex_compile/regularisers_GPU/TGV_GPU.cpp
index 5a0df5b..edb551d 100644
--- a/Wrappers/Matlab/mex_compile/regularisers_GPU/TGV_GPU.cpp
+++ b/Wrappers/Matlab/mex_compile/regularisers_GPU/TGV_GPU.cpp
@@ -43,8 +43,9 @@ void mexFunction(
int nrhs, const mxArray *prhs[])
{
- int number_of_dims, iter, dimX, dimY;
- const int *dim_array;
+ int number_of_dims, iter;
+ mwSize dimX, dimY;
+ const mwSize *dim_array;
float *Input, *Output=NULL, lambda, alpha0, alpha1, L2;
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
diff --git a/Wrappers/Python/CMakeLists.txt b/Wrappers/Python/CMakeLists.txt
index fa1a30b..d86d0ea 100644
--- a/Wrappers/Python/CMakeLists.txt
+++ b/Wrappers/Python/CMakeLists.txt
@@ -6,7 +6,7 @@ project(regulariserPython)
# The version number.
-set (CIL_VERSION $ENV{CIL_VERSION} CACHE INTERNAL "Core Imaging Library version" FORCE)
+#set (CIL_VERSION $ENV{CIL_VERSION} CACHE INTERNAL "Core Imaging Library version" FORCE)
# conda orchestrated build
message("CIL_VERSION ${CIL_VERSION}")
@@ -41,31 +41,101 @@ elseif(UNIX)
endif()
# GPU regularisers
-
-find_package(CUDA)
-if (CUDA_FOUND)
- message("CUDA FOUND")
- set (SETUP_GPU_WRAPPERS "extra_libraries += ['cilregcuda']\n\
+if (BUILD_CUDA)
+ find_package(CUDA)
+ if (CUDA_FOUND)
+ message("CUDA FOUND")
+ set (SETUP_GPU_WRAPPERS "extra_libraries += ['cilregcuda']\n\
setup( \n\
- name='ccpi', \n\
- description='CCPi Core Imaging Library - Image regularisers GPU',\n\
- version=cil_version,\n\
- cmdclass = {'build_ext': build_ext},\n\
- ext_modules = [Extension('ccpi.filters.gpu_regularisers',\n\
- sources=[ \n\
- os.path.join('.' , 'src', 'gpu_regularisers.pyx' ),\n\
- ],\n\
- include_dirs=extra_include_dirs, \n\
- library_dirs=extra_library_dirs, \n\
- extra_compile_args=extra_compile_args, \n\
- libraries=extra_libraries ), \n\
- ],\n\
- zip_safe = False, \n\
- packages = {'ccpi','ccpi.filters'},\n\
-)")
-else()
- message("CUDA NOT FOUND")
- set(SETUP_GPU_WRAPPERS "#CUDA NOT FOUND")
+ name='ccpi', \n\
+ description='CCPi Core Imaging Library - Image regularisers GPU',\n\
+ version=cil_version,\n\
+ cmdclass = {'build_ext': build_ext},\n\
+ ext_modules = [Extension('ccpi.filters.gpu_regularisers',\n\
+ sources=[ \n\
+ os.path.join('.' , 'src', 'gpu_regularisers.pyx' ),\n\
+ ],\n\
+ include_dirs=extra_include_dirs, \n\
+ library_dirs=extra_library_dirs, \n\
+ extra_compile_args=extra_compile_args, \n\
+ libraries=extra_libraries ), \n\
+ ],\n\
+ zip_safe = False, \n\
+ packages = {'ccpi','ccpi.filters'},\n\
+ )")
+ else()
+ message("CUDA NOT FOUND")
+ set(SETUP_GPU_WRAPPERS "#CUDA NOT FOUND")
+ endif()
+endif()
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/setup-regularisers.py.in" "${CMAKE_CURRENT_BINARY_DIR}/setup-regularisers.py")
+
+
+find_package(PythonInterp)
+find_package(PythonLibs)
+if (PYTHONINTERP_FOUND)
+ message(STATUS "Found PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
+ message(STATUS "Python version ${PYTHON_VERSION_STRING}")
+endif()
+if (PYTHONLIBS_FOUND)
+ message(STATUS "Found PYTHON_INCLUDE_DIRS=${PYTHON_INCLUDE_DIRS}")
+ message(STATUS "Found PYTHON_LIBRARIES=${PYTHON_LIBRARIES}")
endif()
-configure_file("setup-regularisers.py.in" "setup-regularisers.py")
+if (PYTHONINTERP_FOUND)
+ message("Python found " ${PYTHON_EXECUTABLE})
+ set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup-regularisers.py.in")
+ set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup-regularisers.py")
+ #set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/module/__init__.py")
+ set (DEPS "${CMAKE_BINARY_DIR}/Core/")
+ set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
+
+ configure_file(${SETUP_PY_IN} ${SETUP_PY})
+
+ message("Core binary dir " ${CMAKE_BINARY_DIR}/Core/${CMAKE_BUILD_TYPE})
+
+ if (CONDA_BUILD)
+ add_custom_command(OUTPUT ${OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/ccpi ${CMAKE_CURRENT_BINARY_DIR}/ccpi
+ COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=${CIL_VERSION}
+ PREFIX=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_INC=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_LIB=${CMAKE_BINARY_DIR}/Core
+ ${PYTHON_EXECUTABLE} ${SETUP_PY} install
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
+ DEPENDS cilreg)
+
+ else()
+ if (WIN32)
+ add_custom_command(OUTPUT ${OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/ccpi ${CMAKE_CURRENT_BINARY_DIR}/ccpi
+ COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=${CIL_VERSION}
+ PREFIX=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_INC=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_LIB=${CMAKE_BINARY_DIR}/Core/${CMAKE_BUILD_TYPE}
+ ${PYTHON_EXECUTABLE} ${SETUP_PY} build_ext --inplace
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
+ DEPENDS cilreg)
+ else()
+ add_custom_command(OUTPUT ${OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/ccpi ${CMAKE_CURRENT_BINARY_DIR}/ccpi
+ COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=${CIL_VERSION}
+ PREFIX=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_INC=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_LIB=${CMAKE_BINARY_DIR}/Core
+ ${PYTHON_EXECUTABLE} ${SETUP_PY} build_ext --inplace
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
+ DEPENDS cilreg)
+ endif()
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ccpi
+ DESTINATION ${PYTHON_DEST})
+ endif()
+
+
+ add_custom_target(PythonWrapper ALL DEPENDS ${OUTPUT})
+
+ #install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
+endif()
diff --git a/Wrappers/Python/conda-recipe/bld.bat b/Wrappers/Python/conda-recipe/bld.bat
index e47f8d9..6c84355 100644
--- a/Wrappers/Python/conda-recipe/bld.bat
+++ b/Wrappers/Python/conda-recipe/bld.bat
@@ -6,12 +6,15 @@ exit 1
mkdir "%SRC_DIR%\ccpi"
ROBOCOPY /E "%RECIPE_DIR%\..\.." "%SRC_DIR%\ccpi"
ROBOCOPY /E "%RECIPE_DIR%\..\..\..\Core" "%SRC_DIR%\Core"
-cd %SRC_DIR%\ccpi\Python
+::cd %SRC_DIR%\ccpi\Python
+cd %SRC_DIR%
:: issue cmake to create setup.py
-cmake .
+cmake -G "NMake Makefiles" %RECIPE_DIR%\..\..\..\ -DBUILD_PYTHON_WRAPPERS=ON -DCONDA_BUILD=ON -DBUILD_CUDA=OFF -DCMAKE_BUILD_TYPE="Release" -DLIBRARY_LIB="%CONDA_PREFIX%\lib" -DLIBRARY_INC="%CONDA_PREFIX%" -DCMAKE_INSTALL_PREFIX="%PREFIX%\Library"
-%PYTHON% setup-regularisers.py build_ext
-if errorlevel 1 exit 1
-%PYTHON% setup-regularisers.py install
-if errorlevel 1 exit 1
+::%PYTHON% setup-regularisers.py build_ext
+::if errorlevel 1 exit 1
+::%PYTHON% setup-regularisers.py install
+::if errorlevel 1 exit 1
+nmake install
+if errorlevel 1 exit 1 \ No newline at end of file
diff --git a/Wrappers/Python/conda-recipe/build.sh b/Wrappers/Python/conda-recipe/build.sh
index 8b05663..54bc8e2 100644
--- a/Wrappers/Python/conda-recipe/build.sh
+++ b/Wrappers/Python/conda-recipe/build.sh
@@ -1,19 +1,16 @@
-if [ -z "$CIL_VERSION" ]; then
- echo "Need to set CIL_VERSION"
- exit 1
-fi
mkdir "$SRC_DIR/ccpi"
cp -rv "$RECIPE_DIR/../.." "$SRC_DIR/ccpi"
cp -rv "$RECIPE_DIR/../../../Core" "$SRC_DIR/Core"
-cd $SRC_DIR/ccpi/Python
+cd $SRC_DIR
-echo "$SRC_DIR/ccpi/Python"
+cmake -G "Unix Makefiles" $RECIPE_DIR/../../../ -DBUILD_PYTHON_WRAPPER=ON -DCONDA_BUILD=ON -DBUILD_CUDA=ON -DCMAKE_BUILD_TYPE="Release" -DLIBRARY_LIB=$CONDA_PREFIX/lib -DLIBRARY_INC=$CONDA_PREFIX -DCMAKE_INSTALL_PREFIX=$PREFIX
-cmake .
-$PYTHON setup-regularisers.py build_ext
-$PYTHON setup-regularisers.py install
+make install
+
+#$PYTHON setup-regularisers.py build_ext
+#$PYTHON setup-regularisers.py install
diff --git a/Wrappers/Python/conda-recipe/meta.yaml b/Wrappers/Python/conda-recipe/meta.yaml
index ca28bae..9286cc4 100644
--- a/Wrappers/Python/conda-recipe/meta.yaml
+++ b/Wrappers/Python/conda-recipe/meta.yaml
@@ -1,12 +1,10 @@
package:
name: ccpi-regulariser
- version: {{ environ['CIL_VERSION'] }}
+ version: 0.10.1
build:
preserve_egg_dir: False
- script_env:
- - CIL_VERSION
# number: 0
test:
@@ -21,7 +19,6 @@ requirements:
- numpy x.x
- setuptools
- cython
- - cil_regulariser =={{ environ['CIL_VERSION'] }}
- vc 14 # [win and py36]
- vc 14 # [win and py35]
- vc 9 # [win and py27]
@@ -30,7 +27,6 @@ requirements:
run:
- python
- numpy x.x
- - cil_regulariser =={{ environ['CIL_VERSION'] }}
- vc 14 # [win and py36]
- vc 14 # [win and py35]
- vc 9 # [win and py27]
diff --git a/Wrappers/Python/setup-regularisers.py.in b/Wrappers/Python/setup-regularisers.py.in
index 7108683..542dcb4 100644
--- a/Wrappers/Python/setup-regularisers.py.in
+++ b/Wrappers/Python/setup-regularisers.py.in
@@ -27,11 +27,13 @@ except:
extra_include_dirs = [numpy.get_include(), library_include_path]
#extra_library_dirs = [os.path.join(library_include_path, "..", "lib")]
extra_compile_args = []
-extra_library_dirs = []
+extra_library_dirs = [library_lib_path]
extra_compile_args = []
extra_link_args = []
extra_libraries = ['cilreg']
+print ("extra_library_dirs " , extra_library_dirs)
+
extra_include_dirs += [os.path.join(".." , ".." , "Core"),
os.path.join(".." , ".." , "Core", "regularisers_CPU"),
os.path.join(".." , ".." , "Core", "inpainters_CPU"),