diff --git a/unwrap2D/Miguel_2D_unwrapper_with_mask_and_wrap_around_option.c b/unwrap2D/Miguel_2D_unwrapper_with_mask_and_wrap_around_option.c index d8411c81..4fe59109 100644 --- a/unwrap2D/Miguel_2D_unwrapper_with_mask_and_wrap_around_option.c +++ b/unwrap2D/Miguel_2D_unwrapper_with_mask_and_wrap_around_option.c @@ -141,8 +141,8 @@ void quicker_sort(EDGE *left, EDGE *right) //--------------end quicker_sort algorithm ----------------------------------- -//--------------------start initialse pixels ---------------------------------- -//initialse pixels. See the explination of the pixel class above. +//--------------------start initialize pixels ---------------------------------- +//initialize pixels. See the explination of the pixel class above. //initially every pixel is assumed to belong to a group consisting of only itself void initialisePIXELs(float *WrappedImage, unsigned char *input_mask, unsigned char *extended_mask, PIXELM *pixel, int image_width, int image_height) { @@ -156,8 +156,6 @@ void initialisePIXELs(float *WrappedImage, unsigned char *input_mask, unsigned { for (j=0; j < image_width; j++) { - //pixel_pointer->x = j; - //pixel_pointer->y = i; pixel_pointer->increment = 0; pixel_pointer->number_of_pixels_in_group = 1; pixel_pointer->value = *wrapped_image_pointer; @@ -176,7 +174,7 @@ void initialisePIXELs(float *WrappedImage, unsigned char *input_mask, unsigned } } } -//-------------------end initialise pixels ----------- +//-------------------end initialize pixels ----------- //gamma function in the paper float wrap(float pixel_value) @@ -681,7 +679,8 @@ void returnImage(PIXELM *pixel, float *unwrappedImage, int image_width, int ima //the main function of the unwrapper int unwrap(float* WrappedImage, float* UnwrappedImage, unsigned char* input_mask, - int image_width, int image_height) + int image_width, int image_height, + int wrap_around_x, int wrap_around_y) { unsigned char *extended_mask; int image_size = image_height * image_width; diff --git a/unwrap2D/unwrap2D.pyx b/unwrap2D/unwrap2D.pyx index d92032a4..ac4a3d33 100644 --- a/unwrap2D/unwrap2D.pyx +++ b/unwrap2D/unwrap2D.pyx @@ -2,16 +2,20 @@ import numpy as np cimport numpy as np cdef extern int unwrap(float* WrappedImage, float* UnwrappedImage, unsigned char* input_mask, - int image_width, int image_height) + int image_width, int image_height, + int wrap_around_x, int wrap_around_y) -def unwrap2D(float[:,::1] array, unsigned char[:,::1] mask): +def unwrap2D(float[:,::1] array, unsigned char[:,::1] mask, + wrap_around_x = False, wrap_around_y = False): cdef float[:,::1] unwrapped_array = np.empty_like(array) cdef int h = array.shape[0] cdef int w = array.shape[1] unwrap(&array[0,0], &unwrapped_array[0,0], &mask[0,0], - array.shape[0], array.shape[1]) - return unwrapped_array + array.shape[0], array.shape[1], + wrap_around_x, wrap_around_y, + ) + return np.asarray(unwrapped_array)