unwrap: Refactor and fix wrap around functionality.

This commit is contained in:
Jostein Bø Fløystad
2013-07-11 12:51:08 +02:00
parent 6dbe6965e6
commit 12268ff555
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -7,12 +7,12 @@ cdef extern void unwrap2D(float* wrapped_image,
def _unwrap2D(float[:,::1] array,
unsigned char[:,::1] mask,
float[:,::1] unwrapped_array,
wrap_around_x, wrap_around_y):
wrap_around):
unwrap2D(&array[0,0],
&unwrapped_array[0,0],
&mask[0,0],
array.shape[1], array.shape[0],
wrap_around_x, wrap_around_y,
wrap_around[1], wrap_around[0],
)
+2 -2
View File
@@ -7,12 +7,12 @@ cdef extern void unwrap3D(float* wrapped_volume,
def _unwrap3D(float[:,:,::1] array,
unsigned char[:,:,::1] mask,
float[:,:,::1] unwrapped_array,
wrap_around_x, wrap_around_y, wrap_around_z):
wrap_around):
unwrap3D(&array[0,0,0],
&unwrapped_array[0,0,0],
&mask[0,0,0],
array.shape[2], array.shape[1], array.shape[0], #TODO: check!!!
wrap_around_x, wrap_around_y, wrap_around_z,
wrap_around[2], wrap_around[1], wrap_around[0],
)
+2 -2
View File
@@ -62,10 +62,10 @@ def unwrap(image, wrap_around=False):
if image.ndim == 2:
_unwrap_2d._unwrap2D(image_not_masked, mask, image_unwrapped,
wrap_around[0], wrap_around[1])
wrap_around)
elif image.ndim == 3:
_unwrap_3d._unwrap3D(image_not_masked, mask, image_unwrapped,
wrap_around[0], wrap_around[1], wrap_around[2])
wrap_around)
if np.ma.isMaskedArray(image):
return np.ma.array(image_unwrapped, mask=mask)