diff options
author | algol <dkazanc@hotmail.com> | 2018-08-10 15:03:34 +0100 |
---|---|---|
committer | algol <dkazanc@hotmail.com> | 2018-08-10 15:04:57 +0100 |
commit | ff5cb4f35609b0b02698978fb8210dc7d09f0190 (patch) | |
tree | af05fe1205b8f16f58aedb93608e777d1d5423c5 | |
parent | 44c897e2b13d2b85a8dde028fd80ec3413c80cf4 (diff) | |
download | regularization-ff5cb4f35609b0b02698978fb8210dc7d09f0190.tar.gz regularization-ff5cb4f35609b0b02698978fb8210dc7d09f0190.tar.bz2 regularization-ff5cb4f35609b0b02698978fb8210dc7d09f0190.tar.xz regularization-ff5cb4f35609b0b02698978fb8210dc7d09f0190.zip |
bugfix initialisation of array
-rwxr-xr-x | Wrappers/Matlab/CMakeLists.txt | 25 | ||||
-rw-r--r-- | Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c | 26 |
2 files changed, 40 insertions, 11 deletions
diff --git a/Wrappers/Matlab/CMakeLists.txt b/Wrappers/Matlab/CMakeLists.txt index 9cbade9..cd46051 100755 --- a/Wrappers/Matlab/CMakeLists.txt +++ b/Wrappers/Matlab/CMakeLists.txt @@ -47,17 +47,22 @@ message(STATUS "Matlab wrappers will be installed in " ${MATLAB_DEST}) file(GLOB CPU_MEX_FILES
"${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_CPU/*.c"
- "${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/inpainters_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 ${num})
+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)
@@ -70,6 +75,18 @@ foreach(tgt RANGE ${num}) 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}
)
@@ -79,7 +96,7 @@ target_include_directories(${current_target} ${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()
@@ -126,4 +143,4 @@ if (BUILD_CUDA) add_custom_target(MatlabWrapperGPU DEPENDS ${GPU_MEX_TARGETS})
endif()
-endif()
\ No newline at end of file +endif()
diff --git a/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c b/Wrappers/Matlab/mex_compile/regularisers_CPU/ROF_TV.c index 6b9e1ea..ca484ba 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, j; + 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,25 @@ 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) { + //const mwSize dim_array[2] = {dimX, dimY}; 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)); + //mexErrMsgTxt("Call me 72"); } - if (number_of_dims == 3) Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array, mxSINGLE_CLASS, mxREAL)); + if (number_of_dims == 3) { + //const mwSize dim_array[3] = {dimX, dimY, dimZ}; + Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array_i, mxSINGLE_CLASS, mxREAL)); + } + +// for(j=0; j<(int)(dimX*dimY*dimZ); j++) { +// if (j%10 == 0) mexErrMsgTxt("WHAT???"); +// Output[j] = 2;} TV_ROF_CPU_main(Input, Output, lambda, iter_numb, tau, dimX, dimY, dimZ); }
\ No newline at end of file |