Skip to content
Snippets Groups Projects
Commit 7cde58e5 authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Optimized reshape_flat_patches function in patch_utils

parent 3096a84d
No related branches found
Tags v1.1.2
1 merge request!83Preprocessing and quality check
Pipeline #26159 passed
......@@ -45,16 +45,10 @@ def reshape_flat_patches(patches, patch_reshape_parameters = None):
if patch_reshape_parameters is not None:
if len(patch_reshape_parameters)==2:
# The dimensionality of the reshaped patch:
new_shape = [np.int(len(patch)/(patch_reshape_parameters[-2]*patch_reshape_parameters[-1]))] + list(patch_reshape_parameters[-2:])
patch = patch.reshape(patch_reshape_parameters[0],
patch_reshape_parameters[1]) # reshape the patch
elif len(patch_reshape_parameters)==3:
patch = patch.reshape(patch_reshape_parameters[0],
patch_reshape_parameters[1],
patch_reshape_parameters[2]) # reshape the patch
patch = np.squeeze(patch.reshape(new_shape))
patches_3d.append(patch)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment