Apply 2 suggestion(s) to 1 file(s)
Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
parent
41f6c8879a
commit
69db7b4041
1 changed files with 5 additions and 5 deletions
|
|
@ -104,15 +104,15 @@ class SimulatedCamera(BaseCamera):
|
||||||
"""Generate an image with blobs based on supplied coordinates"""
|
"""Generate an image with blobs based on supplied coordinates"""
|
||||||
canvas_width, canvas_height, _ = self.canvas_shape
|
canvas_width, canvas_height, _ = self.canvas_shape
|
||||||
image_width, image_height, _ = self.shape
|
image_width, image_height, _ = self.shape
|
||||||
pos = [x * RATIO for x in pos]
|
pos = tuple(x * RATIO for x in pos)
|
||||||
top_left = (
|
top_left = (
|
||||||
int(pos[0]) - image_width // 2 - canvas_width // 2,
|
int(pos[0]) - image_width // 2 - canvas_width // 2,
|
||||||
int(pos[1]) - image_height // 2 - canvas_height // 2,
|
int(pos[1]) - image_height // 2 - canvas_height // 2,
|
||||||
)
|
)
|
||||||
focused_image = self.canvas[
|
x_slice = slice(top_left[0], top_left[0] + self.shape[0])
|
||||||
tuple(slice(top_left[i], top_left[i] + self.shape[i]) for i in range(2))
|
y_slice = slice(top_left[1], top_left[1] + self.shape[0])
|
||||||
+ (slice(None),)
|
z_slice = slice(None)
|
||||||
]
|
focused_image = self.canvas[(x_slice, y_slice, z_slice)]
|
||||||
image = gaussian_filter(
|
image = gaussian_filter(
|
||||||
focused_image,
|
focused_image,
|
||||||
sigma=np.abs(pos[2]) / 5,
|
sigma=np.abs(pos[2]) / 5,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue