Fixed imports, and PEP8 styling
This commit is contained in:
parent
298bc2ba6a
commit
89ea6a69de
3 changed files with 30 additions and 33 deletions
|
|
@ -1 +1 @@
|
|||
from .plugin import StackPlugin
|
||||
from .plugin import ScanPlugin
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import numpy as np
|
||||
|
||||
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
|
||||
from openflexure_microscope.api.utilities import JsonPayload
|
||||
|
||||
|
|
@ -9,7 +7,7 @@ from flask import request, jsonify, abort
|
|||
class TileScanAPI(MicroscopeViewPlugin):
|
||||
def post(self):
|
||||
payload = JsonPayload(request)
|
||||
|
||||
|
||||
# Get params
|
||||
name = payload.param('name')
|
||||
step_size = payload.param('step_size', default=[2000, 1500], convert=list)
|
||||
|
|
@ -31,29 +29,28 @@ class TileScanAPI(MicroscopeViewPlugin):
|
|||
print("Running tile scan...")
|
||||
task = self.microscope.task.start(
|
||||
self.plugin.tile,
|
||||
basename = name,
|
||||
step_size = step_size,
|
||||
grid = grid,
|
||||
autofocus_dz = autofocus_dz,
|
||||
use_video_port = use_video_port,
|
||||
resize = resize,
|
||||
bayer = bayer,
|
||||
metadata = metadata,
|
||||
tags = tags
|
||||
basename=name,
|
||||
step_size=step_size,
|
||||
grid=grid,
|
||||
autofocus_dz=autofocus_dz,
|
||||
use_video_port=use_video_port,
|
||||
resize=resize,
|
||||
bayer=bayer,
|
||||
metadata=metadata,
|
||||
tags=tags
|
||||
)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
return jsonify(task.state, 202)
|
||||
|
||||
|
||||
|
||||
class ZStackAPI(MicroscopeViewPlugin):
|
||||
def post(self):
|
||||
payload = JsonPayload(request)
|
||||
|
||||
|
||||
# Get params
|
||||
name = payload.param('name')
|
||||
step_size = payload.param('step_size', default=[2000, 1500], convert=list)
|
||||
step_size = payload.param('step_size', default=100, convert=int)
|
||||
steps = payload.param('steps', default=5, convert=int)
|
||||
center = payload.param('center', default=True, convert=bool)
|
||||
|
||||
|
|
@ -72,16 +69,16 @@ class ZStackAPI(MicroscopeViewPlugin):
|
|||
print("Running tile scan...")
|
||||
task = self.microscope.task.start(
|
||||
self.plugin.stack,
|
||||
basename = name,
|
||||
step_size = step_size,
|
||||
steps = steps,
|
||||
center = center,
|
||||
use_video_port = use_video_port,
|
||||
resize = resize,
|
||||
bayer = bayer,
|
||||
metadata = metadata,
|
||||
tags = tags
|
||||
basename=name,
|
||||
step_size=step_size,
|
||||
steps=steps,
|
||||
center=center,
|
||||
use_video_port=use_video_port,
|
||||
resize=resize,
|
||||
bayer=bayer,
|
||||
metadata=metadata,
|
||||
tags=tags
|
||||
)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
return jsonify(task.state, 202)
|
||||
return jsonify(task.state, 202)
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import uuid
|
|||
|
||||
from openflexure_microscope.camera.base import generate_basename
|
||||
from openflexure_microscope.plugins import MicroscopePlugin
|
||||
from openflexure_microscope.utilities import set_properties
|
||||
|
||||
from .api import TileScanAPI, ZStackAPI
|
||||
|
||||
|
||||
class ScanPlugin(MicroscopePlugin):
|
||||
"""
|
||||
Stack and tile plugin
|
||||
|
|
@ -19,7 +19,6 @@ class ScanPlugin(MicroscopePlugin):
|
|||
'/stack': ZStackAPI,
|
||||
}
|
||||
|
||||
|
||||
def capture(self,
|
||||
basename,
|
||||
scan_id,
|
||||
|
|
@ -95,7 +94,8 @@ class ScanPlugin(MicroscopePlugin):
|
|||
for j in range(grid[1]):
|
||||
|
||||
if autofocus_enabled:
|
||||
self.microscope.plugin.default_autofocus.autofocus(range(-2*autofocus_dz, 3*autofocus_dz, autofocus_dz))
|
||||
self.microscope.plugin.default_autofocus.autofocus(
|
||||
range(-2 * autofocus_dz, 3 * autofocus_dz, autofocus_dz))
|
||||
|
||||
self.capture(
|
||||
basename,
|
||||
|
|
@ -108,11 +108,11 @@ class ScanPlugin(MicroscopePlugin):
|
|||
)
|
||||
|
||||
if j != grid[0] - 1:
|
||||
self.microscope.stage.move_rel([step_size[0]*xdirection, 0, 0])
|
||||
self.microscope.stage.move_rel([step_size[0] * xdirection, 0, 0])
|
||||
|
||||
xdirection *= -1
|
||||
if i != grid[1] - 1:
|
||||
self.microscope.stage.move_rel([256*xdirection, step_size[1], 0])
|
||||
self.microscope.stage.move_rel([256 * xdirection, step_size[1], 0])
|
||||
|
||||
self.microscope.stage.move_abs(initial_position)
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class ScanPlugin(MicroscopePlugin):
|
|||
self,
|
||||
basename: str = None,
|
||||
step_size: int = 100,
|
||||
steps: list = 5,
|
||||
steps: int = 5,
|
||||
center: bool = True,
|
||||
use_video_port: bool = False,
|
||||
resize: Tuple[int, int] = None,
|
||||
|
|
@ -140,7 +140,7 @@ class ScanPlugin(MicroscopePlugin):
|
|||
|
||||
# Move to center scan
|
||||
if center:
|
||||
self.microscope.stage.move_rel([0, 0, int((-step_size * steps)/2)])
|
||||
self.microscope.stage.move_rel([0, 0, int((-step_size * steps) / 2)])
|
||||
|
||||
with self.microscope.lock:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue