Blackened
This commit is contained in:
parent
4e7606aa0c
commit
dd82528d78
3 changed files with 51 additions and 49 deletions
|
|
@ -90,7 +90,9 @@ api_microscope.attach(api_camera, api_stage)
|
||||||
|
|
||||||
# Restore loaded capture array to camera object
|
# Restore loaded capture array to camera object
|
||||||
logging.debug("Restoring captures...")
|
logging.debug("Restoring captures...")
|
||||||
api_microscope.camera.images = build_captures_from_exif(api_microscope.camera.paths["default"])
|
api_microscope.camera.images = build_captures_from_exif(
|
||||||
|
api_microscope.camera.paths["default"]
|
||||||
|
)
|
||||||
|
|
||||||
logging.debug("Microscope successfully attached!")
|
logging.debug("Microscope successfully attached!")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,17 +143,13 @@ class Microscope:
|
||||||
self.attach_plugins(self.plugin_maps)
|
self.attach_plugins(self.plugin_maps)
|
||||||
|
|
||||||
def has_real_stage(self):
|
def has_real_stage(self):
|
||||||
if hasattr(self, "stage") and not isinstance(
|
if hasattr(self, "stage") and not isinstance(self.stage, MockStage):
|
||||||
self.stage, MockStage
|
|
||||||
):
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def has_real_camera(self):
|
def has_real_camera(self):
|
||||||
if hasattr(self, "camera") and not isinstance(
|
if hasattr(self, "camera") and not isinstance(self.camera, MockStreamer):
|
||||||
self.camera, MockStreamer
|
|
||||||
):
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,11 @@ import logging
|
||||||
|
|
||||||
from openflexure_microscope.camera.base import generate_basename
|
from openflexure_microscope.camera.base import generate_basename
|
||||||
|
|
||||||
from openflexure_microscope.devel import MicroscopePlugin, update_task_progress, update_task_data
|
from openflexure_microscope.devel import (
|
||||||
|
MicroscopePlugin,
|
||||||
|
update_task_progress,
|
||||||
|
update_task_data,
|
||||||
|
)
|
||||||
|
|
||||||
from .api import TileScanAPI
|
from .api import TileScanAPI
|
||||||
|
|
||||||
|
|
@ -64,15 +68,15 @@ class ScanPlugin(MicroscopePlugin):
|
||||||
return progress
|
return progress
|
||||||
|
|
||||||
def capture(
|
def capture(
|
||||||
self,
|
self,
|
||||||
basename,
|
basename,
|
||||||
scan_id,
|
scan_id,
|
||||||
temporary: bool = False,
|
temporary: bool = False,
|
||||||
use_video_port: bool = False,
|
use_video_port: bool = False,
|
||||||
resize: Tuple[int, int] = None,
|
resize: Tuple[int, int] = None,
|
||||||
bayer: bool = False,
|
bayer: bool = False,
|
||||||
metadata: dict = {},
|
metadata: dict = {},
|
||||||
tags: list = [],
|
tags: list = [],
|
||||||
):
|
):
|
||||||
|
|
||||||
# Construct a tile filename
|
# Construct a tile filename
|
||||||
|
|
@ -107,19 +111,19 @@ class ScanPlugin(MicroscopePlugin):
|
||||||
output.put_tags(tags)
|
output.put_tags(tags)
|
||||||
|
|
||||||
def tile(
|
def tile(
|
||||||
self,
|
self,
|
||||||
basename: str = None,
|
basename: str = None,
|
||||||
temporary: bool = False,
|
temporary: bool = False,
|
||||||
step_size: int = [2000, 1500, 100],
|
step_size: int = [2000, 1500, 100],
|
||||||
grid: list = [3, 3, 5],
|
grid: list = [3, 3, 5],
|
||||||
style="raster",
|
style="raster",
|
||||||
autofocus_dz: int = 50,
|
autofocus_dz: int = 50,
|
||||||
use_video_port: bool = False,
|
use_video_port: bool = False,
|
||||||
resize: Tuple[int, int] = None,
|
resize: Tuple[int, int] = None,
|
||||||
bayer: bool = False,
|
bayer: bool = False,
|
||||||
fast_autofocus=False,
|
fast_autofocus=False,
|
||||||
metadata: dict = {},
|
metadata: dict = {},
|
||||||
tags: list = [],
|
tags: list = [],
|
||||||
):
|
):
|
||||||
|
|
||||||
# Keep task progress
|
# Keep task progress
|
||||||
|
|
@ -143,17 +147,17 @@ class ScanPlugin(MicroscopePlugin):
|
||||||
|
|
||||||
# Check if autofocus is enabled
|
# Check if autofocus is enabled
|
||||||
if (
|
if (
|
||||||
autofocus_dz
|
autofocus_dz
|
||||||
and hasattr(self.microscope.plugin, "default_autofocus")
|
and hasattr(self.microscope.plugin, "default_autofocus")
|
||||||
and self.microscope.has_real_stage()
|
and self.microscope.has_real_stage()
|
||||||
and self.microscope.has_real_camera()
|
and self.microscope.has_real_camera()
|
||||||
):
|
):
|
||||||
autofocus_enabled = True
|
autofocus_enabled = True
|
||||||
else:
|
else:
|
||||||
autofocus_enabled = False
|
autofocus_enabled = False
|
||||||
|
|
||||||
if fast_autofocus and not hasattr(
|
if fast_autofocus and not hasattr(
|
||||||
self.microscope.plugin.default_autofocus, "monitor_sharpness"
|
self.microscope.plugin.default_autofocus, "monitor_sharpness"
|
||||||
):
|
):
|
||||||
logging.warning(
|
logging.warning(
|
||||||
"Can't use fast autofocus in the scan - the default plugin doesn't support monitor_sharpness; maybe it is too old?"
|
"Can't use fast autofocus in the scan - the default plugin doesn't support monitor_sharpness; maybe it is too old?"
|
||||||
|
|
@ -241,7 +245,7 @@ class ScanPlugin(MicroscopePlugin):
|
||||||
next_z = self.microscope.stage.position[2]
|
next_z = self.microscope.stage.position[2]
|
||||||
if fast_autofocus:
|
if fast_autofocus:
|
||||||
next_z += (
|
next_z += (
|
||||||
autofocus_dz / 2
|
autofocus_dz / 2
|
||||||
) # Fast autofocus requires us to start at the top of the range
|
) # Fast autofocus requires us to start at the top of the range
|
||||||
if grid[2] > 1:
|
if grid[2] > 1:
|
||||||
next_z -= int(
|
next_z -= int(
|
||||||
|
|
@ -252,19 +256,19 @@ class ScanPlugin(MicroscopePlugin):
|
||||||
self.microscope.stage.move_abs(initial_position)
|
self.microscope.stage.move_abs(initial_position)
|
||||||
|
|
||||||
def stack(
|
def stack(
|
||||||
self,
|
self,
|
||||||
basename: str = None,
|
basename: str = None,
|
||||||
temporary: bool = False,
|
temporary: bool = False,
|
||||||
scan_id: str = None,
|
scan_id: str = None,
|
||||||
step_size: int = 100,
|
step_size: int = 100,
|
||||||
steps: int = 5,
|
steps: int = 5,
|
||||||
center: bool = True,
|
center: bool = True,
|
||||||
return_to_start: bool = True,
|
return_to_start: bool = True,
|
||||||
use_video_port: bool = False,
|
use_video_port: bool = False,
|
||||||
resize: Tuple[int, int] = None,
|
resize: Tuple[int, int] = None,
|
||||||
bayer: bool = False,
|
bayer: bool = False,
|
||||||
metadata: dict = {},
|
metadata: dict = {},
|
||||||
tags: list = [],
|
tags: list = [],
|
||||||
):
|
):
|
||||||
|
|
||||||
# Generate a basename if none given
|
# Generate a basename if none given
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue