Skip to content
Snippets Groups Projects

Synthetic collection generation

1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
+ 2
2
@@ -226,7 +226,7 @@ def collection(
angle = rng.uniform(low = 0, high = max_rotation_degrees) # Sample rotation angle
axes = rng.choice([(0, 1), (0, 2), (1, 2)]) # Sample the two axes to rotate around
blob = scipy.ndimage.rotate(blob, angle, axes, order=0)
blob = scipy.ndimage.rotate(blob, angle, axes, order=1)
# Place synthetic object into the collection
# If positions are specified, place blob at one of the specified positions
@@ -243,7 +243,7 @@ def collection(
break
# Update labels
new_labels = np.where(collection > collection_before, i, 0).astype(labels.dtype)
new_labels = np.where(collection > collection_before, i+1, 0).astype(labels.dtype)
labels += new_labels
if not placed:
Loading