summaryrefslogtreecommitdiffstats
path: root/src/Matlab
diff options
context:
space:
mode:
authordkazanc <dkazanc@hotmail.com>2019-09-03 17:02:54 +0100
committerdkazanc <dkazanc@hotmail.com>2019-09-03 17:02:54 +0100
commitd2d4b4bd1db461fb9215abd20f829ce0298f3876 (patch)
tree05c64c6d408b5a1266e763cc4addbeb92ea0a2fd /src/Matlab
parente2d85c8557733174690da77f712a0c0a7c2d26e0 (diff)
downloadregularization-d2d4b4bd1db461fb9215abd20f829ce0298f3876.tar.gz
regularization-d2d4b4bd1db461fb9215abd20f829ce0298f3876.tar.bz2
regularization-d2d4b4bd1db461fb9215abd20f829ce0298f3876.tar.xz
regularization-d2d4b4bd1db461fb9215abd20f829ce0298f3876.zip
CPU fixed, GPU almost
Diffstat (limited to 'src/Matlab')
-rw-r--r--src/Matlab/mex_compile/regularisers_CPU/Nonlocal_TV.c30
-rw-r--r--src/Matlab/mex_compile/regularisers_CPU/PatchSelect.c24
2 files changed, 27 insertions, 27 deletions
diff --git a/src/Matlab/mex_compile/regularisers_CPU/Nonlocal_TV.c b/src/Matlab/mex_compile/regularisers_CPU/Nonlocal_TV.c
index 34b9915..a5fb1df 100644
--- a/src/Matlab/mex_compile/regularisers_CPU/Nonlocal_TV.c
+++ b/src/Matlab/mex_compile/regularisers_CPU/Nonlocal_TV.c
@@ -1,11 +1,11 @@
/*
* This work is part of the Core Imaging Library developed by
* Visual Analytics and Imaging System Group of the Science Technology
- * Facilities Council, STFC and Diamond Light Source Ltd.
+ * Facilities Council, STFC and Diamond Light Source Ltd.
*
* Copyright 2017 Daniil Kazantsev
* Copyright 2017 Srikanth Nagella, Edoardo Pasca
- * Copyright 2018 Diamond Light Source Ltd.
+ * Copyright 2018 Diamond Light Source Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,12 +35,12 @@
* 2. AR_i - indeces of i neighbours
* 3. AR_j - indeces of j neighbours
* 4. AR_k - indeces of k neighbours (0 - for 2D case)
- * 5. Weights_ij(k) - associated weights
+ * 5. Weights_ij(k) - associated weights
* 6. regularisation parameter
- * 7. iterations number
-
+ * 7. iterations number
+
* Output:
- * 1. denoised image/volume
+ * 1. denoised image/volume
* Elmoataz, Abderrahim, Olivier Lezoray, and Sébastien Bougleux. "Nonlocal discrete regularization on weighted graphs: a framework for image and manifold processing." IEEE Trans. Image Processing 17, no. 7 (2008): 1047-1060.
*/
@@ -54,11 +54,11 @@ void mexFunction(
const mwSize *dim_array;
const mwSize *dim_array2;
float *A_orig, *Output=NULL, *Weights, lambda;
-
+
dim_array = mxGetDimensions(prhs[0]);
dim_array2 = mxGetDimensions(prhs[1]);
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
-
+
/*Handling Matlab input data*/
A_orig = (float *) mxGetData(prhs[0]); /* a 2D image or a set of 2D images (3D stack) */
H_i = (unsigned short *) mxGetData(prhs[1]); /* indeces of i neighbours */
@@ -67,14 +67,14 @@ void mexFunction(
Weights = (float *) mxGetData(prhs[4]); /* weights for patches */
lambda = (float) mxGetScalar(prhs[5]); /* regularisation parameter */
IterNumb = (int) mxGetScalar(prhs[6]); /* the number of iterations */
-
- dimX = dim_array[0]; dimY = dim_array[1]; dimZ = dim_array[2];
-
+
+ dimX = dim_array[0]; dimY = dim_array[1]; dimZ = dim_array[2];
+
/*****2D INPUT *****/
if (number_of_dims == 2) {
- dimZ = 0;
+ dimZ = 0;
NumNeighb = dim_array2[2];
- Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(2, dim_array, mxSINGLE_CLASS, mxREAL));
+ Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(2, dim_array, mxSINGLE_CLASS, mxREAL));
}
/*****3D INPUT *****/
/****************************************************/
@@ -82,7 +82,7 @@ void mexFunction(
NumNeighb = dim_array2[3];
Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array, mxSINGLE_CLASS, mxREAL));
}
-
+
/* run the main function here */
- Nonlocal_TV_CPU_main(A_orig, Output, H_i, H_j, H_k, Weights, dimX, dimY, dimZ, NumNeighb, lambda, IterNumb);
+ Nonlocal_TV_CPU_main(A_orig, Output, H_i, H_j, H_k, Weights, dimX, dimY, dimZ, NumNeighb, lambda, IterNumb, 0);
}
diff --git a/src/Matlab/mex_compile/regularisers_CPU/PatchSelect.c b/src/Matlab/mex_compile/regularisers_CPU/PatchSelect.c
index 1acab29..84b08dd 100644
--- a/src/Matlab/mex_compile/regularisers_CPU/PatchSelect.c
+++ b/src/Matlab/mex_compile/regularisers_CPU/PatchSelect.c
@@ -1,11 +1,11 @@
/*
* This work is part of the Core Imaging Library developed by
* Visual Analytics and Imaging System Group of the Science Technology
- * Facilities Council, STFC and Diamond Light Source Ltd.
+ * Facilities Council, STFC and Diamond Light Source Ltd.
*
* Copyright 2017 Daniil Kazantsev
* Copyright 2017 Srikanth Nagella, Edoardo Pasca
- * Copyright 2018 Diamond Light Source Ltd.
+ * Copyright 2018 Diamond Light Source Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,14 +53,14 @@ void mexFunction(
int number_of_dims, SearchWindow, SimilarWin, NumNeighb;
mwSize dimX, dimY, dimZ;
const mwSize *dim_array;
- unsigned short *H_i=NULL, *H_j=NULL, *H_k=NULL;
+ unsigned short *H_i=NULL, *H_j=NULL, *H_k=NULL;
float *A, *Weights = NULL, h;
mwSize dim_array2[3]; /* for 2D data */
mwSize dim_array3[4]; /* for 3D data */
-
+
dim_array = mxGetDimensions(prhs[0]);
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
-
+
/*Handling Matlab input data*/
A = (float *) mxGetData(prhs[0]); /* a 2D or 3D image/volume */
SearchWindow = (int) mxGetScalar(prhs[1]); /* Large Searching window */
@@ -71,22 +71,22 @@ void mexFunction(
dimX = dim_array[0]; dimY = dim_array[1]; dimZ = dim_array[2];
dim_array2[0] = dimX; dim_array2[1] = dimY; dim_array2[2] = NumNeighb; /* 2D case */
dim_array3[0] = dimX; dim_array3[1] = dimY; dim_array3[2] = dimZ; dim_array3[3] = NumNeighb; /* 3D case */
-
+
/****************2D INPUT ***************/
if (number_of_dims == 2) {
- dimZ = 0;
+ dimZ = 0;
H_i = (unsigned short*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array2, mxUINT16_CLASS, mxREAL));
H_j = (unsigned short*)mxGetPr(plhs[1] = mxCreateNumericArray(3, dim_array2, mxUINT16_CLASS, mxREAL));
Weights = (float*)mxGetPr(plhs[2] = mxCreateNumericArray(3, dim_array2, mxSINGLE_CLASS, mxREAL));
}
/****************3D INPUT ***************/
- if (number_of_dims == 3) {
+ if (number_of_dims == 3) {
H_i = (unsigned short*)mxGetPr(plhs[0] = mxCreateNumericArray(4, dim_array3, mxUINT16_CLASS, mxREAL));
H_j = (unsigned short*)mxGetPr(plhs[1] = mxCreateNumericArray(4, dim_array3, mxUINT16_CLASS, mxREAL));
H_k = (unsigned short*)mxGetPr(plhs[2] = mxCreateNumericArray(4, dim_array3, mxUINT16_CLASS, mxREAL));
- Weights = (float*)mxGetPr(plhs[3] = mxCreateNumericArray(4, dim_array3, mxSINGLE_CLASS, mxREAL));
+ Weights = (float*)mxGetPr(plhs[3] = mxCreateNumericArray(4, dim_array3, mxSINGLE_CLASS, mxREAL));
}
-
- PatchSelect_CPU_main(A, H_i, H_j, H_k, Weights, (long)(dimX), (long)(dimY), (long)(dimZ), SearchWindow, SimilarWin, NumNeighb, h, 0);
-
+
+ PatchSelect_CPU_main(A, H_i, H_j, H_k, Weights, (long)(dimX), (long)(dimY), (long)(dimZ), SearchWindow, SimilarWin, NumNeighb, h);
+
}