Skip to content

Commit

Permalink
Merge pull request #146 from juglab/fix-145
Browse files Browse the repository at this point in the history
Remove additional dimension in single-patch extraction.
  • Loading branch information
jdeschamps authored Nov 15, 2023
2 parents 2ff781b + 3697518 commit b05ce64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions n2v/internals/N2V_DataGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def __extract_patches__(self, data, num_patches=None, shape=(256, 256), n_dims=2
if len(patches) > 1:
return np.stack(patches)
else:
return np.array(patches)[np.newaxis]
return np.array(patches)
elif n_dims == 3:
for i in range(num_patches):
z, y, x = np.random.randint(0, data.shape[1] - shape[0] + 1), np.random.randint(0,
Expand All @@ -250,7 +250,7 @@ def __extract_patches__(self, data, num_patches=None, shape=(256, 256), n_dims=2
if len(patches) > 1:
return np.stack(patches)
else:
return np.array(patches)[np.newaxis]
return np.array(patches)
else:
print('Not implemented for more than 4 dimensional (ZYXC) data.')

Expand Down

0 comments on commit b05ce64

Please sign in to comment.